/* ranking.css - Header branco, filtro turma obrigatório */

/* Reset e variáveis */
:root {
    --primary-color: #070738;
    --secondary-color: #1E40AF;
    --accent-color: #DC2626;
    --success-color: #16A34A;
    --warning-color: #F59E0B;
    --danger-color: #DC2626;
    --light-color: #F9FAFB;
    --dark-color: #1F2937;
    --gray-color: #6B7280;
    --light-gray: #E5E7EB;
    --white: #FFFFFF;
    
    --font-primary: 'Inter', sans-serif;
    --font-secondary: 'Montserrat', sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

body {
    font-family: var(--font-primary);
    color: var(--dark-color);
    background-color: var(--light-color);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header BRANCO com hover vermelho */
.header {
    background-color: var(--white);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--light-gray);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary-color);
}

.logoimg {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-family: var(--font-secondary);
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--primary-color);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--gray-color);
}

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-desktop a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0.5rem 0;
    position: relative;
}

.nav-desktop a:hover {
    color: var(--accent-color);
}

.nav-desktop a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-color);
    border-radius: 1px;
}

#userDiv {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#userAvatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
}

#userName {
    font-size: 0.875rem;
    color: var(--dark-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

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

.btn-accent:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--light-gray);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    background-color: rgba(7, 7, 56, 0.05);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    width: 1.5rem;
    height: 2px;
    background-color: var(--dark-color);
    transition: 0.3s;
}

.nav-mobile {
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--white);
    border-top: 1px solid var(--light-gray);
    box-shadow: var(--shadow-md);
}

.nav-mobile a {
    color: var(--dark-color);
    text-decoration: none;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

.nav-mobile a:hover {
    background-color: var(--light-color);
    color: var(--accent-color);
}

/* Hero Section */
.ranking-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a1a4a 100%);
    color: var(--white);
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.ranking-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('https://i.ibb.co/jryH3q8/Min-Branca.png') center/120% no-repeat;
    filter: blur(15px) brightness(0.5) opacity(0.3);
    z-index: 0;
}

.ranking-hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    position: relative;
    z-index: 1;
}

.ranking-hero-info {
    flex: 1;
}

.ranking-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.ranking-title {
    font-family: var(--font-secondary);
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.text-accent {
    color: var(--accent-color);
}

.ranking-description {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 600px;
}

.ranking-stats {
    display: flex;
    gap: 3rem;
    margin-top: 2rem;
}

.ranking-stats .stat {
    text-align: center;
}

.ranking-stats .stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-color);
    line-height: 1;
}

.ranking-stats .stat-label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.ranking-hero-image {
    flex-shrink: 0;
}

.trophy-container {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
    box-shadow: var(--shadow-xl);
}

.trophy-container i {
    font-size: 5rem;
    color: var(--primary-color);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Main Content */
.ranking-main {
    padding: 3rem 0;
}

/* Filtros */
.filters-section {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.filter-group label i {
    color: var(--secondary-color);
}

.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-primary);
    background: var(--white);
    transition: all 0.2s;
    color: var(--dark-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.filter-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Informações do Simulado */
.simulado-info {
    margin-bottom: 2rem;
}

.simulado-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.simulado-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.simulado-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.simulado-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.simulado-date,
.simulado-model,
.simulado-questions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--gray-color);
}

.simulado-date i,
.simulado-model i,
.simulado-questions i {
    color: var(--secondary-color);
}

.simulado-description {
    color: var(--gray-color);
    line-height: 1.6;
    margin: 0;
}

/* Layout Principal */
.ranking-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

/* Pódio */
.podium-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.podium-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.podium-item {
    flex: 1;
    max-width: 200px;
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    position: relative;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-md);
}

.podium-item:hover {
    transform: translateY(-5px);
}

.podium-item.gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    order: 2;
    margin-bottom: 2rem;
}

.podium-item.silver {
    background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%);
    order: 1;
}

.podium-item.bronze {
    background: linear-gradient(135deg, #CD7F32 0%, #A0522D 100%);
    order: 3;
}

.podium-place {
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: var(--white);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    box-shadow: var(--shadow-md);
}

.podium-avatar {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.podium-avatar i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.podium-info {
    color: var(--primary-color);
}

.podium-name {
    display: block;
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podium-score {
    display: block;
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Tabela de Ranking */
.ranking-table-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--light-gray);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.ranking-table thead {
    background: var(--light-color);
}

.ranking-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-color);
    border-bottom: 2px solid var(--light-gray);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ranking-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light-gray);
    vertical-align: middle;
}

