/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #212529; /* Bootstrap dark */
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 80px; /* Espacio para el navbar inferior fijo */
}

html {
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Barra de navegación sticky superior */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 80px;
    position: relative;
    transition: all 0.3s ease;
}

.navbar-brand {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.navbar-brand h1 {
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.navbar-brand h1 i {
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.navbar-logo {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.navbar-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.navbar-logo a:hover {
    opacity: 0.8;
}

.logo-image {
    height: 60px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: all 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
}

.navbar-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.navbar-menu .menu-item:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.navbar-menu .menu-item i {
    font-size: 0.9rem;
}

.navbar-menu .menu-item i.fa-file-excel {
    color: #1d6f42;
}

.navbar-menu .menu-item span {
    font-size: 0.85rem;
}

.navbar-spacer {
    width: 40px; /* Mismo ancho que el botón hamburguesa para mantener el centrado */
}

/* Selector de idioma - Desktop (navbar) */
.lang-btn-desktop {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.lang-btn-desktop span {
    font-weight: 600;
    font-size: 12px;
}

/* Selector de idioma - Móvil (menú lateral) */
#drawerLangBtn {
    display: flex;
    align-items: center;
    gap: 10px;
}

#drawerLangBtn span {
    font-weight: 600;
    font-size: 14px;
}

.hamburger-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #3c3d3c;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: #f7fafc;
    transform: scale(1.05);
}

.hamburger-btn i {
    font-size: 18px;
}

/* Header (ahora simplificado) */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: none; /* Ocultar el header ya que el título está en la navbar */
}

/* Información del usuario */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header h1 {
    color: #4a5568;
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header h1 i {
    color: #3c3d3c;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Barra de iconos superior */
.top-actions {
    display: flex;
    gap: 10px;
}
.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #3c3d3c;
    transition: none;
}
.icon-btn:hover { transform: none; box-shadow: none; }
.icon-btn i { font-size: 16px; }

/* Menú lateral */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 4px 0 16px rgba(0,0,0,0.08);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1100;
    padding: 20px;
}
.side-menu.open { transform: translateX(0); }
.side-menu .icon-btn { width: 100%; height: 48px; justify-content: flex-start; gap: 12px; padding: 0 12px; border-radius: 12px; }
.side-menu .icon-btn i { font-size: 20px; min-width: 20px; text-align: center; }
.side-menu a.icon-btn { text-decoration: none; }
.side-menu .icon-btn { font-size: 14px; }
.side-menu .icon-btn span { font-size: 14px; color: #3c3d3c; }
.side-menu .icon-btn + .icon-btn, .side-menu .icon-btn + a.icon-btn, .side-menu a.icon-btn + .icon-btn, .side-menu a.icon-btn + a.icon-btn { margin-top: 8px; }

.menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 16px 0;
}

/* Ajustes de iconos en barra superior */
.top-actions .icon-btn { width: 40px; height: 40px; }
.top-actions .icon-btn i { font-size: 18px; }

/* Botón hamburguesa en barra inferior */
.hamburger-fab { 
    width: 40px; 
    height: 40px; 
    border: none; 
    background: transparent; 
    flex-shrink: 0;
}
.side-menu .menu-title { font-weight: 700; color: #3c3d3c; margin-bottom: 12px; }

/* 📱 CABECERA MÓVIL */
@media (max-width: 768px) {
    .navbar-content {
        padding: 15px;
        min-height: 80px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        /* Cambiar layout para móvil: botón hamburguesa a la izquierda, logo a la derecha */
        justify-content: space-between;
    }
    
    .navbar-brand h1 {
        font-size: 1.1rem;
        padding: 8px 15px;
    }
    
    .logo-image {
        height: 50px;
        max-width: 150px;
    }
    
    .navbar-logo {
        /* En móvil, el logo va a la derecha */
        margin-left: 0;
        order: 2; /* Posicionar después del navbar-brand */
    }
    
    .navbar-brand {
        /* En móvil, el título va al centro */
        order: 1;
        flex: 1;
        text-align: center;
    }
    
    .navbar-spacer {
        /* En móvil, no necesitamos el espaciador */
        display: none;
    }
    
    /* Ocultar menú horizontal en móviles */
    .navbar-menu {
        display: none;
    }
    
    /* Mostrar botón hamburguesa en móviles */
    .hamburger-btn {
        display: flex;
        order: 0; /* Botón hamburguesa a la izquierda */
    }
}

/* 💻 CABECERA DESKTOP */
@media (min-width: 769px) {
    .navbar-content {
        min-height: auto;
        border-radius: 10px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        padding: 15px 20px;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    /* Ocultar botón hamburguesa en desktop */
    .hamburger-btn {
        display: none;
    }
    
    /* Logo en desktop */
    .navbar-logo {
        order: 1;
        margin-left: 0;
    }
    
    /* Título centrado en desktop */
    .navbar-brand {
        order: 2;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    
    /* Espaciador en desktop */
    .navbar-spacer {
        order: 3;
        width: auto;
        flex: 0 0 auto;
    }
    
    /* Menú horizontal en desktop - segunda fila o a la derecha */
    .navbar-menu {
        display: flex;
        order: 4;
        flex: 1 1 100%;
        margin-left: 0;
        margin-top: 10px;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    /* Hacer los botones del menú más compactos */
    .navbar-menu .menu-item {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .navbar-menu .menu-item span {
        font-size: 0.8rem;
    }
}

/* 📱 OPTIMIZACIÓN PARA PANTALLAS MUY PEQUEÑAS */
@media (max-width: 480px) {
    .navbar-content {
        min-height: 70px;
        padding: 12px;
        border-radius: 6px;
        /* Mantener layout móvil: botón hamburguesa a la izquierda, logo a la derecha */
        justify-content: space-between;
    }
    
    .logo-image {
        height: 45px;
        max-width: 120px;
    }
    
    .navbar-brand h1 {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .navbar-logo {
        /* En móvil pequeño, el logo sigue a la derecha */
        margin-left: 0;
        order: 2;
    }
    
    .navbar-brand {
        /* Título centrado en móvil pequeño */
        order: 1;
        flex: 1;
        text-align: center;
    }
    
    .hamburger-btn {
        order: 0; /* Botón hamburguesa a la izquierda */
    }
}

/* 💻 OPTIMIZACIÓN PARA PANTALLAS GRANDES */
@media (min-width: 1200px) {
    .navbar-content {
        min-height: 140px;
        padding: 25px;
    }
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: #3c3d3c;
    color: white;
    box-shadow: 0 4px 15px rgba(60, 61, 60, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 91, 90, 0.5);
}

.btn-primary:disabled {
    background: #cbd5e0;
    color: #a0aec0;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #f093fb;
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.6);
}

.btn-outline {
    background: transparent;
    color: #3c3d3c;
    border: 2px solid #e2e8f0;
}

.btn-outline:hover {
    background: #f7fafc;
    border-color: #d1d5db;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ff6b6b;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* Contenido principal */
.main-content {
    background: #212529; /* Bootstrap dark */
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Filtros */
.filters {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.filter-group select,
.filter-group input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #3c3d3c;
    box-shadow: 0 0 0 3px rgba(60, 61, 60, 0.1);
}

/* Sección de eventos */
.events-section h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Footer enlace iniciar sesión (solo vista desktop) */
.index-footer-login {
    display: none;
    text-align: center;
    padding: 2rem 1rem 3rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}
.footer-login-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}
.footer-login-link:hover {
    color: #0d6efd;
}
@media (min-width: 769px) {
    .index-footer-login.desktop-only {
        display: flex;
    }
}
@media (max-width: 768px) {
    .index-footer-login.desktop-only {
        display: none !important;
    }
}

/* Contenedor de las dos cards */
.event-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

/* Separador de mes */
.month-separator {
    margin: 30px 0 15px 0;
    text-align: left;
    position: relative;
}

.month-separator:first-child {
    margin-top: 0;
}

.month-separator {
    position: relative;
    text-align: left;
    margin: 20px 0;
}

.month-separator .month-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #ffffff;
    display: inline-block;
    background: transparent;
    padding: 0;
    border-radius: 0;
    position: relative;
    z-index: 2;
}

/* Card de fecha */
.event-date-card {
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 160px;
    flex-shrink: 0;
    background: #f7fafc;
}

.event-date-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border-color, #3c3d3c);
}

.event-date-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.event-date-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Estilos para texto sobre fondos de categoría */
.event-date-card[style*="background:"] .event-date-large {
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.event-month-abbr {
    font-size: 1.2rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
    text-align: center;
}

/* Estilos para texto del mes sobre fondos de categoría */
.event-date-card[style*="background:"] .event-month-abbr {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Card de información */
.event-info-card {
    background: white;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
}

.event-info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border-color, #3c3d3c);
}

.event-info-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Estilos para torneos pasados - más apagados */
.event-container.past-event {
    opacity: 0.5;
    filter: grayscale(30%) brightness(0.85);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.event-container.past-event .event-date-card,
.event-container.past-event .event-info-card {
    opacity: 0.7;
}

.event-container.past-event:hover {
    opacity: 0.65;
    filter: grayscale(20%) brightness(0.9);
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    position: relative;
    box-sizing: border-box;
    padding-right: 65px; /* Límite ajustado (zona badge), más caracteres por línea */
}

/* Permitir truncado del título en contexto flex */
.event-header > div:first-child {
    min-width: 0;
}

.badge-nivel {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Estilos para badges de niveles de torneo clickeables */
.clickable-nivel-torneo {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none;
}

.clickable-nivel-torneo:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    filter: brightness(1.1) !important;
}

.clickable-nivel-torneo:active {
    transform: scale(0.98) !important;
}

.badge-categoria-edad {
    background: #84fab0;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Estilos para badges de categorías de edad clickeables */
.clickable-categoria-edad {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none;
}

.clickable-categoria-edad:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    filter: brightness(1.1) !important;
}

.clickable-categoria-edad:active {
    transform: scale(0.98) !important;
}

/* Contenedor de categorías de edad */
.categorias-edad-container {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Limitar categorías de edad a 3 por fila en móvil */
@media (max-width: 768px) {
    .categorias-edad-container {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px !important;
    }
    
    .categorias-edad-container .badge-categoria-edad {
        width: 100% !important;
        text-align: center !important;
    }
}

.event-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.event-category {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Los colores de categorías ahora vienen dinámicamente de la base de datos */

/* Estilos para categorías clickeables */
.clickable-category {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none;
}

.clickable-category:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    filter: brightness(1.1) !important;
}

.clickable-category:active {
    transform: scale(0.98) !important;
}

/* Indicador de filtro activo */
.filter-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: inherit;
    padding: 6px 10px;
    border-radius: 9999px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

/* Contenedor de múltiples indicadores */
.filters-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #3c3d3c;
    color: white;
    padding: 8px 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    align-items: center;
}


.filter-active {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.filter-active i {
    font-size: 16px;
}

.btn-clear-filter {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
}

.btn-clear-filter:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Presets de fecha */
.date-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    flex: 1;
}

/* Icono de filtro de categoría */
.btn-filter-icon {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    min-width: 32px;
    height: 32px;
    position: relative;
}

.btn-filter-icon:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    opacity: 0.7;
    transform: translateY(-1px);
}

.btn-filter-icon.active {
    opacity: 1;
    color: #3498db;
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.btn-filter-icon.active:hover {
    background: rgba(52, 152, 219, 0.2);
    border-color: #2980b9;
    color: #2980b9;
}

.btn-preset {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-preset:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.btn-preset:active {
    transform: translateY(0);
    background: #e2e8f0;
}

/* Barra inferior sticky de filtros de fecha */
.date-filter-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    z-index: 1000 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
}

/* Clase para ocultar el navbar inferior cuando el modal está abierto o en vista calendario */
.date-filter-bar.hidden,
body.modal-open .date-filter-bar,
body:has(.calendar-container) .date-filter-bar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Navbar inferior sticky con leyenda de categorías */
.categories-legend-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    z-index: 1000 !important;
    display: none !important; /* Oculto por defecto, se mostrará solo en vista mensual */
    visibility: hidden !important;
    opacity: 0 !important;
    transform: none !important;
}

/* Mostrar navbar de leyenda solo cuando hay clase calendar-view */
body:has(.calendar-container) .categories-legend-bar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.categories-legend-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    overflow-x: auto;
    overflow-y: hidden;
}

.legend-items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.categories-legend-bar .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    white-space: nowrap;
}

.categories-legend-bar .legend-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-2px);
}

.categories-legend-bar .legend-item.legend-item-active {
    background: #e6ffed;
    border-color: #38a169;
}

.categories-legend-bar .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.categories-legend-bar .legend-name {
    font-weight: 600;
    color: #2d3748;
}

.categories-legend-bar .legend-item.legend-item-active .legend-name {
    color: #22543d;
}

.categories-legend-bar .legend-check {
    color: #38a169;
    font-size: 0.75rem;
}

/* Ocultar leyenda cuando el modal está abierto o cuando tiene clase hide-legend */
body.modal-open .categories-legend-bar,
.categories-legend-bar.hide-legend {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Mostrar leyenda cuando tiene clase show-legend */
.categories-legend-bar.show-legend {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.date-filter-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 20px;
    min-height: 50px;
}

.date-filter-content .filters-indicators {
    background: transparent;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 0;
    order: 1;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: auto !important;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.date-filter-content .date-presets {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    visibility: visible;
    opacity: 1;
}

.date-filter-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-filter-control label {
    font-weight: 600;
    color: #4a5568;
}

.btn-preset.active {
    background: #3c3d3c;
    color: white;
    border-color: #3c3d3c;
}

.btn-preset.active:hover {
    background: #5a5b5a;
    border-color: #5a5b5a;
}

/* Botón de compartir */
.btn-share {
    background: #007bff;
    color: white;
    border: 1px solid #007bff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    visibility: visible !important;
    opacity: 1 !important;
}

.btn-share:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.btn-share:active {
    transform: translateY(0);
    background: #004085;
}

.btn-share .share-text-mobile {
    display: none;
}

/* Mostrar texto en móvil */
@media (max-width: 768px) {
    .btn-share .share-text-mobile {
        display: inline;
    }
}


/* Los estilos de categoría ahora se aplican dinámicamente */

/* Estilos para cards clickeables */
.clickable-event {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.clickable-event:active {
    transform: translateY(0);
}

/* Estilos para el filtro de categorías con colores */
#categoryFilter option[value="Menorca Absoluto"] {
    background: #3c3d3c;
    color: white;
}

#categoryFilter option[value="Menorca Escolar"] {
    background: #84fab0;
    color: #2d5016;
}

#categoryFilter option[value="Territoriales"] {
    background: #ffb74d;
    color: #8b4513;
}

#categoryFilter option[value="Nacionales"] {
    background: #4fc3f7;
    color: #2c5282;
}

#categoryFilter option[value="Campeonato de España"] {
    background: #f06292;
    color: #742a2a;
}

