:root {
    --bg-color: #f4f6f9;
    --sidebar-bg: #1e1e2d;
    --text-color: #333;
    --accent: #007bff;
    --green-qualify: #28a745; /* 1° y 2° Distrital */
    --yellow-qualify: #ffc107; /* 3° y 4° Distrital */
}


body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    display: flex;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* --- SIDEBAR (Menú Lateral) --- */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    overflow-y: auto;
    padding-bottom: 50px;
}

.brand {
    padding: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    background: #151521;
    border-bottom: 1px solid #333;
}

.menu-group {
    padding: 15px 20px 5px 20px;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: bold;
    letter-spacing: 1px;
}

.sidebar a {
    display: block;
    padding: 6px 20px;
    color: #aeb7c2;
    text-decoration: none;
    transition: 0.2s;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    background: #2a2a3c;
    color: white;
    border-left: 3px solid var(--accent);
}

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    margin-left: 260px;
    padding: 30px;
    width: 100%;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* --- TABLAS --- */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #555;
}

/* Estilos de Equipos */
.team-cell {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Nombre izq, Logo der */
    text-align: left;
    font-weight: 600;
}

.team-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    margin-left: 10px;
}

a.team-link {
    text-decoration: none;
    color: #333;
}
a.team-link:hover { color: var(--accent); }

.pts-col {
    background-color: #eef6ff;
    color: var(--accent);
    font-weight: bold;
    border-left: 1px solid #ddecff;
}

/* --- LÓGICA DE BORDES DE COLORES (CLASIFICACIÓN) --- */

/* Tablas Distritales: 1-2 Verde, 3-4 Amarillo */
.type-Distrital tbody tr:nth-child(1) td:first-child,
.type-Distrital tbody tr:nth-child(2) td:first-child {
    border-left: 5px solid var(--green-qualify);
}
.type-Distrital tbody tr:nth-child(3) td:first-child,
.type-Distrital tbody tr:nth-child(4) td:first-child {
    border-left: 5px solid var(--yellow-qualify);
}

/* Tablas Regionales/Nacionales: 1-2 Azul (o el color que prefieras) */
.type-Regional tbody tr:nth-child(1) td:first-child,
.type-Regional tbody tr:nth-child(2) td:first-child,
.type-Nacional tbody tr:nth-child(1) td:first-child,
.type-Nacional tbody tr:nth-child(2) td:first-child {
    border-left: 5px solid var(--accent);
}

/* --- PARTIDOS / FIXTURE --- */
.match-card {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}
.match-score {
    font-weight: bold;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    text-align: center;
}

hr.hr-layout {
    width: 85%;
    opacity: 0.3;
}

/* Responsive */
@media (max-width: 768px) {
   
    .main-content { margin-left: 0; }
}

