/* ==========================================================================
   PORTAL.CSS - Estilo Unificado do Sistema de Gestão (AD Rodovia A)
   ========================================================================== */

/* --- 1. RESET E BASE --- */
:root {
    --primary-dark: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --red:    #ef4444;
    --green:  #22c55e;
    --blue:   #3b82f6;
    --orange: #f97316;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* --- 2. LAYOUT E SIDEBAR --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.12);
    transition: left 0.28s ease;
}

.sidebar-header {
    padding: 1.4rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.sidebar-menu {
    flex: 1;
    padding: 0.8rem 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.4rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 4px solid transparent;
}

.menu-item:hover,
.menu-item.active {
    background-color: var(--primary-light);
    color: white;
}

.menu-item.active {
    border-left-color: var(--accent);
}

.menu-icon {
    margin-right: 14px;
    font-size: 22px !important;
    opacity: 0.85;
}

/* --- 3. CONTEÚDO PRINCIPAL --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 1.8rem;
    width: calc(100% - 260px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.8rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.55rem;
    color: var(--text-main);
    margin: 0;
}

/* --- 4. CARDS E DASHBOARD --- */
.card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.4rem;
    margin-bottom: 2rem;
}

.dash-card {
    background: white;
    border-radius: 8px;
    padding: 1.4rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08);
    border-left-width: 5px;
    border-left-style: solid;
    transition: transform 0.18s ease;
}

.dash-card:hover {
    transform: translateY(-3px);
}

.dash-list li {
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.92rem;
    gap: 1rem;
}

.dash-list li:last-child { border-bottom: none; }

/* --- 5. TABELAS DE DADOS --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
    min-width: 640px;
}

/* --- 6. FORMULÁRIOS E INPUTS --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.2rem;
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.2rem; }

/* Campo padrão (curto) */
.form-group {
    grid-column: span 4; /* 3 campos por linha */
}

/* Campo médio */
.form-group.medium {
    grid-column: span 6; /* 2 por linha */
}

/* Campo longo */
.form-group.long-field {
    grid-column: span 12; /* linha inteira */
}


.form-group { margin-bottom: 1.2rem; }


