/* =========================================================
   KMS Theme — components.css
   Compact, dense styling for the data-heavy UI: tables, forms,
   lists, buttons, status messages, breadcrumbs, primary nav.
   ========================================================= */

/* ---------- Primary navigation (left sidebar) ---------- */

.kms-sidebar ul,
.kms-sidebar .menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kms-sidebar .block {
  margin-bottom: var(--kms-space-3);
}

.kms-sidebar h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kms-color-text-muted);
  padding: var(--kms-space-2) var(--kms-space-3);
  margin: 0 0 var(--kms-space-1);
  border-bottom: 1px solid var(--kms-color-border);
}

.kms-sidebar a,
.kms-sidebar .menu-item > span {
  display: block;
  padding: 6px var(--kms-space-3);
  color: var(--kms-color-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 13px;
}

.kms-sidebar a:hover,
.kms-sidebar a:focus {
  background: #f3f3f0;
  color: var(--kms-color-primary);
}

.kms-sidebar .menu-item--active-trail > a,
.kms-sidebar a.is-active {
  background: #f3f3f0;
  border-left-color: var(--kms-color-primary);
  font-weight: 600;
  color: var(--kms-color-primary);
}

/* Top-level nolink items (Knowledge, Tracking, Applications) render as
   small uppercase section headers — they group their children visually
   without competing with the clickable items. */
.kms-sidebar .menu--level-0 > .menu-item--expanded > span {
  margin-top: var(--kms-space-3);
  padding: var(--kms-space-1) var(--kms-space-3) 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kms-color-text-muted);
  border-left: none;
  cursor: default;
}

.kms-sidebar .menu .menu {
  padding-left: var(--kms-space-3);
}

/* ---------- Breadcrumbs ---------- */

.breadcrumb {
  font-size: var(--kms-font-size-sm);
  color: var(--kms-color-text-muted);
  margin: 0 0 var(--kms-space-3);
  padding: 0;
}

.breadcrumb__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb__item {
  display: inline;
}

.breadcrumb__item + .breadcrumb__item::before {
  content: "/";
  margin: 0 var(--kms-space-2);
  color: var(--kms-color-border-strong);
}

.breadcrumb__link {
  color: var(--kms-color-link);
  text-decoration: none;
}
.breadcrumb__link:hover,
.breadcrumb__link:focus {
  color: var(--kms-color-link-hover);
  text-decoration: underline;
}

.breadcrumb__current {
  color: var(--kms-color-text);
  font-weight: 600;
}

/* ---------- Tables (dense) ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--kms-color-surface);
  font-size: var(--kms-font-size-base);
  margin: 0 0 var(--kms-space-4);
}

th, td {
  padding: 6px var(--kms-space-2);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--kms-color-border);
}

th {
  font-weight: 600;
  background: #f3f3f0;
  border-bottom: 2px solid var(--kms-color-border-strong);
  font-size: var(--kms-font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--kms-color-text-muted);
}

tbody tr:hover {
  background: #fafaf2;
}

/* ---------- Forms (compact) ---------- */

.form-item,
.js-form-item {
  margin: 0 0 var(--kms-space-3);
}

label {
  display: inline-block;
  font-weight: 600;
  font-size: var(--kms-font-size-sm);
  margin-bottom: 2px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="password"],
select,
textarea {
  font-family: inherit;
  font-size: var(--kms-font-size-base);
  line-height: 1.3;
  padding: 5px 8px;
  border: 1px solid var(--kms-color-border-strong);
  border-radius: var(--kms-radius);
  background: var(--kms-color-surface);
  color: var(--kms-color-text);
  width: 100%;
  max-width: 480px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--kms-color-secondary);
  outline-offset: 1px;
  border-color: var(--kms-color-secondary);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.description,
.form-item__description {
  font-size: var(--kms-font-size-sm);
  color: var(--kms-color-text-muted);
  margin-top: 2px;
}

/* ---------- Buttons ---------- */

.button,
button,
input[type="submit"],
input[type="button"] {
  display: inline-block;
  font-family: inherit;
  font-size: var(--kms-font-size-base);
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--kms-color-border-strong);
  border-radius: var(--kms-radius);
  background: var(--kms-color-surface);
  color: var(--kms-color-text);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background: #f0f0eb;
  border-color: var(--kms-color-text-muted);
}

.button--primary,
.button.button--primary,
input[type="submit"].button--primary {
  background: var(--kms-color-primary);
  border-color: var(--kms-color-primary-dark);
  color: #fff;
}

