/* ============================================================================
   components.css — Componentes base do Ello (estilo Anthropic Claude)
   Depende de tokens.css. Prefixo .ell- pra isolar do sistema antigo.
   ============================================================================ */

/* ── Reset leve ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.ell-root {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ell-root *::selection { background: var(--accent-soft); color: var(--text); }

/* ── Tipografia ─────────────────────────────────────────────────────────── */
.ell-h1, .ell-h2, .ell-h3, .ell-h4, .ell-display {
  font-family: var(--font-serif);
  color: var(--text);
  margin: 0;
  font-variation-settings: 'opsz' 48, 'SOFT' 50, 'WONK' 1;
}
.ell-h1 {
  font-size: var(--text-5xl);
  font-weight: 450;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.ell-h2 {
  font-size: var(--text-3xl);
  font-weight: 450;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.ell-h3 {
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 24, 'SOFT' 50, 'WONK' 0;
}
.ell-h4 {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.3;
  font-variation-settings: 'opsz' 18, 'SOFT' 30, 'WONK' 0;
}

.ell-display {
  font-size: var(--text-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-variation-settings: 'opsz' 144, 'SOFT' 70, 'WONK' 1;
}

.ell-p { font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--text-2); margin: 0; }
.ell-p--sm { font-size: var(--text-sm); }
.ell-p--lg { font-size: var(--text-lg); }
.ell-lead { font-size: var(--text-lg); color: var(--text-2); line-height: var(--leading-normal); }
.ell-muted { color: var(--text-3); }
.ell-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-3);
  font-weight: var(--weight-semibold);
}
.ell-mono { font-family: var(--font-mono); font-size: 0.92em; }
.ell-code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  color: var(--text-2);
}

/* ── Botões ─────────────────────────────────────────────────────────────── */
.ell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0;
}
.ell-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.ell-btn:active { transform: translateY(0.5px); }

/* Primário — navy */
.ell-btn--primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}
.ell-btn--primary:hover { background: var(--brand-soft); border-color: var(--brand-soft); }

/* Acento — gold dessaturado, pra ações principais quentes */
.ell-btn--accent {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
.ell-btn--accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Secundário — outline */
.ell-btn--secondary {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--line);
}
.ell-btn--secondary:hover { border-color: var(--line-strong); background: var(--bg-sunken); }

/* Ghost — sem border */
.ell-btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.ell-btn--ghost:hover { background: var(--bg-sunken); color: var(--text); }

/* Destrutivo */
.ell-btn--danger {
  background: var(--bg-elev);
  color: var(--err);
  border-color: var(--line);
}
.ell-btn--danger:hover { background: var(--err-soft); border-color: var(--err); }

/* Tamanhos */
.ell-btn--sm { padding: 6px 12px; font-size: var(--text-sm); }
.ell-btn--lg { padding: 14px 24px; font-size: var(--text-md); }
.ell-btn--icon { padding: 8px; width: 36px; height: 36px; }
.ell-btn--icon.ell-btn--sm { width: 28px; height: 28px; padding: 4px; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.ell-input, .ell-textarea, .ell-select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  line-height: 1.4;
}
.ell-input:hover, .ell-textarea:hover, .ell-select:hover { border-color: var(--line-strong); }
.ell-input:focus, .ell-textarea:focus, .ell-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
  background: var(--bg-elev);
}
.ell-input::placeholder, .ell-textarea::placeholder { color: var(--text-4); }
.ell-textarea { resize: vertical; min-height: 80px; line-height: var(--leading-normal); }

.ell-field { display: flex; flex-direction: column; gap: var(--space-2); }
.ell-field__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-2); }
.ell-field__hint { font-size: var(--text-xs); color: var(--text-3); line-height: var(--leading-normal); }
.ell-field__error { font-size: var(--text-xs); color: var(--err); }

