/* SADE v4.1 - Custom Stylesheet */

:root {
    --sade-primary: #2563eb;
    --sade-secondary: #1e40af;
    --sade-success: #16a34a;
    --sade-warning: #f97316;
    --sade-danger: #ef4444;
    --sade-purple: #7c3aed;
    --sade-light: #f1f5f9;
    --sade-dark: #0f172a;
    --bs-body-bg: #f8fafc;
    --bs-body-font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--bs-body-font-family);
    background-color: var(--bs-body-bg);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    --bs-body-bg: #0d1117;
    --sade-light: #161b22;
    --bs-body-color: #c9d1d9;
    
    .sade-card, .filter-section, .breadcrumb, .stats-card {
        background-color: #161b22 !important;
        border-color: #30363d !important;
    }

    .sade-header {
        border-bottom-color: var(--sade-warning);
    }

    .navbar {
        background-color: #161b22 !important;
        border-bottom: 1px solid #30363d;
    }

    .footer {
        background-color: #161b22 !important;
        border-top: 1px solid #30363d;
    }

    .select2-container--bootstrap-5 .select2-selection {
        background-color: #0d1117;
        border-color: #30363d;
        color: #c9d1d9;
    }
    .select2-dropdown {
        background-color: #161b22;
        border-color: #30363d;
    }
    .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
        background-color: #0d1117;
        color: #c9d1d9;
    }
    .select2-results__option--highlighted {
        background-color: var(--sade-primary) !important;
    }
    .form-control {
        background-color: #0d1117;
        border-color: #30363d;
        color: #c9d1d9;
    }
    .form-control::placeholder {
        color: #6c757d;
    }
}


.sade-header {
    background: linear-gradient(135deg, var(--sade-primary), var(--sade-secondary));
    color: white;
    padding: 2rem 0;
    border-bottom: 5px solid var(--sade-warning);
}

.sade-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease-in-out;
    background-color: #fff;
}

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

.card-hover {
    transition: all 0.3s ease-in-out;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.filter-section {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 15px rgba(0,0,0,0.07);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    color: white;
    padding: 1.5rem 1rem 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 0.9rem;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    transform: translateY(0);
}

.gallery-overlay h5 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 4rem;
}

.stats-card {
    background: #fff;
    color: var(--sade-dark);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.stats-card:hover {
    background: var(--sade-primary);
    color: white;
}
.stats-card:hover .stats-icon, .stats-card:hover .stats-number {
    color: white;
}

.stats-icon {
    font-size: 2rem;
    color: var(--sade-primary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.stats-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--sade-secondary);
    transition: color 0.3s ease;
}

.breadcrumb {
    background-color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.filter-badge {
    background-color: var(--sade-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem;
}

.clear-filters {
    background-color: var(--sade-danger);
    border: none;
    color: white;
    transition: background-color 0.3s;
}
.clear-filters:hover {
    background-color: #c53030;
}

.navbar {
    transition: background-color 0.3s ease;
}

.navbar-nav .nav-link {
    transition: all 0.2s ease-in-out;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}
.navbar-nav .nav-link.active, .navbar-nav .nav-link:hover {
    color: white !important;
    background-color: var(--sade-primary);
}

#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    z-index: 1030;
    background-color: var(--sade-primary);
    border-color: var(--sade-primary);
}

.section {
    display: none;
}
.section.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.footer {
    background-color: #0f172a;
    color: #f1f5f9;
    padding: 2rem 0;
    border-top: 1px solid #334155;
}

/* ===== NOVA INTERFACE MODERNA ===== */

/* Seções */
.section-content {
    padding: 2rem 0;
    min-height: 70vh;
}

/* Container de Resultados */
.results-container {
    min-height: 400px;
    position: relative;
}

/* Vista em Grade (Grid) */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.result-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--sade-primary);
}

.result-card-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: #f8fafc;
}

.result-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    padding: 10px;
}

.result-card:hover .result-card-image img {
    transform: scale(1.02);
}

