/* ==========================================================================
   1. DESIGN TOKENS (VARIÁVEIS GLOBAIS)
   ========================================================================== */
:root {
    /* --- Cor Tema Única (Sobrescrita dinamicamente pelo PHP via Banco) --- */
    --brand-primary: #0082fb;            /* Cor Principal (Botão primário, destaques, ícones) */
    --brand-primary-hover: #006ad1;      /* Hover calculado automaticamente */
    --brand-primary-soft: #edf5ff;       /* Fundo suave (10% da cor tema) para itens ativos e badges */

    /* --- Superfícies & Escala de Cinzas (Base Zinc / Shadcn UI) --- */
    --bg-page: #ffffff;
    --bg-surface: #ffffff;
    --bg-muted: #fafafa;                 /* zinc-50: inputs, selects, cabeçalhos de tabela, barras */
    --bg-subtle: #f4f4f5;                /* zinc-100: hover neutro, switchers, badges neutros */
    --bg-dark: #18181b;                  /* zinc-900: blocos escuros neutros */
    --bg-dark-hover: #27272a;            /* zinc-800 */

    /* --- Bordas Padronizadas (Única fonte de verdade) --- */
    --border-color: #e4e4e7;             /* zinc-200: borda padrão de cards, inputs, selects, tabelas e botões */
    --border-color-hover: #d4d4d8;       /* zinc-300: borda no hover e no foco */

    /* --- Raios de Borda Padronizados (Sem colisão com variáveis do Tailwind v4) --- */
    --app-radius-sm: 0.375rem;           /* 6px: itens de dropdown, badges, botões pequenos, itens internos toggle */
    --app-radius-md: 0.5rem;             /* 8px: botões padrão, inputs, selects, container do toggle */
    --app-radius-lg: 0.75rem;            /* 12px: cards, caixas de form, modais, dropdowns, tabelas */

    /* --- Tipografia Padronizada (Escala & Cores) --- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --text-primary: #18181b;             /* zinc-900: títulos, valores, texto principal */
    --text-secondary: #3f3f46;           /* zinc-700: corpo de texto, labels de formulário */
    --text-muted: #71717a;               /* zinc-500: subtítulos, placeholders, metadados */
    --text-subtle: #a1a1aa;              /* zinc-400: ícones neutros, textos desabilitados */
    
    --text-xs: 0.75rem;                  /* 12px: inputs, botões padrão, tabelas, metadados */
    --text-sm: 0.8125rem;                /* 13px: textos de apoio, links de menu */
    --text-base: 0.875rem;               /* 14px: títulos de cards e subtítulos (antes 15px) */
    --text-lg: 1rem;                     /* 16px: títulos de seção como "Sobre a empresa" (antes 18px) */
    --text-xl: 1.375rem;                 /* 22px: títulos principais de página (antes 24px) */

    /* --- Alturas Padronizadas de Controles --- */
    --control-height-sm: 2rem;           /* 32px */
    --control-height-md: 2.25rem;        /* 36px (Padrão navbar, formulários, botões) */
    --control-height-lg: 2.75rem;        /* 44px (Barra de busca principal e botões de busca) */

    /* --- Sombras --- */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   2. BASE & TIPOGRAFIA PADRONIZADA
   ========================================================================== */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-size: var(--text-sm);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background-color: var(--brand-primary);
    color: #ffffff;
}

.page-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.card-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.section-subtitle {
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.5;
}

.form-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.icon-brand { color: var(--brand-primary); }
.icon-muted { color: var(--text-subtle); }

/* ==========================================================================
   3. SISTEMA DE BOTÕES (LIMPO E PADRONIZADO)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: var(--control-height-md);
    padding: 0 0.875rem;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--app-radius-md);
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

.btn i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    background-color: var(--bg-subtle) !important;
    color: var(--text-subtle) !important;
    border-color: var(--border-color) !important;
    cursor: not-allowed;
}

/* Tamanhos */
.btn-sm {
    height: var(--control-height-sm);
    padding: 0 0.65rem;
    font-size: 0.75rem;
    border-radius: var(--app-radius-sm);
}

.btn-default {
    height: var(--control-height-md);
    padding: 0 0.875rem;
    font-size: var(--text-xs);
}

.btn-lg {
    height: var(--control-height-lg);
    padding: 0 1.25rem;
    font-size: var(--text-sm);
}

