/* =====================================================================
   layout.css - Estrutura do app: login, header, nav, main
   ===================================================================== */

/* ============================================
   LOGIN — Novo design Claude Design
   ============================================ */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--color-bg);
}
@media (max-width: 920px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-side { display: none; }
}

/* Lado esquerdo — marca */
.login-side {
  position: relative;
  background: var(--color-black);
  color: var(--color-gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 56px;
  overflow: hidden;
}
[data-theme="dark"] .login-side { background: #060604; }

.login-side-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 30% 40%, var(--color-gold-bg) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(184,148,90,0.10) 0%, transparent 60%);
  pointer-events: none;
}
.login-side::after {
  content: '';
  position: absolute;
  inset: 32px;
  border: 1px solid rgba(217,192,138,0.18);
  border-radius: 18px;
  pointer-events: none;
}
.login-side-content {
  position: relative;
  z-index: 1;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  animation: fade-up 700ms var(--ease-out, cubic-bezier(0.16,1,0.3,1)) both;
}
.login-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--color-gold-light);
}
.login-mark-name {
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.login-mark-tag {
  font-size: 10px;
  letter-spacing: 0.36em;
  color: var(--color-gold);
  margin-top: 5px;
}
.brand-serif {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.brand-serif em { font-style: italic; font-weight: 400; }

.login-quote .login-line {
  width: 60px;
  height: 1px;
  background: var(--color-gold);
  margin-bottom: 22px;
  transform-origin: left;
  animation: line-grow 700ms var(--ease-out, ease) 240ms both;
  box-shadow: 0 0 8px var(--gold-glow, rgba(184,148,90,0.18));
}
.login-quote h2 {
  font-size: 38px;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  font-weight: 400;
  color: #f4f1ea;
}
.login-quote h2 em { font-weight: 400; color: var(--color-gold-light); }
.login-quote p {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(244,241,234,0.72);
  margin: 0;
  max-width: 380px;
}
.login-features { display: flex; flex-direction: column; gap: 14px; }
.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(244,241,234,0.85);
}
.login-feature svg { color: var(--color-gold); flex-shrink: 0; }
.login-side-foot {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(244,241,234,0.4);
  border-top: 1px solid rgba(217,192,138,0.18);
  padding-top: 20px;
}

/* Lado direito — formulário */
.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 40px;
  background: var(--color-bg);
}
.login-form-wrap {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  animation: fade-up 600ms var(--ease-out, ease) 150ms both;
}
.login-eyebrow {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--color-gold-dark);
  margin-bottom: 14px;
}
[data-theme="dark"] .login-eyebrow { color: var(--color-gold-light); }
.login-form-head h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  line-height: 1.15;
}
.login-form-head h1 em { color: var(--color-gold-dark); font-style: italic; }
[data-theme="dark"] .login-form-head h1 em { color: var(--color-gold-light); }
.login-welcome-name { color: var(--color-gold-light); }
.login-form-head p { color: var(--color-text-muted); font-size: 14px; margin: 0; }

.login-form-new { display: flex; flex-direction: column; gap: 16px; }

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.input-with-icon { position: relative; }
.input-with-icon > svg {
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.input-new {
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13.5px;
  font-family: var(--font-sans);
  transition: all 180ms ease;
  outline: none;
  width: 100%;
}
.input-new:hover { border-color: var(--color-text-muted); }
.input-new:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px var(--gold-glow, rgba(184,148,90,0.18));
}
.input-new::placeholder { color: var(--color-text-muted); }

.password-input-new { padding-right: 36px; }

.toggle-pwd {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
}
.toggle-pwd:hover { color: var(--color-text); }

.login-row {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--color-text-muted);
}
.login-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.login-check input { accent-color: var(--color-gold); }

.btn-login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid var(--color-black);
  background: var(--color-black);
  color: var(--color-gold-light);
  cursor: pointer;
  transition: all 180ms ease;
  width: 100%;
  margin-top: 6px;
}
.btn-login-submit:hover {
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 4px 12px var(--gold-glow, rgba(184,148,90,0.18));
}
.btn-login-submit:active { transform: translateY(0.5px); }
.btn-login-submit:disabled { opacity: 0.7; cursor: not-allowed; }
[data-theme="dark"] .btn-login-submit {
  background: var(--color-gold);
  color: #0a0a0a;
  border-color: var(--color-gold);
}
[data-theme="dark"] .btn-login-submit:hover { background: var(--color-gold-light); }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--color-text-muted);
  margin: 4px 0;
}
.divider-line { flex: 1; height: 1px; background: var(--color-border); }
.divider-text { white-space: nowrap; }

.login-help {
  font-size: 12.5px;
  color: var(--color-text-muted);
  text-align: center;
}
.login-help a {
  color: var(--color-gold-dark);
  font-weight: 500;
  border-bottom: 1px solid currentColor;
}
[data-theme="dark"] .login-help a { color: var(--color-gold-light); }

