/* ============================================================
   NINJA* (lafour_theme) — components/ui.css
   Design Kit § 09 — Bootstrap-style component library, Lafour-styled.
   Used wherever Drupal renders generic UI fragments. All values
   resolve to tokens defined in base.css.
   ============================================================ */

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid transparent;
  transition:
    background var(--dur-fast) var(--ease-out),
    color      var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.btn--primary {
  background: var(--c-brand);
  color: var(--c-text);
  border-color: var(--c-brand);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  background: transparent;
  color: var(--c-brand);
}
.btn--ghost {
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-border-2);
}
.btn--ghost:hover,
.btn--ghost:focus-visible { border-color: var(--c-text); }
.btn--link {
  color: var(--c-text);
  padding: 4px 0;
  border-bottom: 1px solid var(--c-text);
}
.btn--link:hover,
.btn--link:focus-visible {
  color: var(--c-brand);
  border-bottom-color: var(--c-brand);
}
.btn--sm { padding: 6px 12px; font-size: 11px; }
.btn--disabled,
.btn[disabled],
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Drupal-rendered submit buttons inherit btn--primary look. */
button.button,
input.button,
.button--primary {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 10px 18px;
  background: var(--c-brand);
  color: var(--c-text);
  border: 1px solid var(--c-brand);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color      var(--dur-fast) var(--ease-out);
}
button.button:hover,
input.button:hover,
.button--primary:hover {
  background: transparent;
  color: var(--c-brand);
}
.button--secondary {
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-border-2);
}
.button--secondary:hover { border-color: var(--c-text); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge--solid   { background: var(--c-text); color: var(--c-bg); }
.badge--outline { border: 1px solid var(--c-border-2); color: var(--c-text); }
.badge--brand   { background: var(--c-brand); color: var(--c-text); }
.badge--muted   { color: var(--c-muted); border: 1px solid var(--c-border); }
.badge__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--c-muted); }
.badge--brand .badge__dot { background: var(--c-text); }

/* Wrappers desde campo condicional / Views (<div class="verde|rojo">) → badge §02 status */
.lafour-main .verde,
.lafour-main .rojo,
article .verde,
article .rojo,
.view .verde,
.view .rojo,
table .verde,
table .rojo {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--c-border-2);
  border-radius: 2px;
  background: var(--c-bg);
  color: var(--c-text);
  box-sizing: border-box;
}
.lafour-main .verde::before,
article .verde::before,
.view .verde::before,
table .verde::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c-status);
}
.lafour-main .rojo::before,
article .rojo::before,
.view .rojo::before,
table .rojo::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c-brand);
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--c-border);
  border-left: 2px solid var(--c-text);
  background: transparent;
}
.alert--brand { border-left-color: var(--c-brand); }
.alert--mute  { border-left-color: var(--c-muted); }
.alert__icon {
  flex: 0 0 auto;
  width: 14px; height: 14px;
  margin-top: 3px;
  color: var(--c-text);
}
.alert--brand .alert__icon { color: var(--c-brand); }
.alert__body  { flex: 1; min-width: 0; }
.alert__title {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: 4px;
}
.alert__text {
  font-size: var(--text-xs);
  color: var(--c-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.alert__close {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-muted);
  line-height: 1;
  align-self: flex-start;
}
.alert__close:hover { color: var(--c-text); }

/* ── Form (generic .field) ──────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: 10px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--c-muted);
}
.field__input,
.field__select,
.field__area {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--c-border-2);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 8px 0;
  letter-spacing: var(--tracking-wide);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
  width: 100%;
}
.field__input:focus,
.field__select:focus,
.field__area:focus {
  border-bottom-color: var(--c-brand);
}
.field__input::placeholder { color: var(--c-dim); }
.field__area { resize: vertical; min-height: 60px; }

.check, .radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-text);
  cursor: pointer;
  user-select: none;
}
.check__box, .radio__box {
  width: 14px; height: 14px;
  border: 1px solid var(--c-border-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-fast) var(--ease-out),
              background   var(--dur-fast) var(--ease-out);
}
.radio__box { border-radius: 50%; }
.check.is-on .check__box,
.radio.is-on .radio__box { border-color: var(--c-brand); }
.check.is-on .check__box::after {
  content: '';
  width: 8px; height: 8px;
  background: var(--c-brand);
}
.radio.is-on .radio__box::after {
  content: '';
  width: 6px; height: 6px;
  background: var(--c-brand);
  border-radius: 50%;
}
.switch {
  width: 32px; height: 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border-2);
  position: relative;
  cursor: pointer;
  transition: background   var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.switch::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 12px; height: 12px;
  background: var(--c-text);
  transition: left var(--dur-fast) var(--ease-out);
}
.switch.is-on { border-color: var(--c-brand); background: var(--c-brand-dim); }
.switch.is-on::after { left: 17px; background: var(--c-brand); }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb,
.region--breadcrumb nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: var(--space-3) 0;
}
.breadcrumb ol,
.region--breadcrumb nav ol {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}
.breadcrumb li,
.region--breadcrumb nav li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb li + li::before,
.region--breadcrumb nav li + li::before {
  content: '/';
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-dim);
}
.breadcrumb a,
.breadcrumb li,
.region--breadcrumb nav a,
.region--breadcrumb nav li,
.breadcrumb__item {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.breadcrumb a:hover,
.region--breadcrumb nav a:hover { color: var(--c-text); }
.breadcrumb__item.is-current,
.breadcrumb li:last-child,
.breadcrumb [aria-current="page"],
.region--breadcrumb nav li:last-child { color: var(--c-text); }
.breadcrumb__sep {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-dim);
}

/* ── Pager ──────────────────────────────────────────────── */
.pager {
  width: 100%;
  justify-content: center;
}
.pager,
.pager__items {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin-block: var(--space-6);
}
.pager__item a,
.pager__btn {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-muted);
  border: 1px solid var(--c-border);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.pager__item a:hover,
.pager__btn:hover {
  color: var(--c-text);
  border-color: var(--c-border-2);
}
.pager__item.is-active a,
.pager__btn.is-active,
.pager__item--current a {
  color: var(--c-text);
  border-color: var(--c-brand);
  background: var(--c-brand-dim);
}
.pager__sep {
  color: var(--c-dim);
  padding: 0 4px;
  font-family: var(--font-mono);
}

/* ── Progress ───────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 2px;
  background: var(--c-border);
  position: relative;
  overflow: hidden;
}
.progress__bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--c-brand);
  transition: width var(--dur-slow) var(--ease-out);
}
.progress__label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-muted);
  letter-spacing: var(--tracking-wide);
  margin-bottom: 6px;
}
.progress__label b { color: var(--c-text); font-weight: var(--weight-regular); }

/* ── Tabs (horizontal) ──────────────────────────────────── */
.tabs__list {
  display: flex;
  gap: var(--space-5);
  border-bottom: 1px solid var(--c-border);
}
.tab {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 0 0 var(--space-3);
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
  background: none;
}
.tab:hover { color: var(--c-text); }
.tab.is-active,
.tab[aria-selected="true"] {
  color: var(--c-text);
  border-bottom-color: var(--c-brand);
}
.tabs__panel {
  padding-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--c-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  line-height: 1.7;
}

/* ── Accordion ──────────────────────────────────────────── */
.acc { display: flex; flex-direction: column; }
.acc__row { border-top: 1px solid var(--c-border); }
.acc__row:last-child { border-bottom: 1px solid var(--c-border); }
.acc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-text);
  width: 100%;
  cursor: pointer;
}
.acc__plus {
  width: 12px; height: 12px;
  position: relative;
  color: var(--c-brand);
}
.acc__plus::before, .acc__plus::after {
  content: '';
  position: absolute;
  background: currentColor;
}
.acc__plus::before {
  top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%);
}
.acc__plus::after {
  left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.acc__row.is-open .acc__plus::after { transform: translateX(-50%) scaleY(0); }
.acc__body {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--dur-base) var(--ease-out);
}
.acc__row.is-open .acc__body { max-height: 480px; }
.acc__body-inner {
  padding: 0 0 var(--space-4);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-muted);
  line-height: 1.7;
}