/* Estilos para el formulario de categorías con colores */
#eventCategory option[value="1"] {
    background: #3c3d3c;
    color: white;
}

#eventCategory option[value="2"] {
    background: #84fab0;
    color: #2d5016;
}

#eventCategory option[value="3"] {
    background: #ffb74d;
    color: #8b4513;
}

#eventCategory option[value="4"] {
    background: #4fc3f7;
    color: #2c5282;
}

#eventCategory option[value="5"] {
    background: #f06292;
    color: #742a2a;
}

.event-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #718096;
    font-size: 14px;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.event-location:hover {
    color: #4a5568;
}

.event-location[onclick] {
    cursor: pointer;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 4px -8px;
    transition: all 0.2s ease;
}

.event-location[onclick]:hover {
    background-color: #f7fafc;
    color: #2d3748;
    transform: translateY(-1px);
}

.event-location i {
    color: #3c3d3c;
    font-size: 12px;
}

.event-registration-deadline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333; /* Texto normal en negro por defecto (>= 15 días) */
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
}

.event-registration-deadline i {
    color: #333; /* Icono normal en negro por defecto */
    font-size: 12px;
}

.event-inter-illes {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
}

.event-inter-illes i {
    color: #333;
    font-size: 12px;
}

/* Fecha límite pasada: texto tachado */
.event-registration-deadline.past-deadline {
    color: #999;
    opacity: 0.7;
}