.login-foot {
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ----------------- SHELL DO APP ----------------- */
.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-black);
  color: #fff;
  border-bottom: 1px solid var(--color-gold-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-brand {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  flex: 1;
}
.app-brand span {
  color: var(--color-gold-light);
  font-style: italic;
  margin-left: 6px;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.global-search {
  position: relative;
  flex: 1;
  max-width: 380px;
  min-width: 180px;
}
.global-search-input {
  width: 100%;
  background: var(--color-surface-2, #1c1c1f);
  border: 1px solid var(--color-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 6px);
  color: var(--color-text, #f4f4f5);
  padding: 7px 14px;
  font-size: 0.84rem;
  font-family: var(--font-sans);
  transition: border-color 200ms;
  outline: none;
}
.global-search-input:focus {
  border-color: var(--color-gold, #c9a84c);
}
.global-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--color-surface, #18181b);
  border: 1px solid var(--color-border-strong, rgba(255,255,255,0.12));
  border-radius: var(--radius-md, 6px);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  max-height: 360px;
  overflow-y: auto;
}
.global-search-section {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}
.global-search-section:last-child { border-bottom: none; }
.global-search-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 6px 14px 4px;
}
.global-search-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 150ms;
}
.global-search-item:hover {
  background: var(--color-surface-2);
}
.global-search-item-title {
  font-size: 0.85rem;
  color: var(--color-text);
}
.global-search-item-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.global-search-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.84rem;
}
.app-session {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.session-timer {
  font-size: 0.85rem;
  color: var(--color-gold-light);
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border: 1px solid rgba(217,192,138,0.3);
  border-radius: 999px;
}
.session-timer.is-warning { color: var(--color-warning-bg); border-color: var(--color-warning); }
.app-session .btn-ghost { color: var(--color-gold-light); }
.app-session .btn-ghost:hover { background: rgba(255,255,255,0.08); color: #fff; }

@media (max-width: 719px) {
  .app-header {
    flex-wrap: wrap;
  }
  .global-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
}

/* Menu hamburguer (mobile) */
.menu-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-gold-light);
  transition: all var(--transition);
}

/* Nav (mobile: drawer / desktop: lateral fixa) */
.app-nav {
  background: var(--color-black-soft, #1a1a1a);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

[data-theme="dark"] .app-nav {
  background: #111214;
  border-right-color: rgba(255,255,255,0.05);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 20px;
}

.nav-section-title {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 10px;
  margin-bottom: 4px;
  opacity: 0.5;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
  position: relative;
  border-left: none;
}

.app-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-text);
}

.app-nav a.is-active {
  background: var(--color-gold-bg);
  color: var(--color-gold-dark);
  font-weight: 500;
}

[data-theme="dark"] .app-nav a.is-active {
  background: rgba(201,168,76,0.12);
  color: var(--color-gold-light);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 150ms ease;
}

.app-nav a:hover .nav-icon,
.app-nav a.is-active .nav-icon {
  opacity: 1;
}

.app-nav a.is-active .nav-icon svg {
  stroke: var(--color-gold-dark);
}

[data-theme="dark"] .app-nav a.is-active .nav-icon svg {
  stroke: var(--color-gold-light);
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  flex-shrink: 0;
}

.app-nav a.is-active .nav-count {
  background: var(--color-gold-bg);
  color: var(--color-gold-dark);
}

/* Mobile: nav como drawer */
@media (max-width: 979px) {
  .app-nav {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: none;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 12px 8px;
    overflow-y: auto;
  }
  .app-nav.is-open {
    display: flex;
  }
}

/* Desktop: sidebar fixa */
@media (min-width: 980px) {
  .app-nav {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
    width: 220px;
  }
}

/* Main */
.app-main {
  padding: var(--space-5);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.page-header h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  margin: 0;
}
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Card genérico */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}
.empty-state h3 { color: var(--color-text); font-weight: 500; }

[data-theme="dark"] .app-header {
  background: rgba(14,15,17,0.92);
  border-bottom-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .card,
[data-theme="dark"] .table-wrapper,
[data-theme="dark"] .kpi-card {
  background: #161719;
  border-color: rgba(255,255,255,0.07);
}

[data-theme="dark"] .table th {
  background: #1e2023;
  color: #5a5754;
}

[data-theme="dark"] .table tbody tr:hover {
  background: #1e2023;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1e2023;
  border-color: rgba(255,255,255,0.10);
  color: #f0ede8;
}

[data-theme="dark"] .modal {
  background: #161719;
  border-color: rgba(255,255,255,0.10);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: rgba(255,255,255,0.07);
}

[data-theme="dark"] .global-loader {
  background: rgba(14,15,17,0.80);
}

[data-theme="dark"] body {
  background: var(--color-bg);
  color: var(--color-text);
}

[data-theme="dark"] .app-shell {
  background: var(--color-bg);
}

[data-theme="dark"] .app-main {
  background: var(--color-bg);
  color: var(--color-text);
}

[data-theme="dark"] .page-header h1 {
  color: var(--color-text);
}

[data-theme="dark"] .section-title {
  color: var(--color-text);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .empty-state {
  color: var(--color-text-muted);
}

[data-theme="dark"] .empty-state h3 {
  color: var(--color-text);
}

[data-theme="dark"] .filters-bar {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] label.field > span,
[data-theme="dark"] .field-label {
  color: var(--color-text-muted);
}

[data-theme="dark"] .badge {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

[data-theme="dark"] .page-header {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .form-actions {
  border-top-color: var(--color-border);
}

[data-theme="dark"] .btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

[data-theme="dark"] .btn-ghost {
  color: var(--color-text-muted);
}

[data-theme="dark"] .btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

[data-theme="dark"] .kpi-card {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .kpi-label {
  color: var(--color-text-muted);
}

[data-theme="dark"] .kpi-value {
  color: var(--color-text);
}

[data-theme="dark"] .dashboard-grid .kpi-card--alert {
  background: var(--color-danger-bg);
}

[data-theme="dark"] .dashboard-grid .kpi-card--warn {
  background: var(--color-warning-bg);
}
