/* backend/static/css/core.css */

/* 
   Versão: 2.4.1 - Design System DNA (Hotfix: Layout Math & Full Viewport Stability)
   Status: ACESSIBILIDADE WCAG AA + DENSIDADE INTELIGENTE
   Objetivo: Escala fluida global (Auto-Zoom) para Laptops/Full HD e contraste DISC refinado.
*/

:root {
    /* ==========================================================================
       1. DESIGN TOKENS (A FONTE DA VERDADE)
       ========================================================================== */

    /* --- Dimensões de Layout --- */
    --navbar-height: 72px; /* Altura real do Header Fixo */
    --promo-banner-height: 41px;

    /* --- Tipografia Premium (System Fonts) & DENSIDADE ADAPTATIVA --- */
    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-family-headings: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* 
       BASE FONT SIZE (O CORAÇÃO DA DENSIDADE)
       Define a escala de 1rem para todo o sistema.
    */
    --base-font-size: 14px; /* Padrão Mobile e Tablets */

    /* --- Cores de Marca (Brand) --- */
    --color-primary: #3037c5;
    --color-primary-darker: #0056b3;
    --color-primary-bs: #1332bc;
    --color-primary-bs-darker: rgb(50, 115, 220);
    --color-primary-bs-rgb: 13, 110, 253;

    --color-secondary: #6c757d;
    --color-secondary-darker: #5c636a;
    --color-accent-b2b: #764ba2;

    /* --- Cores DISC (Ajustadas para Acessibilidade/Contraste) --- */
    --color-disc-d: #dc2626; /* 5.0:1 AA */
    --color-disc-i: #d98f06; /* Laranja Ouro */
    --color-disc-s: #059669; /* Esmeralda Profundo */
    --color-disc-c: #2563eb; /* Royal Blue */

    /* --- Cores de Feedback (UI) --- */
    --color-success: #064729;
    --color-success-dark: #198754;
    --color-success-darker: #157347;

    --color-danger: #ff4c38;
    --color-danger-bs: #dc3545;
    --color-danger-border-light: #f3d9dc;

    --color-warning: #f1c40f;
    --color-warning-bs: #ffc107;
    --color-warning-text-bs: #000;

    --color-info: #17a2b8;
    --color-info-darker: #31d2f2;
    --color-info-bs: #0dcaf0;

    /* --- Cores de Texto --- */
    --color-text-default: #1e293b;
    --color-text-headings: #0f172a;
    --color-text-muted: #64748b;
    --color-text-light: #f8f9fa;
    --color-text-white: #ffffff;
    --color-text-link: var(--color-primary-darker);
    --color-text-strikethrough: #adb5bd;
    --color-text-apple-blue: rgb(50, 115, 220);

    /* --- Superfícies e Fundos --- */
    --color-bg-body: #f8fafc;
    --color-bg-container: #ffffff;
    --color-bg-light: #f1f5f9;
    --color-bg-dark: #0a0d13;
    --color-bg-subtle-blue: #eaf4ff;

    /* --- Sombras DNA (Premium & Profundas) --- */
    --shadow-dna-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-dna-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-dna-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-dna-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-dna-3d: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 20px rgba(0, 0, 0, 0.08), 0 20px 40px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.15);

    /* --- Bordas e Raios --- */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-2xl: 1.5rem; 
    --border-color-default: #e2e8f0;
    --border-color-light: #f1f5f9;

    /* --- Espaçamento --- */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* --- Animações e Transições --- */
    --transition-fast: all 0.15s ease-out;
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --btn-transition-premium: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* ==========================================================================
       2. PONTE DE COMPATIBILIDADE (LEGACY BRIDGE)
       ========================================================================== */
    --brand-primary: var(--color-primary-bs);
    --brand-primary-hover: var(--color-primary-bs-darker);
    --brand-d: var(--color-disc-d);
    --brand-i: var(--color-disc-i);
    --brand-s: var(--color-disc-s);
    --brand-c: var(--color-disc-c);
    --brand-dark: var(--color-bg-dark);
    
    --radius-sm: var(--border-radius-sm);
    --radius-md: var(--border-radius-md);
    --radius-lg: var(--border-radius-lg);
    
    --shadow-sm: var(--shadow-dna-sm);
    --shadow-md: var(--shadow-dna-md);
    --shadow-lg: var(--shadow-dna-lg);
    --shadow-xl: var(--shadow-dna-xl);
    --shadow: var(--shadow-dna-md);
}

/* 
   ==========================================================================
   MEDIA QUERIES DE DENSIDADE (AUTO-ZOOM)
   ==========================================================================
*/

/* Laptops e Monitores Full HD (1280px - 1920px) */
/* Simula um zoom de ~92% para aumentar a área útil sem perder leitura */
@media (min-width: 1280px) and (max-width: 1920px) {
    :root {
        --base-font-size: 13px; 
    }
}

/* Monitores 2K, 4K e Retina (> 1920px) */
/* Aumenta a base para compensar a alta densidade de pixels */
@media (min-width: 1921px) {
    :root {
        --base-font-size: 16px;
    }
}

/* ==========================================================================
   3. RESET & BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    font-size: var(--base-font-size);
    scroll-padding-top: calc(var(--navbar-height) + 10px);
    /* FIX CRÍTICO: Trava Suprema de Overflow Horizontal */
    overflow-x: hidden;
    /* FIX CRÍTICO: Estabiliza a largura do layout contra o "pulo" da scrollbar */
    scrollbar-gutter: stable;
    width: 100%;
}