.event-registration-deadline.past-deadline span {
    text-decoration: line-through;
    color: #999;
}

/* Fecha de última actualización */
.event-last-update {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.7rem;
    color: #666;
    font-style: italic;
    z-index: 5;
}

.event-registration-deadline.past-deadline i {
    color: #999;
}

/* Fecha límite con advertencia (< 15 días): texto en rojo */
.event-registration-deadline.warning-deadline {
    color: #e53e3e;
}

.event-registration-deadline.warning-deadline i,
.event-registration-deadline.warning-deadline span {
    color: #e53e3e;
}

/* Animación de parpadeo para fecha límite urgente (< 5 días): rojo parpadeando */
.event-registration-deadline.urgent-deadline {
    animation: blink-warning 1.5s ease-in-out infinite;
    color: #e53e3e;
}

.event-registration-deadline.urgent-deadline i,
.event-registration-deadline.urgent-deadline span {
    animation: blink-warning 1.5s ease-in-out infinite;
    color: #e53e3e;
}

@keyframes blink-warning {
    0%, 100% {
        opacity: 1;
        color: #e53e3e;
    }
    50% {
        opacity: 0.3;
        color: #fc8181;
    }
}

.event-dates {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #718096;
    font-size: 14px;
    margin-bottom: 15px;
}

.event-dates i {
    color: #3c3d3c;
}

.event-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001; /* Mayor que el navbar inferior (1000) */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Prevenir scroll del body cuando el modal está abierto */
}

