/* =========================================
   GC CHESS CALENDAR - ULTRA WIDE & ADAPTIVE v3.0
   ========================================= */

:root {
    --gc-primary: #1a3b5c;
    /* Azul Corporativo */
    --gc-accent: #e0b12a;
    /* Dorado */
    --gc-dark: #0f243a;
    --gc-bg: #f4f7f6;
    --gc-surface: #ffffff;
    --gc-text: #2c3e50;
    --gc-border: #e2e8f0;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --radius-lg: 20px;
    --radius-md: 12px;
}

/* --- Layout Full Width (Romper los bordes) --- */
.gc-calendar-wrapper,
.gc-monthly-container {
    width: 100%;
    max-width: 100% !important;
    /* Forzar ancho completo */
    margin: 0 !important;
    padding: 20px 4%;
    /* Margen lateral dinámico */
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    color: var(--gc-text);
}

/* En caso de que el tema de WP limite el ancho, intentamos expandirnos */
/* Nota: Esto depende del tema padre, pero haremos lo posible */

/* --- Buscador Flotante --- */
.gc-search-bar {
    margin: 0 auto 40px;
    text-align: center;
    max-width: 800px;
    position: relative;
    z-index: 10;
}

/* --- GRID DE RESULTADOS (NETFLIX STYLE) --- */
.gc-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    padding-bottom: 50px;
}

.gc-event-card {
    background: var(--gc-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid var(--gc-border);
}

.gc-event-card:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
    z-index: 2;
}

.gc-card-image {
    width: 100%;
    height: 380px;
    /* Altura Poster */
    background-size: cover;
    background-position: center top;
    position: relative;
}

.gc-card-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.gc-card-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 3;
}

.gc-event-date {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
}

.gc-card-content {
    padding: 15px;
    text-align: center;
    background: white;
}

.gc-event-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gc-primary);
}

.gc-event-title a {
    text-decoration: none;
    color: inherit;
}

#gc-search-input {
    width: 100%;
    padding: 18px 30px;
    border: none;
    background: var(--gc-surface);
    border-radius: 50px;
    font-size: 1.1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

#gc-search-input:focus {
    outline: none;
    box-shadow: 0 15px 40px rgba(26, 59, 92, 0.15);
    transform: scale(1.01);
}

/* --- CALENDARIO MENSUAL --- */
.gc-monthly-container {
    background: var(--gc-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    /* Para contener bordes */
    padding: 0;
    /* Full bleed interno */
}

/* Header Premium */
.gc-calendar-header {
    background: linear-gradient(135deg, var(--gc-primary) 0%, var(--gc-dark) 100%);
    padding: 30px 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    flex-wrap: wrap;
    gap: 20px;
}

.gc-calendar-header h2 {
    font-size: 2rem;
    margin: 0;
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-align: center;
    flex-grow: 1;
}

/* Botones de Navegación Estilizados */
.gc-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gc-nav-btn:hover {
    background: white;
    color: var(--gc-primary);
    transform: translateY(-2px);
}

.gc-btn-pdf {
    background: var(--gc-accent);
    color: #333;
    border: none;
}

.gc-btn-pdf:hover {
    background: #f1c40f;
    transform: translateY(-2px);
    color: #000;
}

/* --- PESTAÑAS (TABS) MODERNAS --- */
.gc-tabs-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.gc-tab {
    background: transparent;
    border: 2px solid var(--gc-border);
    border-radius: 50px;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gc-text);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.gc-tab:hover {
    border-color: var(--gc-accent);
    color: var(--gc-primary);
    transform: translateY(-2px);
}

.gc-tab.active {
    background: var(--gc-primary);
    border-color: var(--gc-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 59, 92, 0.3);
}

/* --- BOTÓN CARGAR MÁS --- */
.gc-load-more-container {
    text-align: center;
    margin-top: 40px;
}

.gc-btn-load-more {
    background: white;
    border: 2px solid var(--gc-primary);
    color: var(--gc-primary);
    padding: 12px 35px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.gc-btn-load-more:hover {
    background: var(--gc-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(26, 59, 92, 0.2);
}

.gc-btn-load-more .dashicons {
    font-size: 1.2rem;
    width: auto;
    height: auto;
}

.gc-btn-load-more.loading {
    opacity: 0.7;
    cursor: wait;
}

/* --- GRID ADAPTATIVO --- */
.gc-monthly-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--gc-border);
    /* Color de las líneas */
    gap: 1px;
    /* Líneas finas */
    padding: 1px;
}

/* Cabeceras de Semana */
.gc-day-header {
    background: #f8f9fa;
    color: var(--gc-text-light);
    padding: 15px 0;
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* Celdas de Día */
.gc-day-cell {
    background: white;
    min-height: 150px;
    /* Celdas altas para ver bien */
    padding: 10px;
    position: relative;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* CRÍTICO: Evitar que el contenido empuje el ancho */
    min-width: 0;
    /* CRÍTICO: Permitir flex-shrink en grid */
}

.gc-day-cell:hover {
    background: #fdfdfd;
}

.gc-day-cell.today {
    background: #fffcf0;
    position: relative;
}

.gc-day-cell.today::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid var(--gc-accent);
    pointer-events: none;
    z-index: 1;
}

.gc-day-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--gc-primary);
    margin-bottom: 8px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 50%;
}