.performance-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.performance-badge.excellent { 
    background: linear-gradient(135deg, #16a34a, #22c55e); 
}
.performance-badge.good { 
    background: linear-gradient(135deg, #2563eb, #3b82f6); 
}
.performance-badge.average { 
    background: linear-gradient(135deg, #f59e0b, #fbbf24); 
}
.performance-badge.poor { 
    background: linear-gradient(135deg, #ef4444, #f87171); 
}

.result-card-content {
    padding: 1.25rem;
}

.school-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1e293b;
    line-height: 1.4;
    min-height: 2.8rem;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: #64748b;
}

.meta-item i {
    width: 16px;
    text-align: center;
    color: var(--sade-primary);
}

.result-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Vista em Lista (List) */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.result-list-item {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e2e8f0;
}

.result-list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(4px);
    border-color: var(--sade-primary);
}

.result-list-image {
    width: 120px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8fafc;
}

.result-list-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-list-content {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    align-items: center;
}

.result-list-school {
    font-weight: 600;
    font-size: 1.125rem;
    color: #1e293b;
}

.result-list-meta {
    color: #64748b;
    font-size: 0.875rem;
}

.result-list-performance {
    text-align: center;
}

.result-list-students {
    text-align: center;
    color: #64748b;
}

/* Vista em Tabela (Table) */
.results-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.results-table table {
    margin: 0;
}

.results-table th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #1e293b;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.results-table tr:hover {
    background: #f8fafc;
}

.table-image {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
    background: #f8fafc;
}

.table-image:hover {
    transform: scale(1.1);
}

/* Estatísticas Rápidas */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--sade-primary);
    transition: transform 0.2s ease;
}

.quick-stat-card:hover {
    transform: translateY(-2px);
}

.quick-stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sade-primary);
    margin-bottom: 0.5rem;
}