.button--primary:hover,
input[type="submit"].button--primary:hover {
  background: var(--kms-color-primary-dark);
  color: #fff;
}

/* Soft text-link style used by the Views header create-link. */
.kms-group-create-link {
  color: var(--kms-color-primary);
  text-decoration: underline;
  font-weight: 500;
}

.kms-group-create-link::before {
  content: "+ ";
}

.kms-group-create-link:hover,
.kms-group-create-link:focus {
  color: var(--kms-color-primary-dark);
}

/* ---------- Status messages ---------- */

.messages,
.messages--status,
.messages--warning,
.messages--error {
  padding: var(--kms-space-2) var(--kms-space-3);
  border-radius: var(--kms-radius);
  margin: 0 0 var(--kms-space-3);
  border-left: 4px solid;
  background: var(--kms-color-surface);
  font-size: var(--kms-font-size-base);
}

.messages--status {
  border-left-color: var(--kms-color-success);
  background: #ecf5ee;
}

.messages--warning {
  border-left-color: var(--kms-color-warning);
  background: #fcf3e6;
}

.messages--error {
  border-left-color: var(--kms-color-error);
  background: #fbeaea;
}

/* ---------- Lists (compact node teasers, etc.) ---------- */

ul, ol {
  margin: 0 0 var(--kms-space-3);
  padding-left: var(--kms-space-5);
}

.kms-content article {
  background: var(--kms-color-surface);
  border: 1px solid var(--kms-color-border);
  border-radius: var(--kms-radius);
  padding: var(--kms-space-4);
  margin-bottom: var(--kms-space-3);
}

.kms-content article h2 a {
  color: var(--kms-color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.kms-content article h2 a:hover,
.kms-content article h2 a:focus {
  color: var(--kms-color-link-hover);
  text-decoration-thickness: 2px;
}

/* Content-type kicker pill (e.g. "CONTACT", "DOCUMENT") rendered at the
   top of every node article so users can tell what type they're viewing. */
.node__type-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--kms-color-primary);
  background: var(--kms-color-surface);
  border: 1px solid var(--kms-color-primary);
  padding: 2px 8px;
  border-radius: var(--kms-radius);
  margin: 0 0 var(--kms-space-3);
}

/* ---------- Fields (node display) ---------- */

.field {
  margin: 0 0 var(--kms-space-3);
}

.field__label {
  font-weight: 700;
  font-size: 11px;
  color: var(--kms-color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 2px;
}

.field__item {
  font-size: var(--kms-font-size-base);
  line-height: 1.5;
}

.field__item a {
  color: var(--kms-color-link);
}

/* Multi-value fields: small spacing between items */
.field__items > .field__item + .field__item {
  margin-top: 2px;
}

/* "Above" label position — stacked, with a subtle row separator */
.field--label-above {
  padding-bottom: var(--kms-space-3);
  border-bottom: 1px solid var(--kms-color-border);
}
.field--label-above:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

/* "Inline" label position — horizontal info-row pattern */
.field--label-inline {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--kms-space-3);
  align-items: baseline;
  padding: 6px 0;
  margin: 0;
  border-bottom: 1px solid var(--kms-color-border);
}
.field--label-inline:last-of-type {
  border-bottom: none;
}
.field--label-inline .field__label {
  display: block;
  margin: 0;
}
.field--label-inline .field__items,
.field--label-inline .field__item {
  display: block;
  font-size: var(--kms-font-size-base);
}

/* Long-form text fields (body, description) get extra room */
.field--type-text-with-summary,
.field--type-text-long,
.field--name-body {
  margin-top: var(--kms-space-4);
  padding-top: var(--kms-space-3);
  border-top: 1px solid var(--kms-color-border);
  border-bottom: none;
}
.field--type-text-with-summary .field__label,
.field--type-text-long .field__label,
.field--name-body .field__label {
  font-size: 11px;
}
.field--type-text-with-summary .field__item p:first-child,
.field--type-text-long .field__item p:first-child,
.field--name-body .field__item p:first-child {
  margin-top: 0;
}

/* Image fields — clean inline render */
.field--type-image .field__item img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--kms-color-border);
  border-radius: var(--kms-radius);
}

/* ---------- Paragraphs (entity reference revisions field) ---------- */
/* Indent paragraph items so they read as nested under the parent
   field label, with a vertical rule for tree-like grouping. */

.field--type-entity-reference-revisions > .field__items {
  padding-left: var(--kms-space-4);
  border-left: 2px solid var(--kms-color-border);
  margin-top: var(--kms-space-2);
}

