/* ============================================================================
   ConVencer — Design System "Autoridade Dourada"
   Dark premium + acento dourado. Syne (display) + DM Sans (UI).
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:          #080808;
  --bg-card:     #0f0f0f;
  --bg-input:    #141414;
  --border:      #1e1e1e;
  --border-mid:  #2a2a2a;
  --gold:        #C9952A;
  --gold-light:  #E0AA3E;
  --gold-dim:    #8a6420;
  --text:        #F0EDE8;
  --text-mid:    #A09890;
  --text-dim:    #5a5450;
  --success:     #4a9e6e;
  --danger:      #b84444;
  --warn:        #c4883a;

  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --nav-h: 64px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand { font-family: var(--font-display); line-height: 1.15; margin: 0; }
h1 { font-size: 56px; font-weight: 800; }
h2 { font-size: 32px; font-weight: 700; }
h3 { font-size: 20px; font-weight: 600; }

p { margin: 0 0 1em; }

a { color: var(--gold); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

/* ---------------------------------------------------------------------------
   Layout helpers
   --------------------------------------------------------------------------- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 420px; margin: 0 auto; padding: 0 24px; }
.page { padding-top: calc(var(--nav-h) + 16px); }
.section { padding: 88px 0; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.hidden { display: none !important; }
.center { text-align: center; }

/* ---------------------------------------------------------------------------
   Typography utilities
   --------------------------------------------------------------------------- */
