/* ---- ESTILOS DA PÁGINA DE LOGIN DO ADMIN ---- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    background-color: var(--admin-bg, #121212);
}
.login-box {
    background-color: var(--surface-color, #1E1E1E);
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color, #2e2e2e);
}
.login-box .logo { display: inline-block; margin-bottom: 1.5rem; }
.login-box h1 { margin-bottom: 1.5rem; font-size: 2rem; font-family: "Bebas Neue", sans-serif; color: var(--text-primary, #FFF); }
.login-form .form-group { text-align: left; margin-bottom: 1rem; }
.login-form label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-secondary, #A7A7A7); }
.login-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #2C2C2C;
    border: 1px solid var(--border-color, #2e2e2e);
    border-radius: 8px;
    color: var(--text-primary, #FFF);
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
}
.login-form input:focus {
    border-color: var(--primary-green, #c1fe00);
    outline: none;
}
.login-btn {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-green, #c1fe00);
    color: #000;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-family: "Bebas Neue", sans-serif;  
}
.login-btn:hover { background-color: #a8de00; }
.error-message { color: #ffcccc; margin-top: 1rem; font-size: 0.9rem; min-height: 1.2rem; }

/* ---- ESTRUTURA GERAL DO PAINEL ---- */
:root {
    --sidebar-bg: #1E1E1E;
    --admin-bg: #121212;
}
body { background-color: var(--admin-bg); margin: 0; font-family: 'Montserrat', sans-serif; }
.hidden { display: none !important; }