.field--type-entity-reference-revisions > .field__items > .field__item {
  padding: var(--kms-space-3) 0;
}

.field--type-entity-reference-revisions > .field__items > .field__item:first-child {
  padding-top: var(--kms-space-2);
}

.field--type-entity-reference-revisions > .field__items > .field__item + .field__item {
  border-top: 1px solid var(--kms-color-border-strong);
}

/* The paragraph itself: no extra wrapper styling — its inner fields
   already render via the standard .field--label-inline grid pattern. */
.paragraph {
  margin: 0;
}

/* ---------- Views unformatted-list rows ---------- */

.views-row {
  padding: var(--kms-space-3) 0;
  border-bottom: 1px solid var(--kms-color-border);
}
.views-row:first-child {
  padding-top: 0;
}
.views-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.views-field {
  margin: 0;
}

.views-field-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--kms-space-1);
}
.views-field-title a {
  color: var(--kms-color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.views-field-title a:hover,
.views-field-title a:focus {
  color: var(--kms-color-link-hover);
  text-decoration-thickness: 2px;
}

/* Body / summary fields render as a quiet supporting paragraph under the title */
.views-field-body,
.views-field-field-summary,
.views-field-field-description {
  color: var(--kms-color-text-muted);
  font-size: var(--kms-font-size-base);
  line-height: 1.5;
}
.views-field-body p,
.views-field-field-summary p,
.views-field-field-description p {
  margin: 0 0 var(--kms-space-1);
}
.views-field-body p:last-child,
.views-field-field-summary p:last-child,
.views-field-field-description p:last-child {
  margin-bottom: 0;
}

/* Generic field-content wrapper (Views default) */
.field-content {
  display: block;
}
.views-field-title .field-content {
  display: inline;
}

/* ---------- Dropbutton (admin operations dropdown) ---------- */
/* Drupal core ships positioning + JS for the dropbutton; themes are
   expected to provide visual styling. Without these rules the expanded
   panel is transparent and overlays unreadably onto the content below. */

.dropbutton-wrapper {
  display: inline-block;
}

.dropbutton-wrapper .dropbutton {
  background: var(--kms-color-surface);
  border: 1px solid var(--kms-color-border-strong);
  border-radius: var(--kms-radius);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Closed state: primary action + toggle inline */
.dropbutton-wrapper:not(.open) .dropbutton {
  display: inline-flex;
}

.dropbutton-multiple:not(.open) .dropbutton-action.secondary-action {
  display: none;
}

/* Open state: stacked vertically, sized to content. Cell row grows to fit. */
.dropbutton-wrapper.open .dropbutton {
  display: block;
  width: max-content;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.dropbutton-wrapper.open .dropbutton-action,
.dropbutton-wrapper.open .dropbutton-toggle {
  display: block;
}

.dropbutton-action a,
.dropbutton-toggle button {
  display: block;
  padding: 3px 10px;
  background: transparent;
  border: none;
  color: var(--kms-color-text);
  text-decoration: none;
  font-size: var(--kms-font-size-sm);
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}

.dropbutton-action a:hover,
.dropbutton-action a:focus,
.dropbutton-toggle button:hover,
.dropbutton-toggle button:focus {
  background: #f3f3f0;
  color: var(--kms-color-primary);
}

.dropbutton-toggle button {
  border-left: 1px solid var(--kms-color-border-strong);
}

.dropbutton-multiple .dropbutton-action.secondary-action {
  border-top: 1px solid var(--kms-color-border);
}

.dropbutton-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--kms-color-text);
  vertical-align: middle;
}

/* ---------- Local action links (Add new content, etc.) ---------- */

.action-links {
  list-style: none;
  margin: 0 0 var(--kms-space-3);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--kms-space-2);
}

.action-links li {
  margin: 0;
  padding: 0;
}

/* ---------- Tabs (local task tabs at the top of admin pages) ---------- */

.tabs {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--kms-space-3);
  border-bottom: 1px solid var(--kms-color-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--kms-space-1);
}

.tabs li a {
  display: inline-block;
  padding: 6px var(--kms-space-3);
  text-decoration: none;
  color: var(--kms-color-text-muted);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--kms-radius) var(--kms-radius) 0 0;
  font-size: var(--kms-font-size-sm);
  font-weight: 500;
}

.tabs li a:hover {
  color: var(--kms-color-text);
  background: #f3f3f0;
}

.tabs li.is-active a,
.tabs li a.is-active {
  color: var(--kms-color-primary);
  border-color: var(--kms-color-border);
  background: var(--kms-color-bg);
  position: relative;
  top: 1px;
}