.quick-stat-label {
    color: #64748b;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Estatísticas na Sidebar */
.quick-stats-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-stats-sidebar .quick-stat-card {
    padding: 1rem;
    margin-bottom: 0;
    border-left: 3px solid var(--sade-primary);
}

.quick-stats-sidebar .quick-stat-number {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.quick-stats-sidebar .quick-stat-label {
    font-size: 0.75rem;
}

/* Filtros Ativos */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.filter-badge {
    background: var(--sade-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.filter-badge .remove-filter {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    width: 12px;
    height: 12px;
}

.filter-badge .remove-filter:hover {
    opacity: 1;
}

/* Estados Vazios */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    color: #9ca3af;
}

.empty-state h5 {
    margin-bottom: 1rem;
    color: #374151;
    font-size: 1.25rem;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 0;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Melhorias nos Controles */
.filter-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:focus {
    border-color: var(--sade-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-group .btn {
    border-color: #d1d5db;
}

.btn-group .btn-check:checked + .btn {
    background-color: var(--sade-primary);
    border-color: var(--sade-primary);
}

/* Responsivo */
@media (max-width: 768px) {
    .section-content {
        padding: 1rem 0;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .result-list-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: left;
    }
    
    .result-list-performance,
    .result-list-students {
        text-align: left;
    }
    
    .quick-stats {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .quick-stat-number {
        font-size: 1.5rem;
    }
    
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Modo Escuro */
body.dark-mode .result-card,
body.dark-mode .result-list-item,
body.dark-mode .results-table,
body.dark-mode .quick-stat-card {
    background: #161b22;
    border-color: #30363d;
}

body.dark-mode .school-title,
body.dark-mode .stat-value,
body.dark-mode .result-list-school {
    color: #f0f6fc;
}

body.dark-mode .results-table th {
    background: #21262d;
    color: #f0f6fc;
    border-bottom-color: #30363d;
}

body.dark-mode .results-table tr:hover {
    background: #21262d;
}

body.dark-mode .results-table td {
    border-bottom-color: #21262d;
}

body.dark-mode .result-card-image,
body.dark-mode .result-list-image,
body.dark-mode .table-image {
    background: #0d1117;
}

body.dark-mode .active-filters {
    background: #21262d;
    border-color: #30363d;
}

/* === SECTIONS STYLING === */

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* === RANKING SPECIFIC STYLES === */

#ranking-section .table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

#ranking-section .table {
    margin-bottom: 0;
}

#ranking-section .table-warning {
    background-color: rgba(255, 215, 0, 0.1) !important;
}

#ranking-section .badge {
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
}

#ranking-section .stats-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 1px solid #e9ecef;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

#ranking-section .stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

#ranking-section .stats-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--sade-primary);
}

#ranking-section .stats-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--sade-dark);
    margin-bottom: 0.5rem;
}

#ranking-section .stats-label {
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

/* Dark mode for ranking */
body.dark-mode #ranking-section .stats-card {
    background: linear-gradient(135deg, #161b22, #21262d);
    border-color: #30363d;
}

body.dark-mode #ranking-section .stats-number {
    color: #f0f6fc;
}

body.dark-mode #ranking-section .table-warning {
    background-color: rgba(255, 215, 0, 0.15) !important;
}

/* Purple theme classes */
.text-purple {
    color: var(--sade-purple) !important;
}

.btn-purple {
    background-color: var(--sade-purple);
    border-color: var(--sade-purple);
    color: white;
}

.btn-purple:hover,
.btn-purple:focus {
    background-color: #6d28d9;
    border-color: #6d28d9;
    color: white;
}

.btn-purple:active {
    background-color: #5b21b6;
    border-color: #5b21b6;
}

.bg-purple {
    background-color: var(--sade-purple) !important;
}

/* Gradient background for purple */
.bg-gradient-purple {
    background: linear-gradient(135deg, var(--sade-purple) 0%, #6d28d9 100%) !important;
}

/* Upload area styles */
.upload-area {
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--sade-purple) !important;
    background-color: rgba(124, 58, 237, 0.05);
}

.upload-area.drag-over {
    border-color: var(--sade-purple) !important;
    background-color: rgba(124, 58, 237, 0.1);
}

/* Timeline styles */
.timeline {
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.timeline-item {
    position: relative;
    padding-left: 40px;
}

.timeline-marker {
    position: absolute;
    left: 7px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #dee2e6;
}

/* Skills list styles */
.skills-list {
    max-height: 400px;
    overflow-y: auto;
}

.skill-item {
    border-left: 4px solid var(--sade-purple);
    background: rgba(124, 58, 237, 0.05);
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.skill-item:hover {
    background: rgba(124, 58, 237, 0.1);
    transform: translateX(5px);
}

.skill-code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--sade-purple);
}

.skill-description {
    font-size: 0.9rem;
    line-height: 1.4;
}

.skill-bncc {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Matrix browser styles */
.matrix-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.matrix-item:hover {
    border-color: var(--sade-purple);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.matrix-code {
    background: var(--sade-purple);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.matrix-bncc {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.matrix-cycles {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.cycle-badge {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
}

/* Chart container styles */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Dark mode adjustments for matrizes */
body.dark-mode .upload-area {
    border-color: #30363d;
    background-color: rgba(124, 58, 237, 0.05);
}

body.dark-mode .upload-area:hover,
body.dark-mode .upload-area.drag-over {
    border-color: var(--sade-purple);
    background-color: rgba(124, 58, 237, 0.1);
}

body.dark-mode .timeline::before {
    background: #30363d;
}

body.dark-mode .timeline-marker {
    border-color: #161b22;
    box-shadow: 0 0 0 2px #30363d;
}

body.dark-mode .skill-item {
    background: rgba(124, 58, 237, 0.1);
    border-left-color: var(--sade-purple);
}

body.dark-mode .skill-item:hover {
    background: rgba(124, 58, 237, 0.15);
}

body.dark-mode .matrix-item {
    border-color: #30363d;
    background-color: #161b22;
}

body.dark-mode .matrix-item:hover {
    border-color: var(--sade-purple);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

body.dark-mode .matrix-bncc {
    background: rgba(25, 118, 210, 0.2);
    color: #64b5f6;
}

body.dark-mode .cycle-badge {
    background: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}
