/* ==========================================================================
   GovIAgent São Sebastião — design system
   Vibe: vibrante e suave · grade de 4px · cantos suaves · elevação suave
   Fonte: Source Sans (sucessora do Source Sans Pro)
   ========================================================================== */

:root {
    /* Cor */
    --primary: #2196F3;
    --accent: #1A78C2;          /* AA com texto branco (4,9:1) */
    --surface: #F2F2F2;
    --elevated: #F5F5F5;
    --card: #FFFFFF;
    --text: #333333;
    --muted: #565656;
    --border: #CCCCCC;
    --on-accent: #FFFFFF;
    --link: #1A78C2;            /* texto de destaque sobre superfície */
    --primary-soft: rgba(33, 150, 243, 0.12);
    --ok: #2E7D32;
    --warn: #B26A00;
    --danger: #B3261E;

    /* Espaçamento (grade de 4px) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Forma e elevação */
    --radius: 12px;
    --radius-pill: 999px;
    --shadow-subtle: -10px 10px 10px 0 rgba(0, 0, 0, 0.25);
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* Tipografia */
    --font: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --fs-body: 14px;
    --fs-lead: 16px;
    --fs-h3: 23px;
    --fs-hero: 34px;

    /* Movimento */
    --t-fast: 0.15s;
    --t-base: 0.2s;
    --t-slow: 0.3s;
    --ease: ease-in-out;

    /* Camadas */
    --z-tooltip: 1;
    --z-dropdown: 30;
    --z-nav: 9999;

    --container: 1185px;
    --gutter: 15px;
}

:root[data-theme="dark"] {
    --primary: #64B5F6;
    --accent: #1A78C2;
    --link: #64B5F6;
    --surface: #14181D;
    --elevated: #1D232A;
    --card: #1D232A;
    --text: #E8EAED;
    --muted: #AEB6BF;
    --border: #3A424B;
    --primary-soft: rgba(100, 181, 246, 0.16);
    --ok: #81C784;
    --warn: #FFB74D;
    --danger: #F2B8B5;
    --shadow-subtle: -10px 10px 10px 0 rgba(0, 0, 0, 0.55);
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Reset e base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--fs-body);
    line-height: 1.5;
    color: var(--text);
    background: var(--surface);
    transition: background-color var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--link); }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: var(--space-4); top: -48px; z-index: calc(var(--z-nav) + 1);
    background: var(--accent); color: var(--on-accent); padding: var(--space-2) var(--space-4);
    border-radius: var(--radius); transition: top var(--t-base) var(--ease);
}
.skip-link:focus { top: var(--space-2); }

/* Foco visível (o brief pede 0px; mantemos um anel fino por acessibilidade) */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Botões ----------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: 44px; padding: 10px var(--space-5);
    font: inherit; font-weight: 400; color: var(--muted);
    background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; text-decoration: none;
    transition: opacity var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease),
                background-color var(--t-base) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { opacity: 0.8; box-shadow: rgba(255, 255, 255, 0.2) 0 0 50px inset; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-soft { color: var(--text); text-align: left; justify-content: flex-start; }
.btn-soft i { color: var(--link); }
.btn-ghost { background: transparent; border-color: transparent; color: #fff; }
.btn-icon { width: 44px; padding: 0; }

/* Cabeçalho -------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: var(--z-nav);
    background: var(--accent); color: #fff; box-shadow: var(--shadow-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--space-4); }
.brand { display: flex; align-items: center; gap: var(--space-3); color: #fff; text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 40px; height: 40px;
    background: rgba(255, 255, 255, 0.18); border-radius: var(--radius); font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 18px; font-weight: 700; }
.brand-text span { font-size: 12px; opacity: 0.9; }
.header-nav { display: flex; align-items: center; gap: var(--space-2); }
.header-nav > a {
    color: #fff; text-decoration: none; padding: var(--space-2) var(--space-3);
    border-radius: var(--radius); transition: background-color var(--t-base) var(--ease);
}
.header-nav > a:hover { background: rgba(255, 255, 255, 0.16); }

/* Hero ------------------------------------------------------------------- */
.hero { background: var(--accent); color: #fff; padding: var(--space-8) 0 96px; }
.hero-inner { display: flex; flex-direction: column; gap: var(--space-4); max-width: 760px; margin: 0; }
.hero h1 { font-size: var(--fs-hero); line-height: 1.2; font-weight: 700; }

/* Assistente (chat) ------------------------------------------------------ */
.assistant { margin-top: -64px; padding-bottom: var(--space-8); position: relative; }
.chat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-subtle); overflow: hidden;
    display: flex; flex-direction: column;
}
.chat-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border); background: var(--elevated);
}
.chat-card-head h2 { font-size: 24px; line-height: 1.2; font-weight: 700; }
.chat-card-head p { color: var(--muted); margin-top: var(--space-1); }
.status-pill {
    display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--muted);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: var(--space-1) var(--space-3); white-space: nowrap;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.status-pill.is-online .dot { background: var(--ok); }