/* ---- LAYOUT PRINCIPAL ---- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background-color: var(--sidebar-bg); padding: 2rem 1rem; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); box-sizing: border-box; transition: transform 0.3s ease-in-out; }
.main-content-area { flex: 1; padding: 2.5rem; overflow-y: auto; box-sizing: border-box; }

/* ---- SIDEBAR DESKTOP ---- */
.sidebar .logo { margin-bottom: 3rem; text-align: center; }
.sidebar .logo img { height: 25px; }
.sidebar nav { flex-grow: 1; }
.sidebar nav a, .sidebar .logout-link { display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; border-radius: 8px; color: var(--text-secondary); font-weight: 500; text-decoration: none; margin-bottom: 0.5rem; transition: background-color 0.2s ease, color 0.2s ease; cursor: pointer; }
.sidebar nav i, .sidebar .logout-link i { font-size: 1.2rem; transition: color 0.2s ease; }
.sidebar nav a:hover, .sidebar .logout-link:hover { background-color: #2e2e2e; color: var(--text-primary); }
.sidebar nav a:hover i, .sidebar .logout-link:hover i { color: var(--primary-green); }
.sidebar nav a.active { background-color: var(--primary-green); color: #000; font-weight: 700; }
.sidebar nav a.active i { color: #000; }

/* ---- CONTEÚDO PRINCIPAL ---- */
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
.header-title h1 { font-family: "Bebas Neue", sans-serif; font-size: 2.5rem; margin: 0; color: var(--text-primary); }
.header-title p { margin: 5px 0 0; color: var(--text-secondary); font-size: 0.9rem; }
.content-header .actions { display: flex; gap: 1rem; }
.main-header-mobile { display: none; } /* Escondido no Desktop */

/* ---- CARDS DE ESTATÍSTICAS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.stat-card { background-color: var(--surface-color); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; }
.stat-card .icon { font-size: 2.5rem; color: var(--primary-green); }
.stat-card .info h3 { margin: 0 0 0.25rem; font-size: 2rem; font-family: 'Bebas Neue', sans-serif; }
.stat-card .info p { margin: 0; color: var(--text-secondary); text-transform: uppercase; font-size: 0.8rem; font-weight: 600; }

/* ---- ELEMENTOS GERAIS (BOTÕES, FORMULÁRIOS) ---- */
h2, h3 { font-family: "Bebas Neue", sans-serif; color: var(--text-primary); }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.5rem; margin-bottom: 1rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.8rem; background-color: var(--admin-bg); border: 1px solid var(--border-color); color: var(--text-primary); border-radius: 8px; font-size: 1rem; font-family: 'Montserrat', sans-serif; box-sizing: border-box; }
.btn { display: inline-flex; align-items:center; gap: 0.5rem; padding: 0.8rem 1.5rem; background-color: var(--primary-green); color: #000; font-weight: 700; border-radius: 8px; cursor: pointer; border: none; text-align: center; font-size: 0.9rem; transition: opacity 0.2s ease;}
.btn:hover { opacity: 0.9; }
.btn-secondary { background-color: #333; color: var(--text-primary); }
.form-actions { display: flex; gap: 1rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ---- LISTAS ---- */
.event-list-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; gap: 1rem; }
.event-actions { display: flex; gap: 0.5rem; }

/* ---- MODAIS ---- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 1rem; box-sizing: border-box; }
.modal-content { background-color: var(--surface-color); padding: 2rem; border-radius: 12px; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-sizing: border-box;}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { margin: 0; }
.close-modal-btn { background:none; border:none; color:white; font-size:1.8rem; cursor:pointer; padding: 0; line-height: 1; }
.divider { border-color: var(--border-color); margin: 2rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* ---- NAVEGAÇÃO MOBILE ---- */
.hamburger-menu { background: none; border: none; color: var(--text-primary); font-size: 1.8rem; cursor: pointer; z-index: 2001; }
.mobile-nav-panel { position: fixed; top: 0; left: 0; width: 280px; height: 100%; background-color: var(--sidebar-bg); z-index: 3000; display: flex; flex-direction: column; padding: 4rem 1.5rem 2rem; transform: translateX(-100%); transition: transform 0.3s ease-in-out; border-right: 1px solid var(--border-color); box-sizing: border-box;}
.mobile-nav-panel.is-open { transform: translateX(0); }
.mobile-nav-panel nav { flex-grow: 1; margin-top: 2rem; }
.mobile-nav-panel nav a, .mobile-nav-panel .logout-link { color: var(--text-secondary); text-decoration: none; padding: 1rem; display: flex; align-items: center; gap: 1rem; border-radius: 8px; }
.mobile-nav-panel nav a.active { color: var(--primary-green); font-weight: 700; background-color: rgba(255,255,255,0.05); }
.close-mobile-nav { position: absolute; top: 1rem; right: 1.5rem; background: none; border: none; color: var(--text-primary); font-size: 2rem; cursor: pointer; }

/* ---- ESTILOS RESPONSIVOS ---- */
@media (max-width: 850px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 2000;
    }
    .main-content-area {
        padding: 1.5rem;
    }
    .main-header-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1.5rem;
    }
    .logo-mobile img { height: 20px; }
    .header-title h1 { font-size: 2rem; }
    .content-header { padding-bottom: 1rem; }
    .event-list-item { flex-direction: column; align-items: flex-start; }
    .modal-content { padding: 1.5rem; max-width: 95%; }
    .form-actions { justify-content: center; }
    .category-form .form-grid { grid-template-columns: 1fr; } /* Empilha os campos no mobile */
    #edit-category-form .form-grid { grid-template-columns: 1fr; } /* Empilha os campos no mobile */
}

/* Adicione isso no final do seu admin.css */

.participant-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.participant-item:last-child {
    border-bottom: none;
}

.match-item {
    background-color: var(--admin-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.match-item.open {
    border-left: 4px solid var(--primary-green);
}

.match-item.complete {
    border-left: 4px solid var(--text-secondary);
    opacity: 0.8;
}

.match-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.match-state {
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background-color: #333;
}

.match-item.open .match-state {
    background-color: var(--primary-green);
    color: #000;
}

.match-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
}

.match-player {
    flex: 1;
    text-align: center;
}

.match-player.winner {
    font-weight: bold;
    color: var(--primary-green);
}

.match-score {
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Bebas Neue', sans-serif;
    padding: 0 1rem;
    color: var(--primary-green);
}

/* ---- ESTILOS PARA O NOVO DASHBOARD ---- */

.dashboard-list-section {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-list-section h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.dashboard-list-container p {
    color: var(--text-secondary);
    padding: 1rem 0;
}

.dashboard-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.dashboard-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.dashboard-list-item:first-child {
    padding-top: 0;
}


.dashboard-list-item .event-info {
    display: flex;
    flex-direction: column;
}

.dashboard-list-item .event-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dashboard-list-item .event-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Ajusta o botão para telas menores */
@media (max-width: 500px) {
    .dashboard-list-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .dashboard-list-item .btn {
        width: 100%;
        margin-top: 0.5rem;
        justify-content: center;
    }
}

.form-container {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1.5rem;
}

/* ---- ESTILOS PARA A PÁGINA SPA DE CATEGORIAS ---- */

.category-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.list-container {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.list-container h2 {
    margin-top: 0;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Em telas maiores, coloca o formulário e a lista lado a lado */
@media (min-width: 950px) {
    .category-layout {
        /* 1fr para o formulário, 1.5fr para a lista */
        grid-template-columns: 1fr 1.5fr; 
    }
}

/* ---- ESTILOS PARA A PÁGINA SPA DO CHALLONGE ---- */

.challonge-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.challonge-controls .form-container,
.challonge-controls .list-container {
    margin-bottom: 2rem;
}

.challonge-controls .list-container:last-child,
.challonge-controls .form-container:last-child {
    margin-bottom: 0;
}

.challonge-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.challonge-actions .btn {
    justify-content: center;
}

/* Em telas maiores, coloca os controles e as partidas lado a lado */
@media (min-width: 950px) {
    .challonge-layout {
        /* 1fr para a coluna de controles, 2fr para a de partidas */
        grid-template-columns: 1fr 2fr;
    }
}

/* ---- ESTILOS PARA A PÁGINA DE CATEGORIAS UNIFICADA ---- */

.category-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

/* Em telas maiores, coloca a lista de categorias e o conteúdo lado a lado */
@media (min-width: 950px) {
    .category-layout {
        /* 1fr para a lista de categorias, 2fr para a área de conteúdo */
        grid-template-columns: 1fr 2fr;
    }
}

.category-content-area .list-container,
.category-content-area .form-container {
    margin-bottom: 2rem;
}
.category-content-area .list-container:last-child {
    margin-bottom: 0;
}

#challonge-details-content h3 {
    font-size: 1.2rem;
    margin-top: 0;
}

/* ---- ESTILOS PARA O EDITOR DE PARTIDAS ---- */

/* Torna as partidas abertas visualmente clicáveis */
.match-item.open {
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.match-item.open:hover {
    background-color: #2a2a2a;
}

.match-editor {
    background-color: #2c2c2c;
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--primary-green);
    border-radius: 0 0 8px 8px;
    padding: 1.5rem;
    margin-top: -0.5rem; /* Puxa para cima para conectar com a partida */
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.match-editor h4 {
    margin-top: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
}

.winner-selector {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.player-option {
    flex: 1;
    padding: 0.75rem;
    background-color: var(--admin-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-option:hover {
    border-color: #555;
}

.player-option.selected {
    background-color: var(--primary-green);
    color: #000;
    font-weight: bold;
    border-color: var(--primary-green);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}