.ranking-table tbody tr {
    transition: background-color 0.2s;
}

.ranking-table tbody tr:hover {
    background: var(--light-color);
}

.ranking-table tbody tr.user-row {
    background: rgba(30, 64, 175, 0.05);
    font-weight: 600;
}

.position-col {
    width: 80px;
    text-align: center;
}

.turma-col {
    width: 100px;
}

.score-col,
.percent-col {
    width: 120px;
}

.details-col {
    width: 120px;
    text-align: center;
}

.position-cell {
    text-align: center;
    font-weight: 700;
    color: var(--gray-color);
    font-size: 1rem;
}

.student-name {
    font-weight: 500;
    color: var(--dark-color);
}

.class-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--light-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--gray-color);
    font-weight: 500;
}

.score-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.percent-value {
    font-weight: 600;
    font-size: 1rem;
}

.percent-value.high {
    color: var(--success-color);
}

.percent-value.medium {
    color: var(--warning-color);
}

.percent-value.low {
    color: var(--danger-color);
}

.details-btn {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.details-btn:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
}

/* Sidebar - REMOVIDA A SEÇÃO "SEU DESEMPENHO" */
.ranking-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header i {
    font-size: 1.25rem;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.sidebar-content {
    padding: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--light-color);
    border-radius: var(--radius-md);
}

.stat-item i {
    color: var(--secondary-color);
    font-size: 1.25rem;
}

.stat-item div {
    flex: 1;
}

.stat-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-color);
    font-weight: 500;
}

.stat-item strong {
    display: block;
    font-size: 1.125rem;
    color: var(--primary-color);
    margin-top: 0.25rem;
    font-weight: 600;
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination-btn {
    background: var(--white);
    border: 1px solid var(--light-gray);
    color: var(--gray-color);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--light-color);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn {
    background: var(--white);
    border: 1px solid var(--light-gray);
    color: var(--gray-color);
    min-width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.page-btn:hover {
    background: var(--light-color);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.page-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--white);
    font-weight: 600;
}

/* Estados de loading e empty */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-color);
}

.loading-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-color);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--light-gray);
}

.empty-state h3 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 0.875rem;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 100px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    background: #DCFCE7;
    color: #166534;
    border-left: 4px solid #16A34A;
}

.toast.error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid #DC2626;
}

.toast.info {
    background: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid #3B82F6;
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: var(--white);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer.light {
    background: var(--light-color);
    color: var(--dark-color);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand p {
    margin: 1rem 0;
    opacity: 0.8;
    font-size: 0.875rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-links a {
    color: var(--white);
    opacity: 0.8;
    transition: opacity 0.2s;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.social-links a:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.footer-links h4 {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
    font-size: 0.875rem;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-contact h4 {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.footer-contact ul {
    list-style: none;
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    opacity: 0.8;
}

.footer-contact li svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Responsividade */
@media (max-width: 1024px) {
    .ranking-layout {
        grid-template-columns: 1fr;
    }
    
    .ranking-hero-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    
    .ranking-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .podium-container {
        flex-wrap: wrap;
    }
    
    .podium-item {
        max-width: 180px;
    }
}

@media (max-width: 768px) {
    .ranking-title {
        font-size: 2rem;
    }
    
    .nav-desktop {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .nav-mobile.active {
        display: flex;
    }
    
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .simulado-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .podium-container {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-item {
        max-width: 100%;
        margin-bottom: 1rem !important;
    }
    
    .table-container {
        border-radius: var(--radius-md);
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .details-btn span {
        display: none;
    }
    
    .details-btn i {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .ranking-hero {
        padding: 3rem 0;
    }
    
    .ranking-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .ranking-stats .stat-number {
        font-size: 2rem;
    }
    
    .trophy-container {
        width: 150px;
        height: 150px;
    }
    
    .trophy-container i {
        font-size: 4rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.nav-desktop a.active {
    color: var(--accent-color);
    font-weight: 600;
}