/* ── Tooltip ────────────────────────────────────────────── */
.tip-wrap { position: relative; display: inline-block; }
.tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-text);
  color: var(--c-bg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 4px 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.tip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--c-text);
}
.tip-wrap:hover .tip,
.tip-wrap:focus-within .tip { opacity: 1; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border-2);
  padding: var(--space-3) var(--space-4);
  min-width: 280px;
}
.toast__bar {
  width: 2px;
  align-self: stretch;
  background: var(--c-brand);
}
.toast__body { flex: 1; }
.toast__title {
  font-size: 11px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--c-text);
}
.toast__text {
  font-size: 10px;
  color: var(--c-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.toast__time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--c-dim);
}

/* ── Spinner (inline, used inside buttons) ─────────────── */
.spin {
  width: 18px; height: 18px;
  border: 1px solid var(--c-border-2);
  border-top-color: var(--c-brand);
  border-radius: 50%;
  animation: lafour-spin 800ms linear infinite;
  display: inline-block;
}
@keyframes lafour-spin { to { transform: rotate(360deg); } }

/* ── List group ─────────────────────────────────────────── */
.lg {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-border);
}
.lg__row {
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  transition: background var(--dur-fast) var(--ease-out);
  cursor: pointer;
}
.lg__row:last-child { border-bottom: 0; }
.lg__row:hover { background: var(--c-surface); }
.lg__row.is-active {
  background: var(--c-brand-dim);
  border-left: 2px solid var(--c-brand);
  padding-left: calc(var(--space-4) - 2px);
}
.lg__row-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-muted);
}

/* ── Modal card ─────────────────────────────────────────── */
.modal-card {
  max-width: 380px;
  margin: 0 auto;
  background: var(--c-bg);
  border: 1px solid var(--c-border-2);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal-card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--c-border);
}
.modal-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  line-height: 1;
}
.modal-card__close {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-muted);
}
.modal-card__close:hover { color: var(--c-brand); }
.modal-card__body {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--c-muted);
  line-height: 1.7;
}
.modal-card__foot {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  padding-top: var(--space-3);
}

/* ── Type helpers (used by node + view templates) ───────── */
.t-display-xl {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  letter-spacing: var(--tracking-display);
  line-height: 0.9;
  text-transform: uppercase;
}
.t-display-l {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  letter-spacing: var(--tracking-display);
  line-height: 0.95;
  text-transform: uppercase;
}
.t-display-m {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-display);
  line-height: 1;
  text-transform: uppercase;
}
.t-label {
  font-family: var(--font-body);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.t-meta {
  font-family: var(--font-body);
  font-weight: var(--weight-light);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-muted);
}
.t-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-muted);
  letter-spacing: var(--tracking-wide);
}
h1.t-mono,
h2.t-mono,
h3.t-mono,
h4.t-mono,
h5.t-mono,
h6.t-mono {
  font-family: var(--font-display);
}

/* ── HR mono separator (used in admin / footer chrome) ─── */
.hr-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-dim);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin: var(--space-8) 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.hr-mono::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}
