/* assets/css/main.css - Estilos Globais e Variáveis */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --glass: rgba(255, 255, 255, 0.85);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    
    /* Cores da Bandeira de Duque de Caxias */
    --caxias-green: #009246;
    --caxias-red: #CE1126;
    --caxias-white: #ffffff;
    
    --bg-gradient: linear-gradient(135deg, rgba(0, 146, 70, 0.05) 0%, rgba(255, 255, 255, 1) 50%, rgba(206, 17, 38, 0.05) 100%);
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: #1e293b;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Municipal Flag Background Animation */
.flag-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: 
        linear-gradient(135deg, var(--caxias-green) 0%, transparent 40%),
        linear-gradient(315deg, var(--caxias-red) 0%, transparent 40%);
    opacity: 0.12;
    pointer-events: none;
}

/* Background Image Slider */
.bg-slider {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    overflow: hidden;
    pointer-events: none;
}

.bg-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2s ease-in-out, transform 10s linear;
    transform: scale(1.1);
}

.bg-slide.active {
    opacity: 0.2;
    transform: scale(1);
}

.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(255,255,255,0.4) 100%);
    z-index: -2;
    pointer-events: none;
}

/* Glassmorphism System */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.08); /* Borda levemente mais escura para definição */
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px -15px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3); /* Contorno leve na cor primária */
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 20px;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.hero-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 20px;
}

.section-title {
    position: relative;
    padding-left: 20px;
    margin-bottom: 30px;
    font-weight: 700;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 30px;
    background: var(--primary);
    border-radius: 10px;
}

/* Button Legibility Fixes */
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    border-radius: 12px;
}

.btn-primary:hover, .btn-primary:active, .btn-primary.active {
    color: #ffffff !important;
    background: var(--primary-gradient) !important;
    border-color: transparent !important;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-danger:hover, .btn-danger:active, .btn-danger.active {
    color: #fff !important;
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.btn-success:hover, .btn-success:active, .btn-success.active {
    color: #fff !important;
    background-color: #059669 !important;
    border-color: #059669 !important;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary.active {
    color: #fff !important;
    background-color: var(--primary) !important;
}

/* Evolution Charts Styles */
.chart-card {
    min-height: 400px;
}

.chart-legend {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Animations */
.floating-icon {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Scrollbar Customization */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Custom Tabs / Nav Pills */
.nav-pills .nav-link {
    color: var(--secondary);
    font-weight: 600;
    transition: all 0.3s;
    border-radius: 12px;
    padding: 10px 20px;
}

.nav-pills .nav-link:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
}

.nav-pills .nav-link.active {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* Premium Dashboard System (Padrão SICONFI/Tesouro) */

.premium-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 24px;
    color: white;
    padding: 20px 35px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
}

.premium-header::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: var(--caxias-red);
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
}

.premium-badge {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(5px);
    color: white;
    padding: 5px 15px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    border: 1px solid rgba(255,255,255,0.1);
}

.kpi-card {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 25px;
    border: 1px solid rgba(0,53,128,0.08);
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
}

.kpi-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,53,128,0.1);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.kpi-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 2px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.section-title-premium {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 2px solid rgba(0,53,128,0.08);
    padding-bottom: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .premium-header {
        padding: 20px 15px !important;
        border-radius: 16px !important;
    }
    .premium-header .d-none.d-md-block,
    .premium-header i.bi:not(.premium-badge i):not(h1 i):not(.btn i) {
        display: none !important;
    }
    .kpi-card {
        padding: 15px !important;
        border-radius: 16px !important;
    }
    .kpi-value {
        font-size: 1.25rem !important;
    }
    .display-3 {
        font-size: 2.2rem !important;
    }
    .display-4 {
        font-size: 1.8rem !important;
    }
    .hero-badge {
        font-size: 0.7rem !important;
        padding: 6px 12px !important;
    }
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    .navbar-brand img {
        height: 24px !important;
    }
    .section-title-premium {
        font-size: 0.65rem !important;
        letter-spacing: 1px !important;
    }
    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    .table-responsive {
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
    }
    .table thead th {
        padding: 10px !important;
        font-size: 0.7rem !important;
    }
    .table tbody td {
        padding: 10px !important;
        font-size: 0.8rem !important;
    }

    /* Gráficos em Mobile */
    .chart-container {
        height: 260px !important; /* Altura otimizada para caber na tela sem scroll */
    }
    .chart-card {
        min-height: auto !important;
        padding: 15px !important;
    }

    /* Listas e Registros */
    .list-research-item {
        padding: 12px !important;
    }
    .list-research-item .fw-bold {
        font-size: 0.85rem !important;
    }
    .list-research-item .badge {
        font-size: 0.5rem !important;
    }
    
    /* Filtros DataTables e Formulários */
    .filter-section {
        padding: 12px !important;
        border-radius: 12px !important;
    }
    .filter-section form .col-md-3,
    .filter-section form .col-md-2 {
        margin-bottom: 8px; /* Espaçamento quando os filtros quebram linha */
    }
    
    .dataTables_wrapper .row {
        margin-bottom: 10px;
    }
    .dataTables_filter {
        text-align: left !important;
        margin-top: 10px;
    }
    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        display: block !important;
        margin-top: 5px;
    }
    .dataTables_length {
        text-align: left !important;
    }
    div.dataTables_wrapper div.dataTables_info {
        font-size: 0.75rem;
        text-align: center !important;
        padding-top: 15px;
    }
    div.dataTables_wrapper div.dataTables_paginate {
        text-align: center !important;
        margin-top: 15px;
    }
    .pagination {
        justify-content: center !important;
    }
    
    /* Cards Adicionais (Panorama, Diárias, Glass) */
    .glass-card {
        padding: 15px !important;
        border-radius: 16px !important;
    }
    .glass-card h5 {
        font-size: 1rem !important;
        margin-bottom: 15px !important;
    }
}

/* Premium Tables System */
.table-premium-container {
    border-radius: 20px;
    overflow: hidden;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

.table.table-premium thead th {
    background-color: rgba(99, 102, 241, 0.05);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 18px 25px;
    border-bottom: none;
    white-space: nowrap;
}

.table.table-premium tbody td {
    padding: 18px 25px;
    vertical-align: middle;
    color: #4b5563;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

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

.table.table-premium .item-title {
    color: #1e293b;
    font-weight: 700;
    font-size: 0.9rem;
    display: block;
}

.table.table-premium .item-subtitle {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Transformação de Tabelas em Cards para Mobile */
@media (max-width: 767px) {
    .table-mobile-cards {
        border: none !important;
        background: transparent !important;
    }
    .table-mobile-cards thead {
        display: none !important;
    }
    .table-mobile-cards tbody tr {
        display: block !important;
        background: rgba(255, 255, 255, 0.7) !important;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 16px !important;
        margin-bottom: 15px !important;
        padding: 15px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
        width: 100% !important;
        max-width: 344px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .table-mobile-cards tbody td {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        border: none !important;
        padding: 8px 0 !important;
        position: relative;
    }
    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        font-weight: 800;
        color: #94a3b8;
        text-transform: uppercase;
        margin-bottom: 4px;
        letter-spacing: 0.5px;
    }
    .table-mobile-cards .dataTables_wrapper .dataTables_length,
    .table-mobile-cards .dataTables_wrapper .dataTables_filter {
        text-align: center !important;
        margin-bottom: 10px;
    }
}