a:hover {color: #007bff !important;}


/* COMPETENCIAS */
    /* --- Estilos Generales --- */
    .header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
    .year-nav { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 20px; }
    .year-btn { padding: 6px 12px; background: #fff; border: 1px solid #ddd; border-radius: 4px; text-decoration: none; color: #333; font-size: 0.9em; transition: 0.2s; }
    .year-btn:hover { background: #f0f0f0; }
    .year-btn.active { background: #007bff; color: white; border-color: #007bff; }
    .historial-btn { background: #ffc107; color: #000; border-color: #ffc107; margin-left: 10px; font-weight: bold; }

    /* Pestañas Regionales / Nacionales */
    .regional-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #eee; padding-bottom: 10px; }
    .tab-link { padding: 8px 16px; text-decoration: none; color: #555; font-weight: 500; border-radius: 4px; transition: 0.2s; }
    .tab-link:hover { background: #f0f0f0; }
    .tab-link.active { background: #007bff; color: white; }

    /* Botones Flotantes (FAB) */
    .fab-container { position: fixed; bottom: 30px; right: 30px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
    .fab-btn { width: 56px; height: 56px; border-radius: 50%; border: none; color: white; font-size: 24px; box-shadow: 0 4px 6px rgba(0,0,0,0.3); cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: transform 0.2s; }
    .fab-btn:hover { transform: scale(1.1); }
    .fab-edit { background: #007bff; }
    .fab-save { background: #28a745; }
    .fab-cancel { background: #dc3545; font-size: 20px; }

    /* --- Marcadores (Diseño Fino Restaurado) --- */
    .match-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid #eee; background: white;}
    .match-card:last-child { border-radius: 0 0 5px 5px; border-bottom: none;}
    .match-score { font-weight: bold; font-size: 1.1em; width: 90px; text-align: center; display: flex; justify-content: center; align-items: center; gap: 4px; }
    .score-input { width: 38px; height: 26px; text-align: center; border: 1px solid #bbb; border-radius: 4px; padding: 2px; font-weight: bold; font-size: 0.95em; outline: none; }
    .score-input:focus { border-color: #007bff; box-shadow: 0 0 3px rgba(0,123,255,0.5); }
    
    /* Equipos y Logos */
    .team-cell { display: flex; justify-content: flex-start; gap: 10px; }
    .team-cell a {text-decoration: none; color:#333;}
    .team-logo { width: 24px; height: 24px; object-fit: contain; }
    .team-link { color: inherit; text-decoration: none; font-weight: 500; }
    .team-link:hover { text-decoration: underline; color: #007bff; }

    /* --- Historial --- */
    .historial-full-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
    .historial-full-table th { background-color: #f8f9fa; color: #333; font-weight: bold; padding: 10px; border-bottom: 2px solid #ddd; text-align: center; }
    .historial-full-table td { padding: 8px 5px; border-bottom: 1px solid #eee; text-align: center; white-space: nowrap; }
    .historial-full-table td a { text-decoration: none; color: #333; font-weight: 500; display: block; }
    .historial-full-table td a:hover { color: #007bff; text-decoration: underline; }
    .pos-1 { background-color: #fff8e1; border-left: 3px solid #ffd700; } 
    .pos-2 { background-color: #f8f9fa; border-left: 3px solid #c0c0c0; } 
    .pos-3 { background-color: #fff5eb; border-left: 3px solid #cd7f32; } 

    /* Cuadro de Honor (Campeón) */
    .honor-box { 
        background: linear-gradient(135deg, #fffcf0 0%, #ffe0b2 100%); 
        border: 1px solid #ffcc80; 
        padding: 20px; 
        border-radius: 8px; 
        margin-top: 25px; 
        text-align: center; 
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .honor-title { font-weight: bold; color: #d35400; margin-bottom: 10px; display: block; font-size: 1.1em; text-transform: uppercase; letter-spacing: 1px;}
    .champion-name { font-size: 1.5em; font-weight: 800; color: #333; display: flex; justify-content: center; gap: 12px;}

    /* Fechas Regionales */
    .group-header {
        background-color: #343a40; color: white; padding: 8px 15px; border-radius: 5px 5px 0 0;
        margin-top: 20px; font-size: 1em; text-align: center; letter-spacing: 1px;
    }
    .date-badge {
        background-color: #e9ecef; color: #495057; padding: 3px 6px; border-radius: 4px;
        font-size: 0.75em; font-weight: bold; text-transform: uppercase; margin-right: 15px; white-space: nowrap;
    }

    /* Móvil */
    .mobile-select { display: none; }
    @media (max-width: 768px) {
        .year-nav { display: none; }
        .mobile-select { display: flex; gap: 10px; margin-bottom: 15px; }
        .mobile-select select { flex-grow: 1; padding: 8px; }
        .fab-container { bottom: 20px; right: 20px; }
        .card { overflow-x: auto; }
        .date-badge { font-size: 0.65em; padding: 2px 4px; margin-right: 5px;}
        .match-card { padding: 10px 5px; font-size: 0.9em; }
        .score-input { width: 32px; height: 24px; font-size: 0.9em; }
    }
    
    /* =========================================================
   AJUSTES DEL LAYOUT RESPONSIVE Y BUSCADOR (AGREGADO)
========================================================= */
* { box-sizing: border-box; }

.sidebar, .main-content {
    transition: all 0.3s ease;
}

/* --- BARRA SUPERIOR --- */
.top-navbar {
    background-color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    border-radius: 8px;
    position: relative;
    z-index: 10;
    flex-wrap: wrap; /* Evita que los elementos se desborden */
}

.toggle-btn {
    background: #007bff;
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.toggle-btn:hover { background: #0056b3; }

/* --- BUSCADOR NATIVO --- */
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.search-input {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 220px;
    font-size: 0.95rem;
    outline: none;
}

.search-input:focus { border-color: #007bff; box-shadow: 0 0 5px rgba(0,123,255,0.3); }

.search-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
}

/* --- ESTADO COLAPSADO EN COMPUTADORA --- */
body.sidebar-collapsed .sidebar {
    width: 70px;
    overflow-x: hidden;
}

body.sidebar-collapsed .main-content {
    margin-left: 70px;
}

body.sidebar-collapsed .brand-text { display: none; }
body.sidebar-collapsed .menu-group h5 { display: none; }

body.sidebar-collapsed .sidebar a {
    text-align: center;
    font-size: 0.75rem;
    padding: 12px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.sidebar-collapsed .hr-layout {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* --- MÓVIL (Menos de 768px) --- */
@media (max-width: 768px) {
    /* Ocultar menú fuera de la pantalla por defecto */
    .sidebar {
        left: -260px;
        z-index: 1000;
    }
    
    /* Mostrar menú al presionar el botón */
    body.mobile-menu-open .sidebar {
        left: 0;
        width: 260px;
    }

    /* Fondo oscuro transparente cuando el menú está abierto */
    body.mobile-menu-open::before {
        content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5); z-index: 999;
    }

    /* El contenido principal ocupa el 100% */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
        padding: 10px;
    }

    .top-navbar { padding: 15px; }

    /* Ajustar buscador para que baje fluidamente */
    .search-form { justify-content: flex-start; width: 100%; }
    .search-input { width: 100%; flex: 1 1 100%; }
    .vs-text { display: none; } /* Ocultar "VS" para ahorrar espacio */
    .search-btn { width: 100%; margin-top: 5px; }
}
    