/* Cuando el modal está abierto, el body no debe tener scroll */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Ocultar navbar inferior cuando el modal está abierto */
body.modal-open .date-filter-bar {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.modal-content {
    background: white;
    margin: 8% auto;
    padding: 0;
    border-radius: 20px;
    width: 80%;
    max-width: 450px;
    max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    touch-action: manipulation;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}


@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-logo {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.modal-header h3,
.modal-header h2 {
    color: #4a5568;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #a0aec0;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f7fafc;
    color: #4a5568;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #a0aec0;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

/* Estilos para el modal de información */
.info-modal-body {
    padding: 25px;
    padding-bottom: 60px; /* Espacio extra al final */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    background: white; /* Fondo blanco */
    flex: 1; /* Ocupar espacio disponible */
    min-height: 0; /* Permitir que flex funcione */
}

/* Estilos para el modal de información */
.info-modal-body {
    padding: 25px;
    padding-bottom: 60px; /* Espacio extra al final */
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    background: white; /* Fondo blanco */
}

.info-section {
    margin-bottom: 20px;
}

.info-section h4 {
    color: #4a5568;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.info-section h5 {
    color: #4a5568;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 12px;
}

.info-item {
    margin-bottom: 15px;
    line-height: 1.6;
}

.info-item strong {
    color: #2d3748;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.info-text {
    color: #4a5568;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
    margin-top: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.info-adicional {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.info-item a {
    color: #667eea;
    text-decoration: none;
    word-break: break-all;
}

.info-item a:hover {
    text-decoration: underline;
}

/* Fecha límite pasada en modal de información */
.info-item.past-deadline {
    color: #999;
    opacity: 0.7;
}

.info-item.past-deadline span {
    text-decoration: line-through;
    color: #999;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
    color: #718096;
}

/* Estilos específicos para el formulario de cambiar contraseña */
#changePasswordModal .modal-content {
    padding: 0;
}

#changePasswordModal #changePasswordForm {
    padding: 25px;
}

#changePasswordModal .form-group input {
    padding: 15px 20px;
}

/* Estilos para el modal de importación desde Google Drive */
#googleDriveImportModal .modal-content {
    max-width: 600px;
}

#googleDriveImportStatus {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
}

#googleDriveImportStatus.info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

#googleDriveImportStatus.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

#googleDriveImportStatus.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

/* Formulario */
#eventForm {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

/* En móvil, el formulario debe ocupar el espacio disponible */
@media (max-width: 768px) {
    #eventForm {
        padding: 20px;
        padding-bottom: 0; /* El padding está en form-actions */
        display: flex;
        flex-direction: column;
    }
}

.form-group {
    margin-bottom: 16px;
}

/* Fila de formulario para fechas */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin: 0;
    font-weight: normal;
    flex-direction: row;
}

.checkbox-group label:hover {
    background: #edf2f7;
}

.checkbox-group input[type="checkbox"],
.checkbox-group input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    order: -1; /* Colocar el checkbox/radio antes del texto */
}

.checkbox-group span {
    flex: 1;
    font-size: 14px;
    color: #2d3748;
    line-height: 1.4;
    margin: 0;
}
    transition: all 0.3s ease;
}

/* Igualar tamaño de los inputs de fecha */
.form-group input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    padding: 12px 16px;
    height: auto;
    line-height: 1.2;
    border-radius: 12px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3c3d3c;
    box-shadow: 0 0 0 3px rgba(60, 61, 60, 0.1);
}

/* Estilo específico para campo URL */
.form-group input[type="url"] {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
}

.form-group input[type="url"]:focus {
    background-color: #ffffff;
}

/* Nombre del torneo solo editable al crear; en edición viene de Excel/Drive */
#eventName[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #495057;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    flex-wrap: wrap;
}