.status-pill.is-offline .dot { background: var(--warn); }

.chat-body {
    height: min(58vh, 560px); min-height: 320px; overflow-y: auto;
    padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5);
    background: var(--surface);
}
.welcome-card {
    margin: auto; max-width: 640px; text-align: center; padding: var(--space-6);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft);
}
.welcome-icon {
    display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto var(--space-4);
    background: var(--primary-soft); color: var(--link); border-radius: var(--radius); font-size: 24px;
}
.welcome-card h3 { font-size: var(--fs-h3); line-height: 1.2; font-weight: 700; margin-bottom: var(--space-2); }
.welcome-card p { color: var(--muted); margin-bottom: var(--space-5); }
.suggestions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* Mensagens */
.message-row { display: flex; gap: var(--space-3); max-width: 82%; animation: rise var(--t-slow) var(--ease); }
.message-row.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar-bubble {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 14px;
}
.avatar-bubble.bot-avatar { background: var(--primary-soft); color: var(--link); }
.avatar-bubble.user-avatar { background: var(--muted); color: var(--card); }
.message-content { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.message-bubble {
    padding: var(--space-3) var(--space-4); border-radius: var(--radius);
    line-height: 1.5; overflow-wrap: anywhere; box-shadow: var(--shadow-soft);
}
.message-row.bot .message-bubble { background: var(--card); border: 1px solid var(--border); border-top-left-radius: var(--space-1); }
.message-row.user .message-bubble { background: var(--accent); color: var(--on-accent); border-top-right-radius: var(--space-1); }
.message-bubble code { background: var(--primary-soft); padding: 0 var(--space-1); border-radius: var(--space-1); }
.message-bubble a { font-weight: 600; }
.message-row.user .message-bubble a { color: #fff; }

.typing-dots { display: flex; gap: var(--space-1); padding: var(--space-1) 0; }
.typing-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: blink 1.2s var(--ease) infinite both; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* Formulário */
.chat-form {
    display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border); background: var(--card);
}
.chat-form input {
    flex: 1; min-width: 0; min-height: 44px; padding: 11px var(--space-4);
    font: inherit; color: var(--text); background: var(--elevated);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.chat-form input::placeholder { color: var(--muted); }
.chat-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), 0 0 0 1px var(--primary); }
.chat-footnote { padding: 0 var(--space-6) var(--space-4); color: var(--muted); font-size: 12px; background: var(--card); }

.site-footer { border-top: 1px solid var(--border); padding: var(--space-6) 0; color: var(--muted); font-size: 13px; background: var(--elevated); }

/* Animações */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Responsivo (breakpoints do brief: 991, 768, 480) ------------------------ */
@media (max-width: 991px) {
    .hero { padding-bottom: 88px; }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 28px; }
    .chat-card-head { flex-direction: column; align-items: flex-start; padding: var(--space-4); }
    .chat-body { padding: var(--space-4); }
    .chat-form { padding: var(--space-3) var(--space-4); }
    .chat-footnote { padding: 0 var(--space-4) var(--space-3); }
    .message-row { max-width: 94%; }
    .header-nav > a { display: none; }
}
@media (max-width: 480px) {
    .suggestions-grid { grid-template-columns: 1fr; }
    .btn-label { display: none; }
    .chat-form .btn-primary { width: 44px; padding: 0; }
    .chat-body { height: 60vh; }
    .hero h1 { font-size: 24px; }
}