.gc-day-cell.today .gc-day-number {
    background: var(--gc-accent);
    color: #111;
}

.gc-day-cell.other-month {
    background: #fafafa;
    color: #ccc;
}

.gc-day-cell.other-month .gc-day-number {
    color: #ddd;
}

/* --- EVENTOS --- */
.gc-events-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.gc-event-pill {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: white;
    cursor: pointer;
    background: var(--gc-primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-left: 3px solid rgba(255, 255, 255, 0.3);

    /* Control de Desbordamiento de Texto */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    /* Asegurar que no exceda el padre */
    display: block;
    /* Comportamiento de bloque para respetar ancho */

    transition: all 0.2s;
}

.gc-event-pill:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gc-pill-torneo {
    background: linear-gradient(90deg, #1a3b5c, #2c547a);
}

.gc-pill-reunion {
    background: linear-gradient(90deg, #e0b12a, #f1c40f);
    color: #333;
}

.gc-pill-gala {
    background: linear-gradient(90deg, #8e44ad, #9b59b6);
}

/* --- MODAL ADAPTATIVO Y BONITO --- */
.gc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 36, 58, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gc-modal.visible {
    opacity: 1;
    visibility: visible;
}

.gc-modal-content {
    background: white;
    width: 90%;
    max-width: 550px;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.gc-modal.visible .gc-modal-content {
    transform: scale(1);
}

.gc-modal-header {
    background: url('https://img.freepik.com/free-vector/gradient-geometric-shape-background_23-2148424769.jpg') no-repeat center center;
    /* Fondo sutil o degradado */
    background-size: cover;
    position: relative;
    padding: 40px 30px;
    color: white;
}

.gc-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(26, 59, 92, 0.8), rgba(26, 59, 92, 0.95));
}

.gc-modal-header>* {
    position: relative;
    z-index: 2;
}

.gc-modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.gc-modal-meta {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.gc-close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: white;
    z-index: 10;
    transition: background 0.2s;
}

.gc-close-modal:hover {
    background: rgba(255, 255, 255, 0.4);
}

.gc-modal-body-inner {
    padding: 30px;
    color: #4a5568;
    line-height: 1.7;
    font-size: 1.05rem;
}

.gc-modal-body-inner img {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.gc-modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    text-align: right;
    border-top: 1px solid #eee;
}

.gc-btn-action {
    display: inline-block;
    background: var(--gc-accent);
    color: #1a3b5c;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(224, 177, 42, 0.4);
    transition: all 0.2s;
}

.gc-btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(224, 177, 42, 0.5);
    color: #1a3b5c;
}

/* --- MÓVIL FULL (Responsive Extremo) --- */
@media (max-width: 768px) {

    /* Aprovechar 100% ancho móvil */
    .gc-calendar-wrapper,
    .gc-monthly-container {
        padding: 0;
        /* Sin padding lateral wrapper */
        margin-top: 20px !important;
    }

    .gc-monthly-container {
        border-radius: 0;
        /* Plano en bordes */
        box-shadow: none;
    }

    .gc-calendar-header {
        padding: 20px 15px;
        flex-direction: column;
        gap: 15px;
    }

    .gc-calendar-header h2 {
        font-size: 1.5rem;
        order: -1;
    }

    .gc-header-left,
    .gc-header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 10px;
    }

    .gc-nav-btn {
        flex: 1;
        justify-content: center;
        padding: 12px;
    }

    /* Grid Móvil Optimizado */
    .gc-day-cell {
        min-height: 80px;
        /* Reducido pero funcional */
        padding: 4px;
    }

    .gc-day-header {
        font-size: 0.7rem;
        padding: 10px 0;
    }

    /* Eventos como Tiras finas o Puntos (Estilo Adaptativo) */
    .gc-event-pill {
        font-size: 0.65rem;
        padding: 2px 6px;
        margin-bottom: 2px;
        height: auto;
        /* Dejar que crezca si necesita */
    }

    /* Si el usuario prefiere "Puntos" en móvil muy pequeño */
    @media (max-width: 450px) {
        .gc-day-number {
            font-size: 0.9rem;
            width: 24px;
            height: 24px;
            line-height: 24px;
        }

        /* Convertir eventos a puntos de colores para ahorrar espacio */
        .gc-event-pill {
            display: inline-block;
            width: 8px;
            height: 8px;
            padding: 0;
            border-radius: 50%;
            margin-right: 3px;
            color: transparent;
            vertical-align: middle;
            border: none;
        }

        .gc-events-container {
            display: block;
            /* Para que floten */
            text-align: center;
            margin-top: 4px;
        }

        .gc-day-cell {
            min-height: 60px;
            /* Aún más compacto */
            align-items: center;
            /* Centrar números */
        }
    }

    /* Modal BOTTOM SHEET en Móvil */
    .gc-modal {
        align-items: flex-end;
        /* Abarca el fondo */
    }

    .gc-modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        /* Solo arriba */
        max-height: 85vh;
        transform: translateY(100%);
        /* Sale de abajo */
    }

    .gc-modal.visible .gc-modal-content {
        transform: translateY(0);
    }
}