/* Checkbox estilizado */
.ell-check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); }
.ell-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* Switch */
.ell-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.ell-switch input { opacity: 0; width: 0; height: 0; }
.ell-switch__track {
  position: absolute; inset: 0;
  background: var(--line-strong);
  border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease);
}
.ell-switch__track::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 3px; top: 3px;
  background: var(--bg-elev); border-radius: 50%;
  transition: transform var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
}
.ell-switch input:checked + .ell-switch__track { background: var(--accent); }
.ell-switch input:checked + .ell-switch__track::before { transform: translateX(16px); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.ell-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
  position: relative;
}
.ell-card--hover:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ell-card--flat { background: transparent; border: none; padding: 0; }
.ell-card--sunken { background: var(--bg-sunken); border: none; }

/* Card com assinatura Ello — fio gold 2px no topo */
.ell-card--hero, .ell-card--signature {
  position: relative;
  overflow: hidden;
}
.ell-card--hero::before, .ell-card--signature::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--signature);
}

/* Card escuro (inverso) — navy com texto cream */
.ell-card--dark {
  background: var(--bg-dark);
  color: var(--text-on-dark, #f5ebc9);
  border: 1px solid var(--bg-dark);
}
.ell-card--dark .ell-h1, .ell-card--dark .ell-h2, .ell-card--dark .ell-h3,
.ell-card--dark .ell-display { color: var(--text-on-dark, #f5ebc9); }
.ell-card--dark .ell-p, .ell-card--dark .ell-lead { color: rgba(245, 235, 201, 0.75); }
.ell-card--dark .ell-label { color: var(--accent); }

.ell-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-4); }
.ell-card__title { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 500; margin: 0; font-variation-settings: 'opsz' 24, 'SOFT' 50, 'WONK' 0; }
.ell-card__subtitle { font-size: var(--text-sm); color: var(--text-3); margin-top: 4px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.ell-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--bg-sunken);
  color: var(--text-2);
  border: 1px solid var(--line-subtle);
}
.ell-badge--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ell-badge--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ell-badge--err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.ell-badge--info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.ell-badge--accent { background: var(--accent-soft); color: var(--accent-hover); border-color: transparent; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.ell-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.ell-tabs__btn {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: var(--text-sm);
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  white-space: nowrap;
  margin-bottom: -1px;
  font-weight: var(--weight-medium);
}
.ell-tabs__btn:hover { color: var(--text); }
.ell-tabs__btn[aria-selected="true"], .ell-tabs__btn.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── Tabela ─────────────────────────────────────────────────────────────── */
.ell-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.ell-table thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-3);
  font-weight: var(--weight-semibold);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line);
}
.ell-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-subtle);
  color: var(--text);
}
.ell-table tbody tr:last-child td { border-bottom: none; }
.ell-table tbody tr:hover { background: var(--bg-sunken); }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.ell-sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: var(--space-6) var(--space-3);
  height: 100vh;
  overflow-y: auto;
}
.ell-sidebar__brand {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 0 var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--line-subtle);
  margin-bottom: var(--space-4);
  color: var(--text);
  font-variation-settings: 'opsz' 32, 'SOFT' 70, 'WONK' 1;
  position: relative;
}
.ell-sidebar__brand::after {
  content: '';
  position: absolute;
  bottom: calc(var(--space-6) + 4px);
  left: var(--space-3);
  width: 20px;
  height: 2px;
  background: var(--accent);
}
.ell-sidebar__group {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-4);
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-weight: var(--weight-semibold);
}
.ell-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  text-decoration: none;
  line-height: 1.4;
}
.ell-sidebar__item:hover { background: var(--bg-sunken); color: var(--text); }
.ell-sidebar__item.is-active { background: var(--bg-sunken); color: var(--text); font-weight: var(--weight-medium); }
.ell-sidebar__item.is-active::before {
  content: ''; width: 3px; height: 16px; background: var(--accent); border-radius: 2px; margin-right: calc(var(--space-3) - 3px); margin-left: calc(-1 * var(--space-3));
}
.ell-sidebar__icon { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.ell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.ell-header__title { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: var(--weight-medium); }
.ell-header__actions { display: flex; gap: var(--space-2); align-items: center; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.ell-modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.ell-modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
}
.ell-modal__head { padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--line-subtle); display: flex; justify-content: space-between; align-items: center; }
.ell-modal__title { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: var(--weight-medium); margin: 0; }
.ell-modal__body { padding: var(--space-6); }
.ell-modal__foot { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--line-subtle); display: flex; justify-content: flex-end; gap: var(--space-2); background: var(--bg-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ── Empty state ───────────────────────────────────────────────────────── */
.ell-empty {
  padding: var(--space-20) var(--space-6);
  text-align: center;
  max-width: 480px; margin: 0 auto;
  position: relative;
}
/* Padrão geométrico sutil de fundo nos empty states */
.ell-empty::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, var(--accent-soft) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, var(--accent-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}
.ell-empty > * { position: relative; z-index: 1; }
.ell-empty__mark {
  width: 48px; height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-5);
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--accent);
  font-weight: 400;
  font-variation-settings: 'opsz' 24, 'SOFT' 100, 'WONK' 1;
}
.ell-empty__title { font-family: var(--font-serif); font-size: var(--text-2xl); margin: 0 0 var(--space-2); font-weight: 450; letter-spacing: -0.01em; font-variation-settings: 'opsz' 28, 'SOFT' 50, 'WONK' 1; }
.ell-empty__desc { color: var(--text-3); font-size: var(--text-md); line-height: var(--leading-relaxed); margin: 0 0 var(--space-6); }