.form-input, select.form-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.96rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-input:focus, select.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* --- 7. BOTÕES --- */
.btn {
    padding: 0.65rem 1.3rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.96rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover { background-color: #2563eb; }

/* --- 8. MODAIS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 820px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.14);
}

.panel-title {
    padding: 1.4rem 1.6rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.28rem;
    font-weight: 700;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-card form {
    padding: 1.6rem;
}

/* ────────────────────────────────────────────────
   RESPONSIVIDADE - MELHORIAS PARA TELAS MENORES
───────────────────────────────────────────────── */

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 4px;
    left: 8px;
    z-index: 1250;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.7rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    align-items: center;
    justify-content: center;
}

/* Esconde botão quando sidebar aberta */
.sidebar.open ~ .mobile-menu-btn {
    display: none !important;
}

/* ── Muito pequeno (< 480px) ── */
@media (max-width: 480px) {
    body { font-size: 14.5px; }
    
    .main-content {
        padding: 1rem;
        padding-top: 70px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header h2 { font-size: 1.4rem; }
    
    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
    }
    
    .form-input,
    .form-group label {
        font-size: 0.94rem;
    }
    
    .modal-card {
        max-width: 96%;
    }
}

/* ── Mobile pequeno / médio (≤ 640px) ── */
@media (max-width: 640px) {
    .sidebar {
        width: 82%;
        max-width: 300px;
        left: -100%;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100%;
        padding: 1.2rem;
        padding-top: 80px !important;
        padding-bottom: 2rem;
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }
}

/* ── Tablet pequeno / mobile grande (641–820px) ── */
@media (min-width: 641px) and (max-width: 820px) {
    .sidebar { width: 240px; }
    .main-content { margin-left: 240px; width: calc(100% - 240px); padding: 1.6rem; }
    
    .dashboard-row { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
    
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ── Desktop pequeno (821–1024px) ── */
@media (min-width: 821px) and (max-width: 1024px) {
    .sidebar { width: 240px; }
    .main-content { margin-left: 240px; width: calc(100% - 240px); padding: 1.8rem; }
    
    .dashboard-row { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
}

/* ── Desktop médio/grande (acima de 1024px) ── */
@media (min-width: 1025px) {
    .dashboard-row { grid-template-columns: repeat(3, 1fr); }
}

/* ────────────────────────────────────────────────
   ESTILOS ESPECÍFICOS PARA "MEUS DADOS" NO PAINEL DO MEMBRO
───────────────────────────────────────────────── */

.valor-box {
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 2.2rem;          /* padrão compacto para campos normais */
    line-height: 1.45;
    color: #1e293b;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Somente FILHOS e CARGO ganham mais espaço */
.form-group.long-field .valor-box {
    min-height: 2.8rem;
    padding: 0.8rem 1rem;
}

/* Bullets alinhados corretamente */
.valor-box.special span {
    display: block;
    margin: 0.2rem 0;
    padding-left: 1.4rem;
    text-indent: -1.4rem;
}

/* Mobile: ajuste fino */
@media (max-width: 768px) {
    .valor-box {
        padding: 0.6rem 0.9rem;
        font-size: 0.93rem;
        min-height: 2.1rem;
    }

    .form-group.long-field .valor-box {
        min-height: 3rem;
        padding: 0.75rem 1rem;
    }

    .valor-box.special span {
        margin: 0.25rem 0;
        padding-left: 1.6rem;
        text-indent: -1.6rem;
    }
}

/* ────────────────────────────────────────────────
   OUTROS ESTILOS (mantidos exatamente como estavam)
───────────────────────────────────────────────── */

/* Cards unificados para membros e agenda (desktop + mobile) */
.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.4rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .card-list {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
}

.member-card, .agenda-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.member-card:hover, .agenda-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.card-header {
    padding: 1.2rem 1.4rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.card-header strong {
    font-size: 1.1rem;
    color: var(--text-main);
}

.card-body {
    padding: 1.2rem 1.4rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.card-body div {
    margin-bottom: 0.6rem;
}

.card-body strong {
    color: var(--text-main);
    margin-right: 0.5rem;
}

.card-actions {
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.card-actions .btn-icon {
    font-size: 1.3rem;
    padding: 0.5rem;
}

/* Estilo empty-msg */
.empty-msg {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Melhor estilização do botão fechar modal */
.btn-close-modal {
    font-size: 2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    color: #64748b;
    background: rgba(226, 232, 240, 0.6);
}

.btn-close-modal:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    transform: rotate(90deg);
}

/* Overlay da sidebar mais confiável */
#sidebar-overlay {
    z-index: 995 !important;
}

.sidebar {
    z-index: 1000 !important;
}

/* Apenas FILHOS e CARGO ganham mais espaço e estilo de lista */
.form-group.long-field .valor-box {
    min-height: 2.6rem;             /* altura confortável para listas */
    padding: 0.7rem 1rem;
}

/* Bullets alinhados perfeitamente */
.valor-box.special {
    padding-left: 0.5rem;
}

.valor-box.special br + span,
.valor-box.special span {
    display: block;
    margin: 0.15rem 0;
    padding-left: 1.4rem;
    text-indent: -1.4rem;
}

/* Mobile: ainda mais compacto nos campos normais */
@media (max-width: 768px) {
    .valor-box {
        padding: 0.55rem 0.9rem;
        min-height: 1.9rem;
        font-size: 0.93rem;
    }

    .form-group.long-field .valor-box {
        min-height: 3rem;
        padding: 0.7rem 1rem;
    }

    .valor-box.special span {
        margin: 0.2rem 0;
        padding-left: 1.6rem;
        text-indent: -1.6rem;
    }
}
@media (max-width: 768px) {
    .form-group,
    .form-group.medium,
    .form-group.long-field {
        grid-column: span 12;
    }
}

/* Barra de Título das Seções */
.section-title-bar {
    grid-column: span 12;
    text-align: center;
    margin-top: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1.2px;
}

/* Centralização dos Títulos dos Campos */
.form-group label {
    display: block;
    text-align: center;
    margin-bottom: 0.6rem;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Container que segura o dado */
.valor-box {
    display: flex;
    flex-direction: column; /* Organiza pílulas uma abaixo da outra se houver várias */
    align-items: center;    /* Centraliza horizontalmente */
    justify-content: center; 
    padding: 0.5rem;
    background: transparent;
    min-height: 50px;
}

/* O "Padrão Filhos" aplicado a todos: a Pill (Pílula) */
.data-pill {
    display: inline-block;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-bottom: 3px solid #cbd5e1;
    padding: 8px 25px;
    border-radius: 50px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 1rem;
    text-align: center;
    margin: 4px 0;
    width: fit-content;
    min-width: 200px; /* Aumentado levemente para melhor equilíbrio visual */
}

/* Responsividade Mobile */
@media (max-width: 640px) {
    .form-group { grid-column: span 12 !important; }
    .data-pill {
        min-width: 100%;
        font-size: 0.95rem;
    }
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 3px solid var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: bold;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-dark);
}

/* Cabeçalho do Mês no Estilo do Desenho */
.month-header {
    grid-column: 1 / -1; /* Ocupa a largura toda do grid de cards */
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin: 2rem 0 1rem 0;
    padding-bottom: 8px;
    border-bottom: 4px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.agenda-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--red);
    transition: 0.2s;
}

.card-content { display: flex; flex-direction: column; gap: 4px; }

.btn-del {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
}

.install-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border-bottom: 2px solid #3b82f6;
    transition: 0.3s ease-in-out;
}

.install-content { display: flex; align-items: center; gap: 12px; }

.install-text { display: flex; flex-direction: column; }
.install-text strong { font-size: 0.95rem; }
.install-text span { font-size: 0.8rem; opacity: 0.8; }

.btn-install-now {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-dismiss {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 10px;
}

.hidden { display: none !important; }

/* Cooperadores */
/* Estilo dos Badges de Status */
.badge-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* Estilo da Linha do Tempo de Aprovação */
.approval-history p {
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #475569;
}

/* Botões pequenos para ações rápidas */
.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    margin-right: 5px;
    transition: 0.2s;
}

.btn-success { background: #dcfce7; color: #15803d; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-primary { background: #dbeafe; color: #1d4ed8; }

.btn-small:hover { filter: brightness(0.9); }

#lista-liderados-modal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    padding: 10px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Ajuste para botões ativos quando o fundo é claro */
.nav-container .nav-button.active {
    background: var(--primary-dark);
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-button {
    color: var(--primary-dark); /* Cor do texto não-ativo */
    font-weight: 600;
}

/* --- NAVEGAÇÃO ESTILO EBD (Unificada) --- */
.nav-cooperador {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.nav-container-cooperador {
    background: rgba(15, 23, 42, 0.05); /* Cinza bem clarinho translúcido */
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.35rem;
    display: flex;
    gap: 5px;
}

.nav-btn-cooperador {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.6rem 1.4rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-btn-cooperador:hover {
    background: rgba(15, 23, 42, 0.1);
}

/* Botão Ativo: Fundo escuro e texto branco */
.nav-btn-cooperador.active {
    background: var(--primary-dark);
    color: white !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}
