/* Reset e estilos gerais */
html {
    scroll-behavior: smooth;
    /* Garante que o cabeçalho fixo não tape o início das secções */
    scroll-padding-top: 100px; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f9f9f9;
    color: #333;
    line-height: 1.6;
    /* Adicionado para evitar rolagem horizontal indesejada em mobile */
    overflow-x: hidden; 
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Cabeçalho */
header {
    background: linear-gradient(135deg, #0d5a27, #136921, #0e7404);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    /* CHAVE: Permite que o JS mova o header suavemente para cima/baixo */
    transition: top 0.3s ease-in-out; 
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo h1 {
    font-size: 28px;
    margin-left: 10px;
}

/* Ajuste do link no título */
.logo h1 a {
    color: white; 			
    text-decoration: none; 	
    font-weight: bold; 		
    transition: color 0.3s;
}

.logo h1 a:hover {
    color: #ffd700; 			
}

/* Estilos para ocultar/mostrar o logo completo/mobile (por padrão, esconde o mobile) */
.logo h1 a .mobile-logo {
    display: none; 
}

/* -------------------------------------- */
/* 🍔 Estilos para Menu Hamburger         */
/* -------------------------------------- */

.nav-toggle {
    display: none; /* Escondido em desktop */
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 10px;
    z-index: 1001;
}

.hamburger {
    display: block;
    position: relative;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: transform 0.3s ease-in-out;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: transform 0.3s ease-in-out, top 0.3s ease-in-out;
}

.hamburger::before { top: -8px; }
.hamburger::after { top: 8px; }

/* Animação para o 'X' quando o menu está aberto */
body.nav-open .hamburger { transform: rotate(45deg); }
body.nav-open .hamburger::before { top: 0; transform: rotate(90deg); }
body.nav-open .hamburger::after { top: 0; transform: rotate(90deg); }


nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #ffd700;
}

/* Hero Section */
.hero {
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23f8f9fa"/><path d="M0 0 L100 100 M100 0 L0 100" stroke="%23e9ecef" stroke-width="1"/></svg>');
    padding: 150px 0 100px;
    text-align: center;
    color: #333;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #1a2a6c;
}

.hero p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 30px;
}

.btn {
    display: inline-block;
    background: #1a2a6c;
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn:hover {
    background: #fdbb2d;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Sobre */
.about {
    padding: 80px 0;
    background-color: white;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    color: #1a2a6c;
    position: relative;
    font-size: 2.2rem;
}

.section-title:after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: #fdbb2d;
    margin: 15px auto;
    border-radius: 2px;
}

.about-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 40px;
}

.about-text {
    flex: 1;
    min-width: 300px;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.about-text ul {
    margin-left: 20px;
    margin-top: 15px;
}

.about-text li {
    margin-bottom: 10px;
}

.about-image {
    flex: 1;
    min-width: 300px;
    height: 350px;
    background: linear-gradient(45deg, #1a2a6c, #fdbb2d);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Serviços */
.services {
    padding: 80px 0;
    background-color: #f8f9fa;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.service-card:hover {
    transform: translateY(-10px);
}

.service-card h3 {
    color: #1a2a6c;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.service-card p {
    color: #666;
}

/* Professores */
.coaches {
    padding: 80px 0;
    background-color: white;
}

.coaches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.coach-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.coach-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(45deg, #1a2a6c, #fdbb2d);
    margin: 0 auto 20px;
}

.coach-card h3 {
    color: #1a2a6c;
    margin-bottom: 10px;
}

.coach-card p {
    color: #666;
}

/* Contato */
.contact {
    padding: 80px 0;
    background-color: #f8f9fa;
}

.contact-content {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

.contact-info, .contact-form {
    flex: 1;
    min-width: 300px;
}

.contact-info h3, .contact-form h3 {
    color: #1a2a6c;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.contact-info p {
    margin-bottom: 15px;
}

.contact-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.contact-form input, .contact-form select, .contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.contact-form textarea {
    height: 120px;
    resize: vertical;
}

.contact-form button {
    background: #1a2a6c;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s;
}

.contact-form button:hover {
    background: #fdbb2d;
}

/* Footer */
footer {
    background: #1a2a6c;
    color: white;
    text-align: center;
    padding: 30px 0;
}

/* Estilos para as redes sociais */
.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.social-links a {
    color: #fff;
    font-size: 24px;
    transition: transform 0.3s, color 0.3s;
}

.social-links a:hover {
    transform: translateY(-3px);
    color: #ffd700; /* Cor do tênis, pode ajustar */
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mapa {
    width: 100%;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.mapa iframe {
    width: 100%;
    height: 300px;
    border: none;
    display: block;
}

/* -------------------------------------- */
/* 🔐 Estilos para Login e Registo        */
/* -------------------------------------- */

body.form-page-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f2f5 0%, #e0e0e0 100%);
    padding: 20px;
}

.form-container {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.form-container h1 {
    color: #1a2a6c;
    margin-bottom: 30px;
    font-size: 2rem;
}

.form-container form {
    text-align: left;
}

.form-container label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-container input:focus {
    border-color: #1a2a6c;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 42, 108, 0.1);
}

.form-container button {
    width: 100%;
    padding: 12px;
    background: #1a2a6c;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.form-container button:hover {
    background: #fdbb2d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.form-container p {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #666;
}

.form-container a {
    color: #1a2a6c;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.form-container a:hover {
    color: #fdbb2d;
}

/* Links inside forms (e.g., 'Voltar', 'Sair') */
.form-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    font-size: 0.9rem;
}

.form-links a {
    color: #555;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.form-links a:hover { color: #1a2a6c; }
.form-links a.logout-link { color: #dc3545; }
.form-links a.logout-link:hover { color: #a71d2a; }

/* Mensagens de erro */
.message {
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

.message-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.message-error p {
    margin: 0;
    color: inherit;
}

/* -------------------------------------- */
/* 📱 Responsividade e Otimização Mobile */
/* -------------------------------------- */

/* Portáteis e Ecrãs Médios (Laptops) */
@media (max-width: 1200px) {
    header {
        padding: 15px 0;
    }
    .logo h1 {
        font-size: 22px;
    }
    nav ul li {
        margin-left: 12px;
    }
    nav ul li a {
        font-size: 0.9rem;
    }
}

/* Médios (Tablets/Portáteis pequenos) */
/* Aumentado o breakpoint para 1024px para evitar que o menu horizontal quebre em portáteis */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: row; 
        justify-content: space-between;
        padding: 0 10px;
    }
    
    .nav-toggle {
        display: block; /* Mostra o botão hamburger */
    }

    nav {
        position: fixed;
        top: 0; right: 0; bottom: 0; left: 0;
        background: rgba(13, 90, 39, 0.98);
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        padding-top: 120px;
        overflow-y: auto; /* Permite scroll se o menu for maior que o ecrã */
        z-index: 999;
    }

    body.nav-open nav {
        transform: translateX(0);
    }

    /* Bloqueia o scroll da página principal quando o menu está aberto */
    body.nav-open {
        overflow: hidden;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        height: auto; /* Permite que a lista cresça além da altura do ecrã se necessário */
        margin-top: 0;
    }
    
    nav ul li {
        margin: 20px 0; 
        font-size: 1.2rem; 
    }
    
    .hero {
        padding: 150px 0 80px;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    /* Otimização do Logo */
    .logo h1 {
        font-size: 20px;
        margin-left: 0;
    }
    
    /* Esconde o logo completo e mostra o curto */
    .logo h1 a .full-logo {
        display: none; 
    }
    
    .logo h1 a .mobile-logo {
        display: inline; 
        font-size: 24px; 
    }
    
    /* Ajuste do mapa */
    .mapa iframe {
        height: 250px;
    }

}

/* Pequenos (Smartphones) */
@media (max-width: 576px) { 
    
    /* O container passa a ocupar toda a largura com um pequeno padding interno */
    .container {
        width: 100%;
        padding: 0 10px; 
    }
    
    /* Assegura que o header não tem padding lateral extra desnecessário */
    header .container {
        padding: 0 10px;
    }
    
    /* Ajusta a margem superior da Hero para compensar o header fixo */
    .hero {
        padding-top: 130px; 
    }
    
    /* Ajuste para o grid de aulas */
    .services-grid {
        gap: 20px;
    }

    /* Reduz o tamanho da fonte do logo para que ele caiba melhor */
    .logo h1 a .mobile-logo {
        font-size: 20px; 
    }
}

/* Ecrãs muito pequenos */
@media (max-width: 480px) {
    .mapa iframe {
        height: 200px;
    }
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    float: right; /* Se quiseres encostar à direita */
}

.user-menu a {
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.user-menu img:hover {
    opacity: 0.8;
    transform: scale(1.1);
    transition: 0.3s;
}

/* ========================================= */
/* 📊 Estilos para a Página do Dashboard     */
/* ========================================= */

.dashboard-container {
    padding-top: 20px;
    padding-bottom: 40px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.dashboard-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.07);
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-card .card-title {
    font-size: 1.3rem;
    color: #1a2a6c;
    padding: 20px 25px;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card .card-content {
    padding: 25px;
    flex-grow: 1;
}

.dashboard-card .card-content p {
    margin-bottom: 12px;
    color: #555;
}
.dashboard-card .card-content p:last-child {
    margin-bottom: 0;
}

.dashboard-card .card-footer {
    background-color: #fcfcfc;
    padding: 20px 25px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}

/* Specific card styles */
.perfil-info p strong {
    color: #333;
    min-width: 120px;
    display: inline-block;
}

/* Ranking/Stats card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    text-align: center;
}

.stat-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a2a6c;
}
.stat-item .pos-badge {
    margin: 0 auto;
    font-size: 1.5rem; /* Adjust badge size */
}

/* My Tournaments card */
.tournament-insc-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tournament-insc-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fdfdfd;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: box-shadow 0.3s;
}
.tournament-insc-card:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.tournament-insc-details h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.1rem;
}
.tournament-insc-details p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-badge.realizado {
    background-color: #fce8e6;
    color: #c5221f;
}
.status-badge.proximo {
    background-color: #e6f4ea;
    color: #1e7e34;
}

.btn.btn-secondary {
    background-color: #6c757d;
}
.btn.btn-secondary:hover {
    background-color: #5a6268;
}

.dashboard-logout {
    text-align: center;
    margin-top: 40px;
}
.dashboard-logout a {
    color: #dc3545;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}
.dashboard-logout a:hover {
    color: #a71d2a;
}

/* Responsive adjustments for dashboard */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack cards on smaller screens */
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr); /* Keep 2x2 grid for stats */
    }
    
    .tournament-insc-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .tournament-insc-status {
        align-self: flex-end;
    }
}

/* Cabeçalho da página (compensação do menu fixo) */
.page-header {
    padding-top: 130px;
    padding-bottom: 20px;
    text-align: center;
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    float: right; /* Se quiseres encostar à direita */
}

.user-menu a {
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.user-menu img:hover {
    opacity: 0.8;
    transform: scale(1.1);
    transition: 0.3s;
}

/* ========================================= */
/* 🏆 Estilos para a Página de Torneios      */
/* ========================================= */

.tournament-section { padding: 40px 0; }

.tournament-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
}

.tournament-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.tournament-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.tournament-card h3 {
    color: #1a2a6c;
    margin-top: 0;
    margin-bottom: 10px;
    padding-right: 90px; /* Espaço para a etiqueta de status */
    font-size: 1.4rem;
}

.tournament-card .details {
    color: #555;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tournament-card p { color: #666; line-height: 1.6; }

.tournament-card .actions {
    margin-top: auto;
    padding-top: 20px;
    text-align: right;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.status-tag {
    position: absolute; top: 20px; right: 20px;
    padding: 6px 12px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.status-tag.aberto { background-color: #e6f4ea; color: #1e7e34; }
.status-tag.fechado { background-color: #fce8e6; color: #c5221f; }

/* Botões de Ação */
.btn-inscricao, .btn-cancelar, .btn-fechar, .btn-admin-action {
    padding: 10px 20px; border-radius: 6px; font-size: 0.9rem;
    font-weight: 600; cursor: pointer; border: none; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
    transition: filter 0.2s; color: white;
}
.btn-inscricao:hover, .btn-cancelar:hover, .btn-fechar:hover, .btn-admin-action:hover { filter: brightness(90%); }
.btn-inscricao { background-color: #28a745; }
.btn-cancelar { background-color: #ffc107; color: #333; }
.btn-fechar { background-color: #dc3545; }
.btn-disabled { background-color: #e9ecef; color: #6c757d; padding: 10px 20px; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: not-allowed; }

/* Formulários (Torneio e Ranking) */
.form-panel { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); margin-bottom: 40px; border: 1px solid #eee; }
.form-panel h3 { margin-top: 0; color: #1a2a6c; margin-bottom: 20px; border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; }
/* Destaque para o painel de criar torneio */
.form-panel {
    border-left: 5px solid #1a2a6c;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; transition: border-color 0.3s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #1a2a6c; outline: none; box-shadow: 0 0 0 3px rgba(26, 42, 108, 0.1); }
.form-full { grid-column: 1 / -1; }

/* ========================================= */
/* 🥇 Estilos para a Página de Ranking       */
/* ========================================= */

.ranking-table-container { overflow-x: auto; background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); border: 1px solid #eee; }
.ranking-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.ranking-table th { background-color: #1a2a6c; color: white; padding: 18px 15px; text-align: left; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; font-size: 0.85rem; }
.ranking-table td { padding: 15px; border-bottom: 1px solid #f0f0f0; color: #333; vertical-align: middle; }
.ranking-table tr:last-child td { border-bottom: none; }
.ranking-table tr:nth-child(even) { background-color: #fcfcfc; }
.ranking-table tr:hover { background-color: #f0f7ff; }

/* Badges de Posição */
.pos-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background-color: #e9ecef; color: #555; font-weight: 800; font-size: 0.9rem;
}
.pos-badge.top-1 { background: linear-gradient(135deg, #ffd700, #fdb931); color: #fff; box-shadow: 0 2px 5px rgba(218, 165, 32, 0.4); border: 2px solid #fff; transform: scale(1.1); }
.pos-badge.top-2 { background: linear-gradient(135deg, #e0e0e0, #bdbdbd); color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border: 2px solid #fff; }
.pos-badge.top-3 { background: linear-gradient(135deg, #cd7f32, #a05a2c); color: #fff; box-shadow: 0 2px 5px rgba(160, 90, 44, 0.3); border: 2px solid #fff; }

/* Pontuação e V/D */
.points-cell { font-weight: 800; font-size: 1.2rem; color: #1a2a6c; }
.win-loss-badge { display: inline-flex; gap: 5px; font-weight: 600; background: #f8f9fa; padding: 5px 10px; border-radius: 20px; border: 1px solid #eee; }
.win-val { color: #28a745; }
.loss-val { color: #dc3545; }

.admin-form-actions { display: flex; align-items: flex-end; }
.admin-form-actions button { height: 42px; margin-bottom: 2px; width: 100%; }

/* ========================================= */
/* 🛠️ Layout Helpers                       */
/* ========================================= */

/* Layout para páginas com pouco conteúdo, para manter o footer em baixo */
.sticky-footer-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.main-content {
    flex: 1 0 auto;
}

/* ========================================= */
/* 🏆 Estilos para a Página de Torneios      */
/* ========================================= */

.tournament-section { padding: 40px 0; }

.tournament-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tournament-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #eee;
    border-left: 5px solid #1a2a6c;
    display: flex;
    flex-direction: column;
    height: auto;
    max-width: none;
    width: 100%;
    margin: 0;
}

/* Navegação de Semanas */
.week-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}
.btn-nav {
    padding: 8px 16px;
    background-color: #fff;
    border: 1px solid #1a2a6c;
    color: #1a2a6c;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9rem;
}
.btn-nav:hover { background-color: #1a2a6c; color: #fff; }

.tournament-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.1);
}

/* NOVO: Cabeçalho do Card com Flexbox */
.tournament-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 30px 30px 10px 30px;
}

.tournament-card-header h3 {
    color: #1a2a6c;
    margin: 0;
    font-size: 1.4rem;
    flex-grow: 1; /* Permite que o título ocupe o espaço */
}

/* NOVO: Conteúdo principal do card */
.tournament-card-body {
    padding: 0 30px 10px 30px;
    flex-grow: 1; /* Faz o corpo crescer e empurra as ações para baixo */
    overflow-y: visible;
}



.tournament-card .details {
    color: #555;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tournament-card .details i {
    color: #888; /* Cor dos ícones */
}

.tournament-card .description { /* Renomeei de p para .description para ser mais específico */
    color: #666;
    line-height: 1.6;
    margin-top: 15px;
}

/* NOVO: Estilos para a lista de alunos inscritos (removendo inline styles) */
.admin-view-students {
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.admin-view-students h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
    color: #333;
    font-weight: 600;
}

.admin-view-students ul.student-list-scroll {
    font-size: 0.95em;
    margin: 0;
    padding-left: 20px;
    /* Adiciona scroll se a lista for muito grande */
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Estilo da barra de rolagem para a lista */
.admin-view-students ul.student-list-scroll::-webkit-scrollbar { width: 6px; }
.admin-view-students ul.student-list-scroll::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; }

.admin-view-students ul {
    list-style-type: disc;
}

.admin-view-students li {
    margin-bottom: 5px;
    color: #555;
}

.admin-view-students p {
    font-size: 0.9em;
    margin: 0;
    color: #777;
    font-style: italic;
}


.tournament-card .actions {
    margin-top: auto; /* Garante que fica no fundo */
    padding: 20px 30px 30px 30px;
    text-align: right;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    background-color: transparent;
    border-top: none;
}

.status-tag {
    /* position: absolute; top: 20px; right: 20px; */ /* Removido para usar flexbox */
    align-self: center; /* Centraliza verticalmente no header do card */
}

/* Botões de Ação */
.btn-inscricao, .btn-cancelar, .btn-fechar, .btn-admin-action {
    gap: 8px; /* Espaço entre ícone e texto */
}
.btn-inscricao:hover, .btn-cancelar:hover, .btn-fechar:hover, .btn-admin-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* NOVO: Botões específicos para admin para evitar inline styles */
.btn-admin-action.reabrir { background-color: #17a2b8; }
.btn-admin-action.lancar { background-color: #007bff; }
.btn-admin-action.excluir { background-color: #800000; }


.btn-disabled {
    gap: 8px;
}

/* NOVO: Painel de resultados, mais específico */
.results-form-panel {
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 25px;
}

.results-form-panel h4 {
    font-size: 1.2rem;
    color: #007bff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Estilos para o formulário de lançamento de resultados */
.results-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Cards mais compactos */
    gap: 20px;
    margin-top: 20px;
}

.result-entry-item {
    background-color: #f8f9fa;
    padding: 20px; /* Mais padding */
    border-radius: 10px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    gap: 15px; /* Mais gap */
}

/* NOVO: Nome do aluno em destaque */
.result-entry-item > label {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 5px;
}

.result-entry-item .input-group {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Alinha label e input */
    gap: 10px;
}

.result-entry-item .input-group label {
    font-size: 0.95rem;
    color: #555;
}

.result-entry-item .input-group input[type="number"] {
    width: 70px; 
    text-align: center;
    padding: 8px;
    font-size: 1rem;
    font-weight: bold;
    border: 1px solid #bbb;
    border-radius: 5px;
}

/* NOVO: Ações do formulário de resultados */
.results-form-actions {
    text-align: right;
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* NOVO: Botão de guardar resultados */
.btn-save-results {
    background-color: #28a745;
    color: white;
}

/* NOVO: Botão de cancelar/fechar resultados */
.btn-cancel-results {
    background-color: #6c757d;
    color: white;
    text-decoration: none; /* Para o caso de ser um <a> */
}

/* ========================================= */
/* 📅 Estilos para o Horário de Aulas        */
/* ========================================= */

.schedule-container .schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.schedule-container .schedule-header h3 {
    margin: 0;
    color: #1a2a6c;
}

.schedule-container .schedule-header .btn-mais {
    color: #1a2a6c;
    text-decoration: none;
    font-weight: 600;
}

.schedule-grid-wrapper {
    position: relative;
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, minmax(120px, 1fr));
    background-color: #fff;
    min-width: 900px;
}

.schedule-grid .grid-cell {
    padding: 8px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}
.schedule-grid .grid-cell:last-child { border-right: none; }

.schedule-grid .day-header {
    text-align: center;
    font-weight: 600;
    background-color: #f8f9fa;
    text-transform: capitalize;
    padding: 10px 5px;
}
.schedule-grid .day-header .day-date {
    display: block;
    font-size: 0.8em;
    font-weight: normal;
    color: #666;
}
.schedule-grid .day-header.today {
    background-color: #fffbe6;
    color: #c59d00;
}

.schedule-grid .time-header { background-color: #f8f9fa; }

.schedule-grid .time-label {
    text-align: center;
    font-size: 0.8em;
    color: #666;
    font-weight: 500;
    min-height: 60px; /* Altura mínima de cada slot de hora */
    display: flex;
    align-items: center;
    justify-content: center;
}

.schedule-grid .time-slot { min-height: 60px; position: relative; }

/* Estilo para horários fechados/indisponíveis */
.schedule-grid .grid-cell.closed-slot {
    background-color: #f8f9fa;
    background-image: linear-gradient(45deg, #e9ecef 25%, transparent 25%, transparent 50%, #e9ecef 50%, #e9ecef 75%, transparent 75%, transparent);
    background-size: 10px 10px;
}

.class-item {
    background-color: #e3f2fd;
    color: #0d47a1;
    border-left: 3px solid #1a2a6c;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.8rem;
    margin-bottom: 3px;
    position: relative;
    overflow: hidden;
    word-break: break-word; /* Evita que texto longo quebre o layout */
}
.class-item strong { display: block; font-weight: 700; }
.class-item span { font-size: 0.9em; }

.class-item .delete-form { position: absolute; top: 2px; right: 2px; display: none; }
.class-item:hover .delete-form { display: block; }
.btn-delete-class { background: none; border: none; color: #c5221f; cursor: pointer; padding: 2px; line-height: 1; }
.btn-delete-class:hover { color: #800000; }

.current-time-line {
    position: absolute;
    height: 2px;
    background-color: #dc3545;
    z-index: 10;
    pointer-events: none;
    transition: top 1s linear;
    display: none; /* Escondido por defeito */
}
.current-time-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
}

/* ========================================= */
/* 🖼️ Estilos para o Modal (Popup)           */
/* ========================================= */

.modal {
    display: none; /* Escondido por padrão */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: rgba(0,0,0,0.5); /* Fundo preto com opacidade */
    backdrop-filter: blur(2px);
    display: none; /* Será alterado para flex via JS/PHP */
    align-items: center; /* Centraliza verticalmente */
    justify-content: center; /* Centraliza horizontalmente */
    padding: 20px;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 1;
}
.close-modal:hover, .close-modal:focus { color: #000; text-decoration: none; cursor: pointer; }

/* Estilos para Gestão de Alunos (Selects e Botões) */
.modern-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.modern-select:focus {
    border-color: #1a2a6c;
    box-shadow: 0 0 0 3px rgba(26, 42, 108, 0.1);
}

.btn-save-level {
    padding: 9px 12px;
    border-radius: 6px;
    background-color: #1a2a6c;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 5px;
}
.btn-save-level:hover {
    background-color: #fdbb2d;
    color: #1a2a6c;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Cores dos Níveis (Badges para o Select) */
.level-badge {
    font-weight: 600;
    border-radius: 20px; /* Formato arredondado tipo badge */
    padding: 6px 12px;   /* Ajuste de espaçamento */
    font-size: 0.85rem;
    border: 1px solid transparent;
    appearance: none; /* Remove estilo padrão do navegador para ficar mais limpo */
    -webkit-appearance: none;
    -moz-appearance: none;
    text-align: center;
    text-align-last: center; /* Centraliza texto no select (suporte limitado) */
}

/* Cores específicas por nível */
.level-iniciante { background-color: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.level-intermediario { background-color: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.level-avancado { background-color: #fff3e0; color: #ef6c00; border-color: #ffe0b2; }
.level-competicao { background-color: #f3e5f5; color: #7b1fa2; border-color: #e1bee7; }

/* Ajuste para o ícone do select não ficar por cima do texto centralizado */
.level-badge:hover { opacity: 0.9; }

/* ========================================= */
/* 📅 Estilos para Horário de Aulas          */
/* ========================================= */

/* Sincronização de cores por nível */
.class-item.level-iniciante { background-color: #e8f5e9; color: #2e7d32; border-left-color: #2e7d32; }
.class-item.level-intermediario { background-color: #e3f2fd; color: #1565c0; border-left-color: #1565c0; }
.class-item.level-avancado { background-color: #fff3e0; color: #ef6c00; border-left-color: #ef6c00; }
.class-item.level-competicao { background-color: #f3e5f5; color: #7b1fa2; border-left-color: #7b1fa2; }

/* Destaque para quando o aluno está inscrito */
.class-item.is-enrolled {
    border: 2px solid #28a745;
    border-left-width: 6px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
    transform: scale(1.02);
    z-index: 5;
}

/* Botões de inscrição mini */
.btn-insc-mini { 
    padding: 6px; 
    font-size: 0.7rem; 
    border-radius: 6px; 
    border: none; 
    cursor: pointer; 
    color: white; 
    width: 100%; 
    margin-top: 8px; 
    font-weight: bold; 
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: opacity 0.2s;
}
.btn-insc-mini:hover { opacity: 0.9; }
.btn-inscrever { background-color: #28a745; }
.btn-desinscrever { background-color: #dc3545; }
.btn-full { background-color: #e9ecef; color: #6c757d; cursor: not-allowed; }

/* Estilo para aulas que já passaram */
.past-class { opacity: 0.6; filter: grayscale(0.4); pointer-events: none; }

/* Badge de status "Inscrito" */
.status-badge-inscrito { 
    background: #28a745; 
    color: white; 
    font-size: 0.6rem; 
    padding: 2px 6px; 
    border-radius: 10px; 
    margin-bottom: 4px; 
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 800;
}

/* Estilos para botões de ação na grelha (Admin/Professor) */
.class-item .item-actions {
    position: absolute; 
    top: 2px; 
    right: 2px; 
    display: none;
    background: rgba(255,255,255,0.9); 
    border-radius: 4px; 
    padding: 2px;
}

.class-item:hover .item-actions { display: flex; gap: 5px; }

.btn-action-icon { border: none; background: none; cursor: pointer; font-size: 0.9rem; padding: 2px; }
.btn-action-icon.edit { color: #007bff; }
.btn-action-icon.delete { color: #dc3545; }
.btn-action-icon:hover { transform: scale(1.1); }

.btn-cancel {
    background-color: #6c757d; 
    margin-left: 10px;
}
.btn-cancel:hover { background-color: #5a6268; }

.inscritos-list { font-size: 0.7rem; margin-top: 5px; border-top: 1px solid rgba(0,0,0,0.1); padding-top: 3px; }
.inscritos-count { font-weight: bold; color: #333; display: block; margin-bottom: 2px; }
.student-name { 
    display: block; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    opacity: 0.9; 
}

/* Estilo do botão + na grelha */
.btn-add-class {
    background-color: #28a745;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px auto;
    transition: background 0.2s;
}
.btn-add-class:hover { background-color: #218838; }