.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 14px;
}
.label {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.muted { color: var(--text-mid); }
.lead { font-size: 18px; color: var(--text-mid); }

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn-primary, .btn-secondary, .btn-ghost,
button, .btn {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1;
}

.btn-primary, .btn {
  background: var(--gold);
  color: #080808;
  border-color: var(--gold);
}
.btn-primary:hover, .btn:hover { background: var(--gold-light); border-color: var(--gold-light); color: #080808; }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}
.btn-secondary:hover { background: rgba(201,149,42,0.1); color: var(--gold-light); }

.btn-ghost, .btn--ghost {
  background: transparent;
  color: var(--text-mid);
  border-color: transparent;
}
.btn-ghost:hover, .btn--ghost:hover { color: var(--gold); }

.btn-danger, .btn--danger {
  background: var(--danger);
  color: var(--text);
  border-color: var(--danger);
}
.btn-danger:hover, .btn--danger:hover { background: #a03a3a; }

button:disabled { opacity: .45; cursor: not-allowed; }

.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card--gold { border-color: var(--gold); }
.card--accent-left { border-left: 3px solid var(--gold); }

/* ---------------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; margin-bottom: 16px; }

.input, input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 13px;
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,149,42,0.12);
}
textarea { resize: vertical; min-height: 90px; }

/* ---------------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--bg-input);
  color: var(--text-mid);
  border: 1px solid var(--border-mid);
}
.badge--gold { background: rgba(201,149,42,0.12); color: var(--gold); border-color: rgba(201,149,42,0.35); }
.badge--success, .badge--ok { background: rgba(74,158,110,0.14); color: var(--success); border-color: rgba(74,158,110,0.35); }
.badge--danger, .badge--blocked { background: rgba(184,68,68,0.14); color: var(--danger); border-color: rgba(184,68,68,0.35); }
.badge--warn, .badge--pending { background: rgba(196,136,58,0.14); color: var(--warn); border-color: rgba(196,136,58,0.35); }

/* ---------------------------------------------------------------------------
   Messages
   --------------------------------------------------------------------------- */
.msg { padding: 11px 14px; border-radius: var(--radius-sm); margin: 10px 0; font-size: 14px; }
.msg--error { background: rgba(184,68,68,0.12); color: #e08585; border: 1px solid rgba(184,68,68,0.35); }
.msg--success { background: rgba(74,158,110,0.12); color: #7ec79e; border: 1px solid rgba(74,158,110,0.35); }
.msg--info { background: rgba(201,149,42,0.1); color: var(--gold); border: 1px solid rgba(201,149,42,0.3); }

/* ---------------------------------------------------------------------------
   Navbar (landing)
   --------------------------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(8,8,8,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background .2s ease, backdrop-filter .2s ease;
}
.navbar.scrolled { background: rgba(8,8,8,0.96); backdrop-filter: blur(14px); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.navbar .brand { font-size: 22px; font-weight: 800; color: var(--text); }
.nav-menu { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--text-mid); font-size: 15px; font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 12px; align-items: center; }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 24px; padding: 4px; cursor: pointer; }

/* ---------------------------------------------------------------------------
   Sidebar (dashboards)
   --------------------------------------------------------------------------- */
.dashboard-layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  z-index: 50;
}
.sidebar .brand { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text); padding: 0 24px 20px; }
.sidebar-user { padding: 0 24px 20px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sidebar-user .name { font-weight: 600; color: var(--text); }
.sidebar-user .org { font-size: 13px; color: var(--text-mid); }
.sidebar-menu { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.sidebar-menu a, .sidebar-menu button {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-size: 15px; font-weight: 500;
  background: none; border: none; width: 100%; text-align: left; cursor: pointer;
  font-family: var(--font-body);
}
.sidebar-menu a:hover, .sidebar-menu button:hover { background: var(--bg-input); color: var(--text); }
.sidebar-menu a.active, .sidebar-menu button.active { background: rgba(201,149,42,0.12); color: var(--gold); }
.sidebar-menu a.disabled, .sidebar-menu button.disabled { color: var(--text-dim); opacity: 0.5; cursor: not-allowed; }
.sidebar-menu a.disabled:hover, .sidebar-menu button.disabled:hover { background: none; color: var(--text-dim); }
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: #F5C518; color: #080808;
  font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-footer { padding: 12px 12px 0; }
.main-area { margin-left: var(--sidebar-w); flex: 1; padding: 32px 40px; max-width: 100%; }
.main-header { margin-bottom: 28px; }
.main-header h1 { font-size: 30px; }
.main-header .date { color: var(--text-mid); font-size: 14px; margin-top: 4px; }

/* ---------------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:hover { background: var(--bg-input); }

/* ---------------------------------------------------------------------------
   Grid utilities
   --------------------------------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }

/* ---------------------------------------------------------------------------
   Metric tiles
   --------------------------------------------------------------------------- */
.metric { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.metric .value { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--text); }
.metric .metric-label { color: var(--text-mid); font-size: 13px; margin-top: 2px; }

/* ---------------------------------------------------------------------------
   Animations
   --------------------------------------------------------------------------- */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

.hero-stagger > * { opacity: 0; animation: fadeSlideUp .7s ease forwards; }
.hero-stagger > *:nth-child(1) { animation-delay: .05s; }
.hero-stagger > *:nth-child(2) { animation-delay: .15s; }
.hero-stagger > *:nth-child(3) { animation-delay: .25s; }
.hero-stagger > *:nth-child(4) { animation-delay: .35s; }
.hero-stagger > *:nth-child(5) { animation-delay: .45s; }

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

/* Prevenir scroll horizontal acidental no body em qualquer viewport */
html, body { max-width: 100vw; overflow-x: hidden; }

@media (max-width: 768px) {
  /* Tipografia escalada */
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  h3 { font-size: 18px; }
  .section { padding: 56px 0; }

  /* Grids: tudo vira coluna única */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Navbar (landing) — esconde tudo, mostra só o hamburger */
  .nav-toggle { display: block; }
  .nav-menu {
    display: none;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    padding: 14px 20px 18px; gap: 12px;
  }
  .nav-menu.open { display: flex; }
  .nav-links { flex-direction: column; gap: 4px; align-items: stretch; }
  .nav-links a { padding: 10px 4px; font-size: 16px; }
  .nav-actions { flex-direction: column; gap: 10px; align-items: stretch;
    padding-top: 10px; border-top: 1px solid var(--border); }
  .nav-actions a { justify-content: center; }

  /* Sidebar: vira drawer deslizante a partir da esquerda */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  /* Conteúdo principal: sem reserva para sidebar fixa */
  .main-area { margin-left: 0; padding: 20px 16px; padding-top: calc(var(--nav-h) + 16px); }
  .main-header h1 { font-size: 24px; }

  /* Mobile-bar (hamburger) ativa */
  .mobile-bar { display: flex !important; }

  /* Inputs: 16px previne zoom automático do iOS Safari */
  .input, input, select, textarea { font-size: 16px; }

  /* Cards mais compactos */
  .card { padding: 18px; }

  /* Tabelas: scroll horizontal dentro do card pai */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 10px 12px; }

  /* Botões maiores pra touch (mínimo confortável) */
  button, .btn, .btn-primary, .btn-secondary, .btn-ghost { min-height: 40px; }
  .icon-btn, .lead-icon-btn { min-height: 36px; }

  /* Forms mais respiráveis */
  .field { margin-bottom: 14px; }
}

/* Backdrop visual quando o sidebar mobile está aberto (modern browsers via :has) */
@media (max-width: 768px) {
  body:has(.sidebar.open)::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 49;
    animation: backdrop-in .2s ease;
  }
  @keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
}

@media (max-width: 375px) {
  h1 { font-size: 28px; }
  h2 { font-size: 21px; }
  .container, .container--narrow { padding: 0 14px; }
  .main-area { padding: 16px 12px; padding-top: calc(var(--nav-h) + 12px); }
  .card { padding: 16px; }
  .section { padding: 44px 0; }
}

/* mobile top bar for dashboards (hamburger) */
.mobile-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  align-items: center; gap: 12px; padding: 0 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border); z-index: 60;
}
.mobile-bar .brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.mobile-bar button { background: none; border: none; color: var(--text); font-size: 22px; }

::selection { background: var(--gold); color: #080808; }

/* Cursor piscante durante streaming de texto da IA */
.streaming-cursor::after {
  content: '▋';
  margin-left: 1px;
  color: var(--gold);
  animation: cursor-blink 0.7s infinite;
}
@keyframes cursor-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