/* ── Alert / callout ───────────────────────────────────────────────────── */
.ell-alert {
  display: flex; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--info-soft);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  color: var(--text);
  align-items: flex-start;
}
.ell-alert__icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.ell-alert--ok { background: var(--ok-soft); color: var(--ok); }
.ell-alert--warn { background: var(--warn-soft); color: var(--warn); }
.ell-alert--err { background: var(--err-soft); color: var(--err); }

/* ── Divider ────────────────────────────────────────────────────────────── */
.ell-divider { height: 1px; background: var(--line-subtle); margin: var(--space-6) 0; border: none; }
.ell-divider--thick { height: 1px; background: var(--line); }

/* ── Layout helpers ────────────────────────────────────────────────────── */
.ell-stack { display: flex; flex-direction: column; }
.ell-stack--sm { gap: var(--space-2); }
.ell-stack--md { gap: var(--space-4); }
.ell-stack--lg { gap: var(--space-6); }
.ell-row { display: flex; }
.ell-row--gap { gap: var(--space-3); }
.ell-row--center { align-items: center; }
.ell-row--between { justify-content: space-between; }
.ell-grid { display: grid; gap: var(--space-4); }
.ell-grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ell-grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ── Theme switcher UI ──────────────────────────────────────────────────── */
.ell-theme-switch {
  display: inline-flex; gap: 2px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 3px;
  flex-wrap: wrap;
}
.ell-theme-switch__btn {
  background: transparent; border: 0; padding: 6px 12px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); color: var(--text-3); cursor: pointer;
  font-family: inherit; transition: all var(--dur) var(--ease);
  display: inline-flex; align-items: center; gap: 4px;
}
.ell-theme-switch__btn:hover { color: var(--text); }
.ell-theme-switch__btn.is-active {
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ell-theme-dropdown { position: relative; display: inline-block; }
.ell-theme-dropdown__icon { font-size: 14px; margin-right: 2px; }
.ell-theme-dropdown__label { font-size: var(--text-xs); }
.ell-theme-dropdown__menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 4px;
  min-width: 180px; z-index: 50;
}
.ell-theme-dropdown__item {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: var(--space-2);
  background: transparent; border: 0; padding: 8px 10px;
  border-radius: var(--radius); cursor: pointer;
  font-size: var(--text-sm); color: var(--text-2);
  font-family: inherit; transition: background var(--dur-fast) var(--ease);
}
.ell-theme-dropdown__item:hover { background: var(--bg-sunken); color: var(--text); }
.ell-theme-dropdown__item.is-active { color: var(--accent); font-weight: 500; }

.ell-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.ell-main { overflow-x: hidden; background: var(--bg); }
.ell-page {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-10) var(--space-8);
}
.ell-section { margin-bottom: var(--space-20); }
.ell-section__label {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: var(--tracking-widest); color: var(--text-3);
  font-weight: 600; margin-bottom: var(--space-3);
}
.ell-section__label::before {
  content: ''; width: 20px; height: 1px; background: var(--accent);
}
