@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* --- DESIGN SYSTEM / VARIÁVEIS --- */
:root {
    --font-primary: 'Outfit', sans-serif;
    
    /* Cores */
    --bg-app: #f1f5f9; /* Slate 100 */
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a; /* Slate 900 */
    --bg-sidebar-hover: #1e293b; /* Slate 800 */
    
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    --text-muted: #94a3b8; /* Slate 400 */
    --text-light: #f8fafc; /* Slate 50 */
    
    --primary: #0f766e; /* Teal 700 - Cor Política Elegante e Sóbria */
    --primary-hover: #0d9488; /* Teal 600 */
    --primary-glow: rgba(15, 118, 110, 0.15);
    
    --accent: #0284c7; /* Sky 600 */
    --accent-hover: #0369a1;
    
    --border-color: #e2e8f0; /* Slate 200 */
    --border-focus: #38bdf8; /* Sky 400 */
    
    --success: #10b981; /* Emerald 500 */
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    
    --danger: #ef4444; /* Red 500 */
    --danger-bg: #fef2f2;
    --danger-border: #fca5a5;
    
    /* Sombra e Bordas */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Transições */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- RESET & CONFIGS BÁSICAS --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- TELA DE LOGIN (INDEX.PHP) --- */
.login-body {
    background: radial-gradient(circle at 10% 20%, rgb(15, 23, 42) 0%, rgb(15, 118, 110) 90.1%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateY(0);
    transition: var(--transition-normal);
    animation: fadeIn 0.6s ease-out;
}

.login-header {
    background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--primary) 100%);
    padding: 40px 30px;
    text-align: center;
    color: var(--text-light);
    position: relative;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header p {
    font-size: 0.95rem;
    opacity: 0.85;
}

.regions-badge {
    margin-top: 15px;
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.login-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.login-tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 18px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
    border-bottom: 3px solid transparent;
}

.login-tab-btn:hover {
    color: var(--primary);
    background-color: rgba(15, 118, 110, 0.02);
}

.login-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: var(--bg-card);
}

.login-content {
    padding: 35px 30px;
}

.login-form-panel {
    display: none;
    animation: tabFade 0.4s ease;
}

.login-form-panel.active {
    display: block;
}

/* --- COMPONENTES DE FORMULÁRIO --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px 12px 42px;
    font-size: 0.95rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #f8fafc;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-light);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

/* --- FEEDBACKS / ALERTAS --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

/* --- LAYOUT DO PAINEL (DASHBOARD) --- */
.dashboard-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header {
    margin-bottom: 40px;
}

.sidebar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.sidebar-brand span {
    color: #14b8a6; /* Turquesa */
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    flex-grow: 1;
}

.sidebar-menu-item {
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-link:hover {
    color: var(--text-light);
    background-color: var(--bg-sidebar-hover);
}

.sidebar-link.active {
    color: var(--text-light);
    background-color: var(--primary);
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 20px;
}

.user-info-sidebar {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.user-info-sidebar strong {
    color: var(--text-light);
    display: block;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fda4af; /* Rose 300 */
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
}

.sidebar-logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ÁREA PRINCIPAL */
.main-content {
    padding: 40px;
    overflow-y: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.main-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.main-header-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* CARDS DE ESTATÍSTICA (KPIs) */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.metric-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-normal);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(15, 118, 110, 0.2);
}

.metric-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    background-color: var(--primary-glow);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* GRID PRINCIPAL DE CONTEÚDO */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.content-grid-full {
    grid-template-columns: 1fr !important;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fafafa;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* --- TABELAS --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.table-custom th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-custom td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.table-custom tbody tr:hover td {
    background-color: #f8fafc;
    color: var(--text-primary);
}

/* RANKING BADGES */
.ranking-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
}

.rank-1 {
    background-color: #fef08a; /* Amarelo ouro */
    color: #854d0e;
    border: 1.5px solid #facc15;
}

.rank-2 {
    background-color: #e2e8f0; /* Prata */
    color: #475569;
    border: 1.5px solid #cbd5e1;
}

.rank-3 {
    background-color: #ffedd5; /* Bronze */
    color: #c2410c;
    border: 1.5px solid #fdba74;
}

.rank-default {
    background-color: #f1f5f9;
    color: #64748b;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-valid {
    background-color: #dcfce7;
    color: #166534;
}

.status-review {
    background-color: #fef3c7;
    color: #92400e;
}

/* --- RESPONSIVIDADE MOBILE --- */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .sidebar-menu {
        display: none; /* Em sistemas mobile reais você usaria um menu sanduíche. Aqui vamos manter simples ou empilhado */
    }
    
    .main-content {
        padding: 20px;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* --- ANIMAÇÕES --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tabFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* --- SUBTABELAS / REDE DE AMIGOS --- */
.network-row {
    background-color: #f8fafc;
    border-bottom: 2px solid var(--border-color);
}

.network-row td {
    padding: 0 !important;
}

.network-details {
    padding: 20px 24px;
    border-left: 4px solid var(--primary);
    animation: tabFade 0.3s ease;
}

.network-details h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
}

.btn-outline-primary {
    background: none;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: var(--text-light);
}

.subtable {
    width: 100%;
    margin-top: 10px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.subtable th {
    background-color: #f1f5f9;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.subtable td {
    padding: 10px 14px;
    font-size: 0.85rem;
}

.clickable-row {
    cursor: pointer;
    transition: var(--transition-fast);
}

.clickable-row:hover {
    background-color: #f8fafc;
}

/* --- ESTILOS DE AÇÃO E BOTÕES ADICIONAIS --- */
.btn-danger-small {
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-danger-small:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action-small {
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.btn-edit-small {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-edit-small:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.2);
}

.btn-export-small {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-export-small:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

.btn-review-small {
    background-color: #f59e0b;
    color: #ffffff;
}

.btn-review-small:hover {
    background-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.btn-print {
    background-color: var(--accent);
    color: var(--text-light);
    width: auto;
    display: inline-flex;
    padding: 8px 16px;
    margin-bottom: 20px;
}

.btn-print:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* --- CONFIGURAÇÕES DE IMPRESSÃO --- */
@media print {
    body, html {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 10pt !important;
    }
    
    .sidebar, 
    .main-header, 
    .alert, 
    .metrics-grid, 
    .card-header, 
    .btn, 
    .btn-small,
    .btn-print,
    .btn-danger-small,
    form, 
    .sidebar-footer, 
    .sidebar-top {
        display: none !important;
    }
    
    .dashboard-container {
        display: block !important;
        grid-template-columns: 1fr !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    
    .table-custom {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    .table-custom th, 
    .table-custom td {
        border: 1px solid #94a3b8 !important;
        color: #000000 !important;
        padding: 8px 12px !important;
    }
    
    .network-row {
        display: table-row !important;
    }
    
    .network-details {
        border-left: none !important;
        padding: 10px 0 !important;
    }
    
    .subtable {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    .subtable th, 
    .subtable td {
        border: 1px solid #cbd5e1 !important;
        color: #000000 !important;
        padding: 6px 10px !important;
    }
}
