/* =========================================
   1. VARIÁVEIS E RESET (DESIGN SYSTEM)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --azul-primario: #1e293b;
    --azul-destaque: #3b82f6;
    --azul-hover: #2563eb;
    --branco: #ffffff;
    --cinza-fundo: #f8fafc;
    --cinza-texto: #334155;
    --cinza-claro: #e2e8f0;
    --cinza-muted: #64748b;
    --cinza-border: #cbd5e1;
    --erro: #ef4444;
    --erro-fundo: #fef2f2;
    --sucesso: #10b981;
    --sucesso-fundo: #f0fdf4;
    --aviso: #f59e0b;
    --aviso-fundo: #fffbeb;
    --info: #0ea5e9;
    --info-fundo: #f0f9ff;
    --stripe: #635bff;
    --vermelho-logo: #b92220;
    --vermelho-header: #891413;
    --sombra-suave: 0 4px 20px rgba(0, 0, 0, 0.04);
    --sombra-media: 0 10px 25px rgba(0, 0, 0, 0.08);
    --raio-sm: 6px;
    --raio-md: 8px;
    --raio-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--cinza-fundo);
    color: var(--cinza-texto);
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
    line-height: 1.6;
}
a{
    text-decoration: none;
}
ul{
    list-style-type: none;
    padding: 0px;
    margin: 0px;
}
/* =========================================
   2. UTILITÁRIOS (TIPOGRAFIA E ALINHAMENTO)
   ========================================= */
.text-primary { color: var(--azul-primario) !important; }
.text-destaque { color: var(--azul-destaque) !important; }
.text-success { color: var(--sucesso) !important; }
.text-danger { color: var(--erro) !important; }
.text-muted { color: var(--cinza-muted) !important; }

.font-bold { font-weight: 700 !important; }
.font-extrabold { font-weight: 800 !important; }
.text-sm { font-size: 0.85rem !important; }
.text-lg { font-size: 1.1rem !important; }
.text-xl { font-size: 1.5rem !important; }
.text-xxl { font-size: 2.5rem !important; }

.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-uppercase { text-transform: uppercase !important; }
.line-through { text-decoration: line-through !important; }

.mt-0 { margin-top: 0px; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; }
.mb-0 { margin-bottom: 0px; } .mb-1 { margin-bottom: 10px; } .mb-2 { margin-bottom: 20px; }
.w-100 { width: 100% !important; }

/* =========================================
   3. BOTÕES PADRONIZADOS (.btn)
   ========================================= */
.btn {
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    padding: 10px 20px; 
    border-radius: var(--raio-sm); 
    font-size: 0.95rem; 
    font-weight: 600;
    font-family: inherit; /* Mágica 1: Força o <button> a usar a fonte do sistema */
    line-height: 1.5;     /* Mágica 2: Iguala a altura exata entre link e botão */
    text-align: center;
    vertical-align: middle;
    cursor: pointer; 
    transition: all 0.2s ease; 
    text-decoration: none; 
    border: 1px solid transparent;
    outline: none;        /* Tira o foco azul feio nativo do navegador */
    appearance: none;     /* Remove qualquer estilo nativo de celular/Mac */
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* Variantes */
.btn-primary { background-color: var(--azul-destaque); color: white; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2); }
.btn-primary:hover { background-color: var(--azul-hover); box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3); }

.btn-secondary { background-color: var(--cinza-claro); color: var(--cinza-texto); }
.btn-secondary:hover { background-color: var(--cinza-border); color: var(--azul-primario); }