/* Botão específico para barras de busca (mesma altura 44px do .search-control) */
.btn-search {
    height: var(--control-height-lg);
    padding: 0 1.5rem;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--app-radius-md);
}

@media (min-width: 640px) {
    .btn-search {
        min-width: 9.5rem;
    }
}

.btn-icon {
    width: var(--control-height-md);
    height: var(--control-height-md);
    padding: 0;
}

/* Variantes */
.btn-primary {
    background-color: var(--brand-primary);
    color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--brand-primary-hover);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-subtle);
    border-color: var(--border-color-hover);
    color: var(--text-primary);
}

.btn-dark {
    background-color: var(--bg-dark);
    color: #ffffff;
}
.btn-dark:hover:not(:disabled) {
    background-color: var(--bg-dark-hover);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

/* ==========================================================================
   4. FORMULÁRIOS, INPUTS, SELECTS & CONTROLES DE BUSCA PADRONIZADOS
   ========================================================================== */
.search-control {
    width: 100%;
    height: var(--control-height-lg);
    min-height: var(--control-height-lg); /* Evita achatamento no flex-col mobile */
    padding: 0 0.875rem;
    background-color: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--app-radius-md);
    transition: border-color 0.2s ease;
}

.search-control:hover,
.search-control:focus-within {
    background-color: var(--bg-muted);
    border-color: var(--border-color-hover);
}

.input-shadcn,
.select-shadcn,
.textarea-shadcn {
    width: 100%;
    height: var(--control-height-md);
    padding: 0 0.75rem;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-primary);
    background-color: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--app-radius-md);
    transition: border-color 0.2s ease;
}

.textarea-shadcn {
    height: auto;
    min-height: 5.5rem;
    padding: 0.625rem 0.75rem;
    line-height: 1.5;
}

.input-shadcn::placeholder,
.textarea-shadcn::placeholder {
    color: var(--text-subtle);
    font-weight: 400;
}

.input-shadcn:hover,
.select-shadcn:hover,
.textarea-shadcn:hover,
.input-shadcn:focus,
.select-shadcn:focus,
.textarea-shadcn:focus {
    outline: none;
    background-color: var(--bg-muted);
    border-color: var(--border-color-hover);
    box-shadow: none;
}

/* ==========================================================================
   5. CARDS, DROPDOWNS & TABELAS (MESMA BORDA, RAIO 12px E SOMBRA)
   ========================================================================== */
.card-shadcn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-shadcn-hover:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-color-hover);
}

.shadcn-dropdown {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--app-radius-lg) !important;
    box-shadow: var(--shadow-card) !important;
}

/* Tabelas Padronizadas */
.table-wrapper-shadcn {
    width: 100%;
    overflow-x: auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--shadow-card);
}

.table-shadcn {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: var(--text-xs);
}

.table-shadcn thead {
    background-color: var(--bg-muted);
    border-bottom: 1px solid var(--border-color);
}

.table-shadcn th {
    padding: 0.65rem 1rem;
    font-size: 0.6875rem; /* 11px */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.table-shadcn td {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-shadcn tbody tr:last-child td {
    border-bottom: none;
}

.table-shadcn tbody tr:hover {
    background-color: var(--bg-muted);
}

/* Itens de Dropdown e Menus Laterais */
.dropdown-item,
.dropdown-item-danger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--app-radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
    text-decoration: none;
}

.dropdown-item {
    color: var(--text-secondary);
}
.dropdown-item:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}
.dropdown-item.active {
    background-color: var(--brand-primary-soft);
    color: var(--brand-primary);
    font-weight: 600;
}

.dropdown-item-danger {
    color: #ef4444;
}
.dropdown-item-danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

.dropdown-item-blue:hover {
    background-color: var(--brand-primary-soft) !important;
    color: var(--brand-primary) !important;
}
.dropdown-item-blue:hover i {
    color: var(--brand-primary) !important;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--app-radius-md);
    transition: all 0.15s ease;
    cursor: pointer;
    text-decoration: none;
}
.menu-link:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}
.menu-link.active {
    background-color: var(--brand-primary-soft);
    color: var(--brand-primary);
    font-weight: 600;
}