body {
    font-family: var(--font-family-sans-serif);
    line-height: 1.5;
    color: var(--color-text-default);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--color-bg-body);
    /* Redundância de segurança */
    overflow-x: hidden;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex-grow: 1;
    width: 100%; 
    min-width: 0; 
    /* Compensação para o Header Fixo */
    padding-top: var(--navbar-height); 
}

.navbar-thin-wrapper + main {
    padding-top: 60px;
}

header:has(.promo-banner) + main {
    padding-top: calc(var(--navbar-height) + var(--promo-banner-height));
}

/* ==========================================================================
   4. ESCALA TIPOGRÁFICA BTOS
   ========================================================================== */
.display-hero {
    font-size: 3.5rem;
    line-height: 1.1;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.display-section {
    font-size: 2.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.display-card {
    font-size: 1.5rem;
    line-height: 1.3;
    font-weight: 600;
}

.text-lead-lg {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--color-text-muted);
}

.text-lead {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--color-text-muted);
}

@media (min-width: 992px) {
    .display-hero { font-size: 4.5rem; }
    .display-section { font-size: 3.25rem; }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-headings);
    color: var(--color-text-headings);
    font-weight: 700;
    letter-spacing: -0.025em;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   5. LIGHT GRID SYSTEM (RESPONSIVO COMPLETO)
   ========================================================================== */
.container, .container-fluid {
    width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

.container {
    max-width: 1280px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    /* 
       FIX CRÍTICO: Removido width: 100% 
       Com margens negativas, width: 100% causava overflow de 32px (1rem + 1rem).
    */
    margin-right: calc(var(--spacing-md) * -1);
    margin-left: calc(var(--spacing-md) * -1);
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0; 
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
}

.col { flex: 1 0 0%; }
.col-auto { flex: 0 0 auto; width: auto; }

/* Frações Globais */
.col-1 { flex: 0 0 8.333333%; width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; width: 16.666667%; }
.col-3 { flex: 0 0 25%; width: 25%; }
.col-6 { flex: 0 0 50%; width: 50%; }

/* Grid Breakpoints */
@media (min-width: 768px) {
    .col-md-3 { flex: 0 0 auto; width: 25%; }
    .col-md-4 { flex: 0 0 auto; width: 33.333333%; }
    .col-md-5 { flex: 0 0 auto; width: 41.666667%; }
    .col-md-6 { flex: 0 0 auto; width: 50%; }
    .col-md-7 { flex: 0 0 auto; width: 58.333333%; }
    .col-md-8 { flex: 0 0 auto; width: 66.666667%; }
    .col-md-10 { flex: 0 0 auto; width: 83.333333%; }
    .col-md-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-2 { flex: 0 0 auto; width: 16.666667%; }
    .col-lg-3 { flex: 0 0 auto; width: 25%; }
    .col-lg-4 { flex: 0 0 auto; width: 33.333333%; }
    .col-lg-5 { flex: 0 0 auto; width: 41.666667%; }
    .col-lg-6 { flex: 0 0 auto; width: 50%; }
    .col-lg-7 { flex: 0 0 auto; width: 58.333333%; }
    .col-lg-8 { flex: 0 0 auto; width: 66.666667%; }
    .col-lg-10 { flex: 0 0 auto; width: 83.333333%; }
}

/* ==========================================================================
   6. UTILITÁRIOS GLOBAIS
   ========================================================================== */

/* Espaçamento de Seção */
.section-spacing {
    padding-top: 80px;
    padding-bottom: 80px;
}
.section-teaser-spacing {
    padding-top: 56px;
    padding-bottom: 56px;
}

@media (min-width: 992px) {
    .section-spacing {
        padding-top: 120px;
        padding-bottom: 120px;
    }
    .section-teaser-spacing {
        padding-top: 84px;
        padding-bottom: 84px;
    }
}

/* Flex & Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }

/* Dimensões Rápidas */
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* 
   FIX CRÍTICO DE LAYOUT (CORRIGIDO): 
   Wrapper deve ocupar 100% da viewport.
   O Header é Fixed (fora do fluxo), então NÃO subtraímos sua altura aqui.
   A compensação visual é feita via padding-top no <main>.
*/
.min-vh-100 { 
    min-height: 100vh !important; 
}

/* Pesos de Fonte DNA Edition */
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-extrabold { font-weight: 800 !important; }
.fw-black { font-weight: 900 !important; }

/* Margens e Paddings Rápidos */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* Glassmorphism */
.glass-btos {
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* Badges DISC (Atualizados para novas variáveis) */
.badge-btos {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-d { background-color: var(--color-disc-d); color: white; }
.badge-i { background-color: var(--color-disc-i); color: white; }
.badge-s { background-color: var(--color-disc-s); color: white; }
.badge-c { background-color: var(--color-disc-c); color: white; }

/* ==========================================================================
   7. COMPONENTES ESTRUTURAIS (DNA BTOS)
   ========================================================================== */

/* Card Padrão Retangular - Ultra Glass Global */
.card-btos-standard {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border-radius: var(--border-radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: var(--shadow-dna-lg);
    padding: var(--spacing-lg);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.card-btos-standard:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* Estrutura Interna de Cards */
.card-header { 
    padding: 1.5rem; 
    margin-bottom: 0; 
    background-color: transparent; 
    border-bottom: 1px solid var(--border-color-default); 
}
.card-body { 
    flex: 1 1 auto; 
    padding: 1.5rem; 
}

/* Grid 2x2 Simétrico */
.grid-btos-2x2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}
@media (min-width: 768px) {
    .grid-btos-2x2 { grid-template-columns: repeat(2, 1fr); }
}

/* Refinamento de Imagens nos Cards de Exploração */
.card-exploration { align-items: flex-start; }
.card-exploration img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
    margin-bottom: var(--spacing-sm);
}

/* Overlay de Carregamento Global */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}