.btn-danger { background-color: var(--erro-fundo); color: var(--erro); border-color: #fca5a5; }
.btn-danger:hover { background-color: #fca5a5; color: #b91c1c; }

.btn-success { background-color: var(--sucesso); color: white; }
.btn-success:hover { background-color: #059669; }

.btn-stripe { background-color: var(--stripe); color: white; }
.btn-stripe:hover { background-color: #544aca; }

.btn-outline { background-color: transparent; border-color: var(--cinza-border); color: var(--cinza-texto); }
.btn-outline:hover { background-color: var(--cinza-fundo); }

/* =========================================
   4. BADGES (ETIQUETAS)
   ========================================= */
.badge {
    padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; display: inline-block; letter-spacing: 0.5px;
}
.badge-success { background-color: var(--sucesso); color: white; }
.badge-warning { background-color: var(--aviso); color: white; }
.badge-danger { background-color: var(--erro); color: white; }
.badge-info { background-color: var(--info); color: white; }
.badge-gray { background-color: var(--cinza-muted); color: white; }

/* =========================================
   5. ALERTAS (MENSAGENS)
   ========================================= */
.alert { padding: 15px; border-radius: var(--raio-md); margin-bottom: 20px; border: 1px solid transparent; font-size: 0.95rem; }
.alert-success { background-color: var(--sucesso-fundo); border-color: #bbf7d0; color: #166534; }
.alert-danger { background-color: var(--erro-fundo); border-color: #fecaca; color: #b91c1c; }
.alert-warning { background-color: var(--aviso-fundo); border-color: #fde68a; color: #b45309; }
.alert-info { background-color: var(--info-fundo); border-color: #bae6fd; color: #0369a1; }

/* =========================================
   6. CARDS E WIDGETS
   ========================================= */
.card { 
    background: var(--branco); 
    border-radius: var(--raio-lg); 
    box-shadow: var(--sombra-suave); 
    border: 1px solid var(--cinza-claro); 
    margin-bottom: 25px; 
    overflow: visible; /* MUDAMOS AQUI: de hidden para visible */
}

.card-header { 
    padding: 20px 25px; 
    border-bottom: 1px solid var(--cinza-claro); 
    font-weight: 800; 
    color: var(--azul-primario); 
    font-size: 1.1rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    /* Adicionado para manter a borda redonda já que o card é visible */
    border-top-left-radius: calc(var(--raio-lg) - 1px);
    border-top-right-radius: calc(var(--raio-lg) - 1px);
}

.card-body { padding: 25px; }

/* Stat Cards (Métricas) */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 25px; margin-bottom: 35px; }

.stat-card {
    background: var(--branco); padding: 25px; border-radius: var(--raio-md);
    border: 1px solid var(--cinza-claro); border-left: 5px solid var(--vermelho-header);
    box-shadow: var(--sombra-suave); margin-bottom: 20px; transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card-danger { border-left-color: var(--erro); }
.stat-card-success { border-left-color: var(--sucesso); }
.stat-title { font-size: 0.85rem; color: var(--cinza-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }

/* Empty States */
.empty-state { text-align: center; padding: 40px 20px; background-color: var(--cinza-fundo); border-radius: var(--raio-md); }
.empty-state-icon { font-size: 3rem; opacity: 0.5; margin-bottom: 15px; }

/* =========================================
   7. TABELAS (DASHBOARD)
   ========================================= */
.table-responsive { 
    background: white; 
    border-radius: var(--raio-lg); 
    border: 1px solid var(--cinza-claro); 
    overflow: visible; /* Permite o menu vazar a tabela no PC */
}

@media (max-width: 992px) { 
    .table-responsive { 
        overflow-x: auto; 
        padding-bottom: 60px; /* Dá espaço pro menu no celular */
    } 
}
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { background: var(--cinza-fundo); color: var(--cinza-texto); font-weight: 700; padding: 15px 20px; border-bottom: 1px solid var(--cinza-claro); text-transform: uppercase; font-size: 0.75rem; }
.table td { padding: 15px 20px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:hover td { background-color: var(--cinza-fundo); }
.table tfoot td { background-color: var(--cinza-fundo); border-top: 2px solid var(--cinza-claro); font-weight: bold; }

/* Protocolo Visual */
.protocolo-badge { background: var(--cinza-fundo); color: var(--cinza-texto); font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--cinza-claro); display: inline-block; margin-bottom: 5px; }

/* =========================================
   8. INPUTS E FORMULÁRIOS
   ========================================= */
.form-group { margin-bottom: 1.2rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; color: var(--cinza-texto); }
.form-control { width: 100%; padding: 0.85rem 1rem; border: 1px solid var(--cinza-claro); border-radius: var(--raio-md); font-size: 1rem; background-color: var(--cinza-fundo); transition: all 0.2s ease; }
.form-control:focus { outline: none; border-color: var(--azul-destaque); background-color: #fff; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); }

/* =========================================
   9. DROPDOWNS E MODAIS (Reaproveitado)
   ========================================= */
/* Dropdown base que fizemos antes */
.dropdown-container { position: relative; display: inline-block; }
.dropdown-menu { display: none; position: absolute; right: 0; top: 110%; background: #fff; min-width: 200px; box-shadow: var(--sombra-media); border-radius: var(--raio-md); border: 1px solid var(--cinza-claro); z-index: 999; }
.dropdown-menu.show { display: block; animation: fadeIn 0.15s ease-out; }
.dropdown-item { padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--cinza-texto); text-decoration: none; border-bottom: 1px solid #f1f5f9; transition: background 0.2s; cursor: pointer; border:none; width: 100%; text-align: left; background: none; }
.dropdown-item:hover { background: var(--cinza-fundo); color: var(--azul-primario); padding-left: 20px; }
.dropdown-item.danger { color: var(--erro); }
.dropdown-item.danger:hover { background: var(--erro-fundo); color: #dc2626; }

/* Modais base */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 9999; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal-content { background: #fff; padding: 30px; border-radius: var(--raio-lg); max-width: 400px; width: 90%; text-align: center; box-shadow: var(--sombra-media); animation: fadeIn 0.3s ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* GRIDS BASE */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 25px; }
.grid-2-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.grid-3 { display: grid; grid-template-columns: 3fr 1fr; gap: 25px; }
@media (max-width: 992px) { .grid-2 { grid-template-columns: 1fr; } }


/* =========================================
   ESTRUTURA BASE (LAYOUT)
   ========================================= */
.main-content {
    flex: 1; /* Faz o conteúdo empurrar o footer para o final da tela */
    width: 100%;
    padding-bottom: 50px;
}

.dashboard-container { 
    width: 100%;
    max-width: 1300px; 
    margin: 40px auto; 
    padding: 0 20px; 
}

/* =========================================
   HEADER (COM EFEITO GLASS)
   ========================================= */
.main-header {
    background-color: var(--vermelho-header); /* Usa a cor primária com transparência */
    backdrop-filter: blur(10px);
    color: var(--branco);
    position: relative;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.header-container {
    width: 100%; 
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 30px;
    height: 75px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.logo-area h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: 0.5px; margin: 0; }
.logo-icon { font-size: 1.5rem; }

/* Navegação do Menu Principal */
.main-nav ul { 
    list-style: none; display: flex; gap: 20px; align-items: center; margin: 0; padding: 0; 
}
.main-nav a { 
    color: var(--branco); 
    text-decoration: none; 
    font-size: 0.95rem;
    font-weight: normal; 
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: var(--raio-sm);
}
.main-nav a:hover { 
    color: var(--branco); 
    background-color: rgba(255,255,255,0.05); 
}

/* Perfil e Botão de Sair no Header */
.user-profile {
    border-left: 1px solid rgba(255,255,255,0.1); 
    padding-left: 20px; margin-left: 10px;
    display: flex; align-items: center; gap: 10px;
}
.user-profile span { font-weight: 600; font-size: 0.95rem; }

.btn-sair { color: #f87171 !important; }
.btn-sair:hover { 
    background-color: rgba(239, 68, 68, 0.1) !important; 
    color: #fca5a5 !important; 
}

/* Ícone de Menu para Celulares */
.menu-mobile-icon { display: none; font-size: 1.8rem; cursor: pointer; color: var(--branco); }

/* =========================================
   FOOTER
   ========================================= */
.main-footer { 
    background-color: var(--vermelho-header); /* Um tom ainda mais escuro que o primário */
    color: var(--branco); 
    text-align: center; 
    padding: 25px; 
    width: 100%; 
    margin-top: auto; 
    font-size: 0.9rem; 
}

/* =========================================
   RESPONSIVIDADE DO MENU (CELULAR)
   ========================================= */
@media (max-width: 768px) {
    .menu-mobile-icon { display: block; }
    .header-container { padding: 0 20px; height: 70px; }
    
    .main-nav { 
        position: absolute; top: 70px; left: 0; width: 100%; 
        background-color: rgba(30, 41, 59, 0.98); backdrop-filter: blur(10px); 
        flex-direction: column; display: none; 
        border-top: 1px solid rgba(255,255,255,0.05); 
        box-shadow: 0 10px 20px rgba(0,0,0,0.2); 
    }
    .main-nav.active { display: flex; }
    .main-nav ul { flex-direction: column; width: 100%; gap: 0; padding: 10px 0; }
    .main-nav li { width: 100%; text-align: center; }
    .main-nav a { display: block; padding: 15px; border-radius: 0; }
    
    .user-profile { 
        border-left: none; flex-direction: column; gap: 10px; 
        padding: 20px; background: rgba(0,0,0,0.2); margin: 0; 
    }
}


/* =========================================
   10. FORMULÁRIO DE COLETA (INTERATIVO)
   ========================================= */
.progresso-container { height: 8px; background: var(--cinza-claro); border-radius: 4px; margin-bottom: 25px; overflow: hidden; }
.progresso-barra { height: 100%; background: var(--azul-destaque); transition: width 0.3s ease; }

/* Botões de Múltipla Escolha */
.opcoes-container { display: flex; gap: 10px; flex-wrap: wrap; }
.opcao-item { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 15px; border-radius: var(--raio-md); cursor: pointer; font-weight: 700; color: white; text-transform: uppercase; font-size: 0.9rem; transition: all 0.2s; background-color: var(--cinza-muted); border: 2px solid transparent; text-align: center; }
.opcao-item input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.opcao-item:has(input:checked) { transform: scale(1.02); box-shadow: var(--sombra-media); border-color: white; z-index: 10; background-color: var(--azul-destaque) !important; }
.opcao-item:hover { opacity: 0.9; transform: translateY(-2px); }

/* Escala 0 a 10 */
.escala-10-container { display: flex; width: 100%; gap: 5px; margin-bottom: 5px; }
.escala-10-item { flex: 1; position: relative; cursor: pointer; }
.escala-10-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.escala-btn { display: flex; align-items: center; justify-content: center; height: 45px; color: white; font-weight: bold; border-radius: var(--raio-sm); font-size: 1.1rem; transition: all 0.2s; }
.escala-10-item input:checked + .escala-btn { transform: scale(1.15); box-shadow: 0 4px 10px rgba(0,0,0,0.3); z-index: 10; border: 2px solid #fff; }

/* Cores da Escala (Verde, Amarelo, Vermelho) */
.psr-g { background-color: var(--sucesso); }
.psr-a { background-color: var(--aviso); }
.psr-v { background-color: var(--erro); }
.legendas-escala { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--cinza-muted); font-weight: 700; text-transform: uppercase; margin-top: 8px; }

/* =========================================
   11. RELATÓRIOS E RESULTADOS
   ========================================= */
.header-paciente { background: var(--azul-primario); color: white; text-align: center; padding: 30px; border-radius: var(--raio-lg); margin-bottom: 25px; box-shadow: var(--sombra-suave); }
.grid-resultados { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1px; background-color: var(--cinza-claro); border: 1px solid var(--cinza-claro); border-radius: var(--raio-md); overflow: hidden; margin-bottom: 25px;}
.grid-item { background: white; padding: 20px; font-size: 0.95rem; display: flex; justify-content: space-between; align-items: center; }

/* Exibição Visual da Escala no Relatório */
.escala-container { display: flex; gap: 4px; margin-top: 5px; margin-bottom: 15px; }
.escala-display-item { flex: 1; height: 35px; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; border-radius: 4px; font-size: 0.9rem; }
.escala-ativo { transform: scale(1.1); box-shadow: var(--sombra-suave); z-index: 2; border: 2px solid #fff;}
.escala-inativo { opacity: 0.3; transform: scale(0.95); }


/* Cores da Escala (Verde, Amarelo, Vermelho) */
.psr-g, .pse-g { background-color: var(--sucesso); }
.psr-a, .pse-a { background-color: var(--aviso); }
.psr-v, .pse-v { background-color: var(--erro); }


/* =========================================
   3. LOGIN E CADASTRO (SLEEK UI)
   ========================================= */
.centralizar-tela { display: flex; justify-content: center; align-items: center; min-height: 85vh; padding: 20px; }

.login-container {
    background-color: var(--branco); 
    padding: 3rem 2.5rem; 
    border-radius: 16px;
    box-shadow: var(--sombra-media); 
    width: 100%; max-width: 420px;
    border-top: 6px solid var(--vermelho-header);
}

h2 { color: var(--azul-primario); text-align: center; margin-bottom: 1.8rem; font-weight: 800; font-size: 1.5rem; }

.input-group {  }
.input-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; color: #475569; }
.input-group input, .input-group select {
    width: 100%; padding: 0.85rem 1rem; 
    border: 1px solid var(--cinza-claro); 
    border-radius: 8px; font-size: 1rem; 
    background-color: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
}
.input-group input:focus, .input-group select:focus { 
    outline: none; 
    border-color: var(--azul-destaque); 
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); 
}

.btn-login {
    width: 100%; padding: 0.85rem; 
    background-color: var(--azul-destaque); color: white; 
    border: none; border-radius: 8px; font-size: 1rem;
    font-weight: 700; cursor: pointer; 
    transition: all 0.2s; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}
.btn-login:hover { background-color: var(--azul-hover); transform: translateY(-1px); box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4); }

.msg-erro { color: #b91c1c; background: #fef2f2; padding: 12px; border-radius: 8px; margin-bottom: 15px; text-align: center; font-size: 0.9rem; border: 1px solid #fecaca; }
.msg-sucesso { color: #047857; background: #ecfdf5; padding: 12px; border-radius: 8px; margin-bottom: 15px; text-align: center; font-size: 0.9rem; border: 1px solid #a7f3d0; }


.search-box { position: relative; flex: 1; max-width: 400px; }
.search-box input { width: 100%; padding: 12px 15px 12px 45px; border: 1px solid var(--cinza-claro); border-radius: 50px; font-size: 0.95rem; background: #fff; transition: all 0.2s; }
.search-box input:focus { outline: none; border-color: var(--azul-destaque); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 1.1rem; }


.action-buttons-wrapper{display: flex; gap: 15px;}


.flex-end{justify-content: flex-end}
.link-input-group { display: flex; gap: 10px; margin-top: 15px; background: #f8fafc; padding: 8px; border-radius: 8px; border: 1px solid var(--cinza-claro); }
.link-input-group input { flex: 1; border: none; background: transparent; font-family: 'Courier New', monospace; font-size: 1rem; color: #334155; outline: none; padding-left: 10px; }


.termos .btn{max-height: 42px; align-items: flex-start;}