/* Switcher / Alternadores */
.switcher-container {
    display: inline-flex;
    background-color: var(--bg-subtle);
    padding: 0.25rem;
    border-radius: var(--app-radius-md);
    border: 1px solid var(--border-color);
}
.switcher-btn {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: var(--app-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-muted);
    background-color: transparent;
    border: none;
}
.switcher-btn:hover {
    color: var(--text-primary);
}
.switcher-btn.active {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

/* Barra de rolagem delicada */
.dropdown-scroll::-webkit-scrollbar {
    width: 5px;
}
.dropdown-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.dropdown-scroll::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 9999px;
}
.dropdown-scroll::-webkit-scrollbar-thumb:hover {
    background-color: var(--border-color-hover);
}

/* ==========================================================================
   6. NAVBAR, HERO & STICKY
   ========================================================================== */
#main-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.hero-profile-glow {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--brand-primary) 45%, transparent) 0%, var(--bg-dark) 75%);
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .hero-profile-glow {
        background-image: radial-gradient(circle at 25% 50%, color-mix(in srgb, var(--brand-primary) 35%, transparent) 0%, var(--bg-dark) 65%);
    }
}

@media (min-width: 1024px) {
    .lg\:sticky {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 8.25rem !important; /* 132px: acomoda header (64px) + subnav (48px) + respiro */
        height: fit-content !important;
        align-self: flex-start !important;
    }
}

/* ==========================================================================
   7. ANIMAÇÕES, FAQ & RESPONSIVIDADE
   ========================================================================== */
.typing-cursor {
    display: inline-block;
    width: 2px;
    background-color: var(--brand-primary);
    animation: blink 0.8s infinite;
    margin-left: 2px;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}
.faq-content.open {
    max-height: 150px;
    opacity: 1;
}
.faq-chevron {
    transition: transform 0.3s ease;
}
.faq-header.open .faq-chevron {
    transform: rotate(180deg);
}

.dot-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border-color-hover);
    font-size: 10px;
    margin: 1.5rem 0;
    letter-spacing: 0.5em;
}

@media (max-width: 1023px) {
    .mobile-carousel,
    .mobile-carousel-recentes,
    .mobile-carousel-passos,
    .mobile-carousel-blog {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.5rem;
    }

    .mobile-carousel { gap: 1rem !important; }
    .mobile-carousel > div { min-width: 150px; flex-shrink: 0; scroll-snap-align: start; }

    .mobile-carousel-recentes { gap: 0.75rem !important; }
    .mobile-carousel-recentes > div { min-width: 150px !important; max-width: 160px !important; flex-shrink: 0; scroll-snap-align: start; }

    .mobile-carousel-passos { gap: 1rem !important; }
    .mobile-carousel-passos > div { min-width: 260px; max-width: 280px; flex-shrink: 0; scroll-snap-align: start; }

    .mobile-carousel-blog { gap: 1rem !important; }
    .mobile-carousel-blog > div { min-width: 280px; max-width: 300px; flex-shrink: 0; scroll-snap-align: start; }

    .footer-col-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
        opacity: 0;
    }
    .footer-col-content.open { max-height: 250px; opacity: 1; }
    .footer-chevron { transition: transform 0.3s ease; }
    .footer-header.open .footer-chevron { transform: rotate(180deg); }
}

/* ==========================================================================
   PADRÃO GLOBAL MODAL
   ========================================================================== */
.guiamex-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background-color: rgba(9, 9, 11, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

@media (min-width: 640px) {
    .guiamex-modal-backdrop {
        align-items: center;
        padding: 1rem;
    }
}

.guiamex-modal-backdrop.hidden {
    display: none;
}

.guiamex-modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
}

.guiamex-modal-close {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #a1a1aa;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.guiamex-modal-close:hover {
    color: #18181b;
    background-color: rgba(228, 228, 231, 0.75);
}

@media (max-width: 639px) {
    .modal-sheet-mobile {
        max-height: calc(100dvh - 60px) !important;
        height: auto !important;
    }
    .modal-body-scroll-mobile {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }
}

/* ==========================================================================
   8. UNIFICAÇÃO GLOBAL DE RAIOS (SOBRESCREVE ESCALA PADRÃO DO TAILWIND V4)
   ========================================================================== */
.rounded-md { border-radius: var(--app-radius-sm) !important; } /* 6px */
.rounded-lg { border-radius: var(--app-radius-md) !important; } /* 8px - idêntico ao .btn e inputs */
.rounded-xl { border-radius: var(--app-radius-lg) !important; } /* 12px - idêntico ao .card-shadcn */
