/* =========================================================
   ChatGuard — Modern Design Tokens & Reset
   Baseado no padrão mira.ai (2026)
   ========================================================= */

/* ===== TOKENS BASE (independentes de tema) ===== */
:root {
    /* Tipografia */
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'Roboto Mono', monospace;
    --font-size-base: 14px;

    /* Sidebar — width fixo, cores via white label */
    --sidebar-width:       256px;

    /* Raios de borda */
    --radius-sm:   4px;
    --radius-md:   6px;
    --radius-lg:   10px;
    --radius-full: 9999px;

    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
}

/* ===== TEMA DARK (padrão) ===== */
:root,
[data-theme="dark"] {
    --bg-main:              #0b1120;
    --bg-card:              #1e293b;
    --bg-surface:           #0f172a;
    --bg-surface-2:         #162032;
    --border-color:         rgba(255, 255, 255, 0.08);
    --border-color-strong:  rgba(255, 255, 255, 0.14);
    --text-primary:         #f8fafc;
    --text-secondary:       #cbd5e1;
    --text-muted:           #94a3b8;
    --text-faint:           #475569;
    --input-bg:             #0f172a;
    --input-border:         rgba(255, 255, 255, 0.12);
    --table-header-bg:      rgba(255, 255, 255, 0.04);
    --table-row-hover:      rgba(255, 255, 255, 0.04);
    --shadow-sm:            0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md:            0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg:            0 20px 60px rgba(0, 0, 0, 0.5);

    /* Sidebar dark: fundo escuro fixo, white label apenas como accent */
    --sidebar-bg:            #0f172a;
    --sidebar-border:        rgba(255, 255, 255, 0.06);
    --sidebar-text:          #94a3b8;
    --sidebar-text-hover:    #f1f5f9;
    --sidebar-active-bg:     rgba(var(--primary-rgb, 37, 165, 95), 0.12);
    --sidebar-active-border: var(--primary-color, #25a55f);
    --sidebar-active-text:   var(--primary-color, #25a55f);
}

/* ===== TEMA LIGHT ===== */
[data-theme="light"] {
    --bg-main:              #f8fafc;
    --bg-card:              #ffffff;
    --bg-surface:           #f1f5f9;
    --bg-surface-2:         #e9eef5;
    --border-color:         #e2e8f0;
    --border-color-strong:  #cbd5e1;
    --text-primary:         var(--light-text-color, #0f172a);
    --text-secondary:       #334155;
    --text-muted:           #64748b;
    --text-faint:           #94a3b8;
    --input-bg:             #ffffff;
    --input-border:         #e2e8f0;
    --table-header-bg:      #f8fafc;
    --table-row-hover:      #f1f5f9;
    --shadow-sm:            0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md:            0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg:            0 20px 60px rgba(0, 0, 0, 0.15);

    /* Sidebar light: fundo branco, white label como accent */
    --sidebar-bg:            #ffffff;
    --sidebar-border:        #e2e8f0;
    --sidebar-text:          #64748b;
    --sidebar-text-hover:    #0f172a;
    --sidebar-active-bg:     rgba(var(--primary-rgb, 37, 165, 95), 0.08);
    --sidebar-active-border: var(--primary-color, #25a55f);
    --sidebar-active-text:   var(--primary-color, #25a55f);
}

/* ===== RESET BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body) !important;
    font-size: 1rem;
    color: var(--text-primary) !important;
    background-color: var(--bg-main) !important;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display) !important;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-primary) !important;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}



code, kbd, pre, samp, .font-monospace {
    font-family: var(--font-mono) !important;
}

/* ===== SCROLLBAR ===== */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color-strong) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-color-strong);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ===== SELECTION =====
 * Background sólido (sem rgba) garante contraste em dark e light.
 * !important + text-shadow:none impede que regras de tema/heading
 * sobrescrevam a cor do texto selecionado.
 */
::selection {
    background-color: var(--primary-color, #25a55f) !important;
    color: #ffffff !important;
    text-shadow: none !important;
}
::-moz-selection {
    background-color: var(--primary-color, #25a55f) !important;
    color: #ffffff !important;
    text-shadow: none !important;
}

/* ===== FIX Bootstrap: Tab visibility ===== */
.tab-pane { display: none !important; }
.tab-pane.active { display: block !important; }
.tab-pane.active.show { display: block !important; }

/* ===== FIX: Botões com links internos (clickable full area) ===== */
.btn { position: relative; }
.btn > a {
    color: inherit !important;
    text-decoration: none !important;
}
.btn > a::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
}

/* ===== FIX: Overlay ===== */
.overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0 !important;
    left: 0 !important;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: all 0.3s ease;
}
.overlay.active {
    display: block;
    opacity: 1;
}
@media (min-width: 769px) {
    .overlay.active { display: none !important; }
}

/* ===== Fullscreen layout (wallboards, porter boards) ===== */
body.layout-fullscreen #sidebar        { display: none !important; }
body.layout-fullscreen #navbar-top     { display: none !important; }
body.layout-fullscreen #content-wrapper { margin-left: 0 !important; width: 100% !important; }