.form-actions .btn {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.form-actions .btn i {
    font-size: 14px;
}

.form-actions .btn-text {
    white-space: nowrap;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #cbd5e0;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #718096;
}

.empty-state p {
    font-size: 1rem;
    color: #a0aec0;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin-top: 30px;
    padding: 20px 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-content p {
    color: #718096;
    font-size: 14px;
    margin: 0;
}

/* Estilos para calendario mensual */
.calendar-container {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 100px; /* Espacio para el navbar inferior */
    width: 100%;
    box-sizing: border-box;
}

/* Asegurar espacio suficiente cuando el calendar-container contiene weeks-container */
.calendar-container:has(.weeks-container) {
    padding-bottom: 100px; /* Espacio extra para el navbar inferior en vista de semanas */
}

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

.calendar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.clickable-month-title,
.clickable-year-title {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.clickable-month-title:hover,
.clickable-year-title:hover {
    color: #3c3d3c;
    transform: scale(1.05);
}

.clickable-month-title:hover i,
.clickable-year-title:hover i {
    opacity: 1;
}

.btn-calendar-nav {
    background: transparent;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4a5568;
    transition: all 0.2s ease;
}

.btn-calendar-nav:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: scale(1.05);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #718096;
    padding: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f7fafc;
    border: 2px solid transparent;
    position: relative;
    padding: 4px;
    overflow: hidden;
}

/* Segmentos para días con múltiples eventos */
.calendar-day-segments {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-day-segment {
    height: 100%;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-day-segment:last-child {
    border-right: none;
}

.calendar-day-segment:hover {
    opacity: 0.85;
    filter: brightness(1.1);
}

/* Asegurar que el número del día y el contador estén sobre los segmentos */
.calendar-day.multiple-events {
    color: white;
}

.calendar-day.multiple-events .calendar-day-number {
    position: relative;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

.calendar-day.multiple-events .calendar-day-count {
    position: relative;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.calendar-day:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
}

.calendar-day.empty:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.calendar-day.today {
    border-color: #3c3d3c;
    font-weight: 700;
}

.calendar-day.has-events {
    font-weight: 600;
}

/* Efecto flash para día seleccionado */
.calendar-day.day-selected-flash {
    animation: dayFlash 2s ease-in-out;
    z-index: 100;
    position: relative;
}

@keyframes dayFlash {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0.4), 0 0 0 16px rgba(102, 126, 234, 0.2);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* Estilos para días con torneos pasados en el calendario */
.calendar-day.past-event {
    opacity: 0.5;
    filter: grayscale(30%) brightness(0.85);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.calendar-day.past-event:hover {
    opacity: 0.65;
    filter: grayscale(20%) brightness(0.9);
}

.calendar-day-number {
    font-size: 1rem;
    line-height: 1;
    position: relative;
    z-index: 5;
}

.calendar-day-count {
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 2px;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 4px;
    border-radius: 4px;
    min-width: 18px;
    text-align: center;
    position: relative;
    z-index: 5;
}

.calendar-day.multiple-events .calendar-day-count {
    background: rgba(0, 0, 0, 0.4);
    color: white;
}

.calendar-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 100px; /* Espacio para el navbar inferior */
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Contenedor para cada mes en la vista de múltiples meses */
.calendar-month-wrapper {
    margin-bottom: 40px;
}

.calendar-month-wrapper:last-child {
    margin-bottom: 20px;
}

.calendar-month-wrapper .calendar-header {
    margin-bottom: 15px;
}

.calendar-month-wrapper .calendar-grid {
    margin-bottom: 0;
}

/* Leyenda de categorías */
.categories-legend {
    display: flex !important;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    width: 100%;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Contenedor de filtros de categoría en vista de semanas - siempre 3 por fila */
.categories-legend > div:has(.legend-item) {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    justify-content: flex-start;
}

/* Botones de cambio de vista en el navbar de categorías */
.calendar-view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: center;
    width: 100%;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.calendar-view-toggle .btn {
    flex: 0 1 auto;
    min-width: 120px;
}

.calendar-view-toggle .btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
    font-weight: 600;
}

.calendar-view-toggle .btn.active:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    width: calc(33.33% - 8px); /* Siempre 3 por fila - ancho fijo */
    flex: 0 0 calc(33.33% - 8px); /* No crece ni se encoge, ancho fijo */
    min-width: calc(33.33% - 8px); /* Mínimo 3 por fila */
    max-width: calc(33.33% - 8px); /* Máximo 3 por fila */
}

.legend-item.clickable-legend {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.legend-item.clickable-legend:hover {
    background: #f7fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-item.legend-item-active {
    background: #e8f4f8;
    border: 2px solid #3498db;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.legend-item.legend-item-active:hover {
    background: #d4e8f0;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.legend-check {
    margin-left: 4px;
    color: #3498db;
    font-size: 0.75rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0; /* No se comprime */
}

.legend-name {
    color: #2d3748;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Permite truncamiento */
    flex: 1; /* Toma el espacio disponible */
}

/* Estilos para event-date-card clickeable */
.clickable-date-card {
    cursor: pointer;
}

.clickable-date-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Estilos para el título del mes y año clickeables ya están en .calendar-title */

/* Estilos para vista de semanas (TEMPORAL) */
.weeks-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 100px; /* Espacio extra para el navbar inferior */
    padding-bottom: 20px; /* Padding adicional para evitar que el navbar tape los torneos */
}

.week-card {
    background: #f7fafc;
    border-radius: 12px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.week-card.has-tournaments {
    background: #fff;
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.week-range {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2d3748;
}

.week-dates {
    font-size: 0.875rem;
    color: #718096;
}

.weekend-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.weekend-badge i {
    font-size: 0.875rem;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.week-day {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 80px;
}

.week-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

.week-day.weekend {
    background: #f0f4f8;
    border-color: #cbd5e0;
    font-weight: 600;
}

.week-day.weekend.has-events {
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    border-color: #667eea;
}

.week-day.has-events {
    border-color: #667eea;
    background: #f7fafc;
}

.week-day.today {
    border-color: #3c3d3c;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(60, 61, 60, 0.1);
}

.week-day.other-month {
    opacity: 0.4;
    background: #fafafa;
}

.day-name {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.week-day.weekend .day-name {
    color: #667eea;
}

.day-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
}

.week-day.weekend .day-number {
    color: #667eea;
}

.day-event {
    width: 100%;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-event:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.day-event.past-event {
    opacity: 0.6;
    filter: grayscale(30%);
}

.event-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive para vista de semanas */
@media (max-width: 768px) {
    .week-card {
        padding: 12px;
    }
    
    .week-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .week-days {
        gap: 4px;
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    
    .week-day {
        padding: 8px 4px;
        min-height: 70px;
    }
    
    .day-number {
        font-size: 1rem;
    }
    
    .day-event {
        font-size: 0.65rem;
        padding: 3px 4px;
    }
    
    .weekend-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .week-days {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    }
    
    .week-day {
        min-height: 60px;
        padding: 6px 3px;
    }
    
    .day-number {
        font-size: 0.9rem;
    }
    
    .day-name {
        font-size: 0.7rem;
    }
}

/* Modal de selector de mes y año */
.month-year-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.month-year-picker-modal.show {
    opacity: 1;
}

.month-year-picker-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.month-year-picker-modal.show .month-year-picker-content {
    transform: scale(1) translateY(0);
}

.picker-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.picker-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.25rem;
    font-weight: 700;
}

.picker-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.picker-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

.picker-body {
    padding: 24px;
}

.picker-section {
    margin-bottom: 24px;
}

.picker-section:last-child {
    margin-bottom: 0;
}

.picker-section label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.picker-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.picker-select:focus {
    outline: none;
    border-color: #3c3d3c;
    box-shadow: 0 0 0 3px rgba(60, 61, 60, 0.1);
}

.picker-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.picker-month-btn {
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.picker-month-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: translateY(-2px);
}

.picker-month-btn.active {
    background: linear-gradient(135deg, #3c3d3c 0%, #5a5b5a 100%);
    color: white;
    border-color: #3c3d3c;
    font-weight: 600;
}

.picker-month-btn.active:hover {
    background: linear-gradient(135deg, #5a5b5a 0%, #3c3d3c 100%);
}

.picker-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Popover de meses encima del botón Mes (navbar inferior) */
.month-filter-popover {
    position: fixed;
    z-index: 2000;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.month-filter-popover.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.month-filter-popover-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 320px;
    width: max-content;
    min-width: 260px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
}
.month-filter-popover .picker-body.month-filter-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 12px 16px;
}
.month-filter-popover .picker-header {
    padding: 10px 14px;
    flex-shrink: 0;
    border-bottom: 1px solid #e2e8f0;
}
.month-filter-popover .picker-header h3 {
    font-size: 0.95rem;
    margin: 0;
}
.month-filter-popover .picker-footer.month-filter-footer {
    padding: 10px 14px;
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}
.month-filter-popover .btn-outline-month-clear {
    border: 1px solid #cbd5e0;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.month-filter-popover .btn-outline-month-clear:hover {
    background: #f1f5f9;
    color: #475569;
}
.month-filter-popover .picker-months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 10px;
}
.month-filter-popover .month-filter-btn {
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.month-filter-popover .month-filter-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}
.month-filter-popover .month-filter-btn.active {
    background: linear-gradient(135deg, #3c3d3c 0%, #5a5b5a 100%);
    color: white;
    border-color: #3c3d3c;
    font-weight: 600;
}
.month-filter-popover .month-filter-btn.active:hover {
    background: linear-gradient(135deg, #5a5b5a 0%, #3c3d3c 100%);
}

/* Transiciones suaves entre vistas */
.events-list {
    position: relative;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
    transform-origin: center;
}

/* Animaciones de fade */
.fade-out {
    animation: fadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
}

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

/* Animaciones de slide para navegación entre meses */
.slide-out-left {
    animation: slideOutLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-out-right {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-left {
    animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Animación suave para el título del navbar */
.navbar-brand h1 {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animación para la barra de filtros */
.date-filter-bar {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transiciones para la barra de filtros */
.date-presets {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#filtersIndicators {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 0; /* Se ajustará dinámicamente según el contenido */
}

#filtersIndicators:empty,
#filtersIndicators[style*="display: none"] {
    display: none !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
}

.categories-legend {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-content {
    animation: fadeInContent 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0;
    }
    
    .main-content {
        padding: 10px;
        border-radius: 0;
    }
    
    /* En vista calendario, quitar padding del main-content */
    .main-content:has(.calendar-container) {
        padding: 0;
        overflow-x: hidden;
    }
    
    /* Asegurar que events-section no tenga overflow */
    .events-section {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Asegurar que events-list no tenga overflow */
    .events-list {
        overflow-x: hidden;
        width: 100%;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Layout móvil: cards en fila horizontal */
    .event-container {
        flex-direction: row;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    /* Card de fecha más compacta */
    .event-date-card {
        width: 80px;
        min-width: 80px;
        padding: 8px 6px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .event-date-large {
        font-size: 1.4rem;
        line-height: 1;
    }
    
    .event-month-abbr {
        font-size: 1rem;
        margin-top: 2px;
    }
    
    /* Card de información más compacta */
    .event-info-card {
        padding: 10px 12px;
        flex: 1;
    }
    
    .event-title {
        font-size: 1rem;
        margin-bottom: 4px;
        line-height: 1.2;
    }
    
    .event-category {
        font-size: 10px;
        padding: 4px 8px;
        margin-bottom: 4px;
    }
    
    .event-location {
        font-size: 11px;
        margin-top: 4px;
    }
    
    .event-location i {
        font-size: 10px;
    }
    
    .event-registration-deadline {
        font-size: 11px;
        margin-top: 4px;
    }
    
    .event-registration-deadline i {
        font-size: 10px;
    }
    
    .event-inter-illes {
        font-size: 11px;
        margin-top: 4px;
    }
    
    .event-inter-illes i {
        font-size: 10px;
    }
    
    .event-header {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 8px;
        padding-right: 55px;
    }
    
    .event-actions {
        justify-content: flex-start;
        gap: 6px;
    }
    
    .btn-small {
        padding: 6px 10px;
        font-size: 10px;
        border-radius: 6px;
    }
    
    .event-creator {
        font-size: 10px;
        margin-top: 3px;
    }
    
    /* Estilos responsive para calendario - móvil: una columna */
    .calendar-container {
        padding: 10px;
        margin: 0;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        left: 0;
        right: 0;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .calendar-title {
        font-size: 0.95rem;
        gap: 6px;
    }
    
    .clickable-month-title,
    .clickable-year-title {
        font-size: 0.85rem;
    }
    
    .clickable-month-title i,
    .clickable-year-title i {
        font-size: 0.65em;
        margin-left: 2px;
    }
    
    .calendar-header {
        margin-bottom: 10px;
        padding: 0 5px;
    }
    
    .btn-calendar-nav {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .calendar-grid {
        gap: 2px;
        margin-bottom: 10px;
    }
    
    .calendar-day {
        padding: 2px;
        min-height: 0;
        aspect-ratio: 1;
    }
    
    .calendar-day-number {
        font-size: 0.75rem;
    }
    
    .calendar-day-header {
        font-size: 0.65rem;
        padding: 4px 2px;
        letter-spacing: 0;
    }
    
    .calendar-day-count {
        font-size: 0.6rem;
        padding: 1px 3px;
        min-width: 14px;
    }
    
    .calendar-footer {
        padding-top: 8px;
        margin-top: 8px;
        border-top: 1px solid #e2e8f0;
    }
}

/* Ajustes para resoluciones de 1920x1080 - calendario con scroll vertical */
@media (min-width: 1400px) and (max-width: 1920px) and (min-height: 900px) and (max-height: 1080px) {
    /* Permitir scroll en el body para vista calendario con múltiples meses */
    body:has(.calendar-container) {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
    
    .main-content:has(.calendar-container) {
        padding: 0;
        margin: 0;
        min-height: calc(100vh - 140px); /* Restar altura del navbar superior (~140px) */
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        margin-bottom: 0; /* Sin espacio para navbar inferior en vista mensual */
        box-sizing: border-box;
    }
    
    .calendar-container {
        padding: 12px;
        margin: 0;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        min-height: calc(100vh - 140px); /* Solo restar navbar superior */
        box-sizing: border-box;
        position: relative;
        z-index: 100;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        align-items: start;
    }
    
    .calendar-month-wrapper {
        margin-bottom: 0;
        width: 100%;
    }
    
    .calendar-month-wrapper:last-child {
        margin-bottom: 20px;
    }
    
    .calendar-month-wrapper .calendar-header {
        margin-bottom: 10px;
        padding: 0;
    }
    
    .calendar-month-wrapper .calendar-title {
        font-size: 1.1rem;
        margin: 0;
    }
    
    .calendar-month-wrapper .calendar-grid {
        gap: 4px;
        margin-bottom: 0;
    }
    
    .calendar-month-wrapper .calendar-day-header {
        font-size: 0.75rem;
        padding: 4px 2px;
        font-weight: 600;
    }
    
    .calendar-month-wrapper .calendar-day {
        padding: 4px;
        font-size: 1rem;
        min-height: 40px;
        max-height: 40px;
        aspect-ratio: 1;
    }
    
    .calendar-month-wrapper .calendar-day-number {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .calendar-month-wrapper .calendar-day-count {
        font-size: 0.75rem;
        padding: 2px 4px;
        min-width: 16px;
        margin-top: 2px;
    }
    
    .calendar-month-wrapper .calendar-grid {
        gap: 0;
    }
    
    .calendar-month-wrapper .calendar-day-header {
        font-size: 0.85rem;
        padding: 6px 4px;
    }
    
    .calendar-month-wrapper .calendar-title {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .calendar-month-wrapper .calendar-day-header {
        font-size: 0.65rem;
        padding: 2px 1px;
    }
    
    .calendar-header {
        margin-bottom: 8px;
        padding: 0 5px;
        flex-shrink: 0;
        height: auto;
        min-height: 30px;
    }
    
    .calendar-title {
        font-size: 1.2rem;
        gap: 8px;
    }
    
    .clickable-month-title,
    .clickable-year-title {
        font-size: 1.1rem;
    }
    
    .btn-calendar-nav {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .calendar-grid {
        gap: 4px;
        margin-bottom: 8px;
    }
    
    .calendar-day-header {
        font-size: 0.75rem;
        padding: 4px 2px;
        letter-spacing: 0;
        height: auto;
    }
    
    .calendar-day {
        padding: 2px;
        font-size: 0.85rem;
        min-height: 35px;
        aspect-ratio: 1;
    }
    
    .calendar-day-number {
        font-size: 1.1rem;
        line-height: 1;
        font-weight: 600;
    }
    
    .calendar-day-count {
        font-size: 0.85rem;
        padding: 2px 5px;
        min-width: 18px;
    }
    
    .calendar-footer {
        padding-top: 6px;
        margin-top: 6px;
        flex-shrink: 0;
        height: auto;
        min-height: 40px;
    }
    
    .calendar-footer .btn {
        padding: 10px 16px;
        font-size: 1rem;
    }
    
    .categories-legend {
        gap: 12px;
        font-size: 0.95rem;
    }
    
    .legend-item {
        font-size: 0.95rem;
        width: calc(33.33% - 8px); /* Siempre 3 por fila - ancho fijo */
        flex: 0 0 calc(33.33% - 8px); /* No crece ni se encoge, ancho fijo */
        min-width: calc(33.33% - 8px); /* Mínimo 3 por fila */
        max-width: calc(33.33% - 8px); /* Máximo 3 por fila */
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
    }
    
    /* Estilos responsive para el selector de mes/año */
    .month-year-picker-content {
        max-width: 95%;
        width: 95%;
    }
    
    .picker-months {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .picker-month-btn {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
    
    .picker-header {
        padding: 16px 20px;
    }
    
    .picker-body {
        padding: 20px;
    }
    
    .picker-footer {
        padding: 12px 20px;
        flex-direction: column;
    }
    
    .picker-footer .btn {
        width: 100%;
    }
    
    /* Popover meses en móvil, 3 por fila */
    .month-filter-popover .month-filter-popover-content {
        max-width: min(92vw, 320px);
    }
    .month-filter-popover .picker-months-grid {
        gap: 6px 8px;
    }
    .month-filter-popover .month-filter-btn {
        padding: 6px 6px;
        font-size: 0.75rem;
    }
    
    /* Estilos adicionales para pantallas muy pequeñas */
    @media (max-width: 480px) {
        .main-content {
            padding: 10px;
        }
        
        .header {
            padding: 15px;
        }
        
        .event-container {
            gap: 8px;
            margin-bottom: 12px;
        }
        
        .event-date-card {
            width: 70px;
            min-width: 70px;
            padding: 6px 4px;
        }
        
        .event-date-large {
            font-size: 1.2rem;
        }
        
        .event-month-abbr {
            font-size: 0.9rem;
        }
        
        .event-info-card {
            padding: 8px 10px;
        }
        
        .event-header {
            padding-right: 45px;
        }
        
        .event-title {
            font-size: 0.9rem;
            line-height: 1.1;
        }
        
        .event-category {
            font-size: 9px;
            padding: 3px 6px;
        }
        
        .event-location {
            font-size: 10px;
        }
        
        .event-location i {
            font-size: 9px;
        }
        
        .event-registration-deadline {
            font-size: 10px;
        }
        
        .event-registration-deadline i {
            font-size: 9px;
        }
        
        .event-inter-illes {
            font-size: 10px;
        }
        
        .event-inter-illes i {
            font-size: 9px;
        }
        
        .btn-small {
            padding: 5px 8px;
            font-size: 9px;
        }
        
        .event-creator {
            font-size: 9px;
        }
        
        /* Ajustar fila de fechas en pantallas muy pequeñas */
        .form-row {
            gap: 8px;
            margin-bottom: 12px;
        }
        
        .form-row .form-group label {
            font-size: 12px;
            margin-bottom: 4px;
        }
        
        .form-row .form-group input {
            padding: 6px 8px;
            font-size: 12px;
        }
        
        /* Botones ultra compactos en pantallas muy pequeñas */
        .form-actions {
            gap: 6px;
            margin-top: 15px;
        }
        
        .form-actions .btn {
            padding: 8px 6px;
            font-size: 11px;
        }
        
        .form-actions .btn i {
            font-size: 14px;
        }
        
        
        .event-location {
            word-wrap: break-word;
        }
    }
    
    /* Mejoras adicionales para móvil */
    @media (max-width: 768px) {
        
        .event-location {
            word-wrap: break-word;
            overflow-wrap: break-word;
        }
        
        /* Títulos de mes en móvil */
        .month-separator {
            margin: 15px 0 8px 0;
            text-align: left;
        }
        
        .month-separator .month-title {
            font-size: 1.75rem;
            display: inline-block;
            color: #ffffff;
            background: transparent;
            padding: 0;
            border-radius: 0;
        }
        
        /* Logo en modales para móvil */
        .modal-logo {
            height: 28px;
            max-width: 100px;
        }
        
        /* Reducir espaciado general */
        .events-list {
            gap: 10px;
        }
        
        /* Ajustar indicadores de filtros */
        .filters-indicators {
            padding: 6px 10px;
            margin-bottom: 10px;
        }
        
        .filter-active {
            font-size: 12px;
        }
        
        .btn-clear-filter {
            width: 24px;
            height: 24px;
            font-size: 10px;
        }
    }
    
    .modal-content {
        margin: 1% auto;
    }
}

/* Botón para volver arriba */
.scroll-to-top-btn {
    position: fixed;
    bottom: 100px; /* Por encima del navbar inferior (80px de altura + 20px de margen) */
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3c3d3c 0%, #5a5b5a 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex !important; /* Forzar display */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001; /* Por encima del navbar (z-index: 1000) */
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none; /* Deshabilitar clics cuando está oculto */
}

.scroll-to-top-btn.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.scroll-to-top-btn:hover {
    background: linear-gradient(135deg, #5a5b5a 0%, #3c3d3c 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.scroll-to-top-btn:active {
    transform: translateY(-1px);
}

.scroll-to-top-btn i {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .scroll-to-top-btn {
        bottom: 100px; /* Por encima del navbar inferior también en móvil */
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    /* Modal fullscreen en móvil */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Altura dinámica del viewport para móviles */
        margin: 0;
        padding: 0;
        border-radius: 0;
        background-color: rgba(0, 0, 0, 0.95);
        overflow: hidden; /* Sin scroll en el modal contenedor */
        -webkit-overflow-scrolling: touch;
        touch-action: none; /* Prevenir gestos de desplazamiento en el modal */
    }
    
    .modal-content {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Sin overflow en el contenedor principal */
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y; /* Permitir scroll vertical solo */
        overscroll-behavior: contain; /* Prevenir overscroll */
    }
    
    /* Eliminar padding adicional del modal en móvil ya que es fullscreen */
    
    /* Asegurar que el header del modal esté fijo en la parte superior */
    .modal-header {
        flex-shrink: 0;
        position: relative; /* Cambiar de sticky a relative para evitar problemas */
        background: white;
        z-index: 10;
        width: 100%;
    }
    
    /* Asegurar que el formulario tenga scroll propio y esté correctamente contenido */
    #eventForm {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden; /* Prevenir scroll horizontal */
        -webkit-overflow-scrolling: touch;
        min-height: 0; /* Importante para que flex funcione correctamente */
        width: 100%;
        box-sizing: border-box;
        overscroll-behavior: contain; /* Prevenir overscroll */
        touch-action: pan-y; /* Solo permitir scroll vertical */
    }
    
    /* Prevenir que los elementos dentro del formulario se salgan */
    #eventForm * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ajustar fila de fechas en móvil */
    .form-row {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .form-row .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-row .form-group input {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .form-actions .btn,
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Asegurar que form-actions esté correctamente contenido */
    .form-actions {
        flex-direction: row;
        gap: 8px;
        margin-top: auto;
        flex-shrink: 0;
        width: 100%;
        padding: 0 20px 20px 20px;
        box-sizing: border-box;
    }
    
    .form-actions .btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 12px;
        min-width: 0;
        max-width: 100%;
    }
    
    .form-actions .btn-text {
        display: none;
    }
    
    .form-actions .btn i {
        font-size: 16px;
    }
    
    .footer-content {
        text-align: center;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-card {
    animation: fadeIn 0.5s ease;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3c3d3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Badge para torneos nuevos - arriba a la derecha de la card */
.new-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    -webkit-box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    -ms-box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    animation: pulse-new 2s ease-in-out infinite;
    -webkit-animation: pulse-new 2s ease-in-out infinite;
    -ms-animation: pulse-new 2s ease-in-out infinite;
    pointer-events: none;
}

/* Asegurar que el contenedor del mes tenga posición relativa */
.event-month-abbr {
    position: relative;
}

/* Animación para el badge nuevo */
@-webkit-keyframes pulse-new {
    0%, 100% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    }
    50% {
        opacity: 0.9;
        -webkit-transform: scale(1.05);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.8);
    }
}

@-ms-keyframes pulse-new {
    0%, 100% {
        opacity: 1;
        -ms-transform: scale(1);
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        -ms-transform: scale(1.05);
        transform: scale(1.05);
    }
}

@keyframes pulse-new {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.8);
    }
}

/* Animación para el icono de última modificación (mantener por compatibilidad) */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ocultar contenido principal hasta que se carguen los datos */
body:has(#splashScreen:not(.hidden)) .main-content,
body:has(#splashScreen:not(.hidden)) .top-navbar {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Splash Screen */
.splash-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important; /* Altura dinámica del viewport para móviles */
    min-height: 100vh !important;
    min-height: 100dvh !important;
    background: #212529 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 99999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    display: flex !important;
    flex-direction: column;
    align-items: center !important;
    justify-content: center !important;
    gap: 20px;
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    z-index: 100000 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.splash-logo {
    width: 150px !important;
    height: auto !important;
    animation: heartbeat 0.8s ease-in-out infinite !important;
    filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.3)) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-width: 100% !important;
    position: relative !important;
    z-index: 100000 !important;
}

/* Asegurar que el splash screen esté visible en móvil */
@media (max-width: 768px) {
    body:has(#splashScreen:not(.hidden)) {
        overflow: hidden !important;
    }
    
    .splash-screen {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        position: fixed !important;
        z-index: 99999 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .splash-screen.hidden {
        opacity: 0 !important;
        visibility: hidden !important;
    }
    
    .splash-logo {
        width: 120px !important;
        max-width: 80% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 100000 !important;
    }
    
    .splash-content {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 100000 !important;
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10% {
        transform: scale(1.1);
    }
    20% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.1);
    }
    40% {
        transform: scale(1);
    }
}
