/**
 * VEM Torneos - Estilos Específicos para Planillas de Atletismo
 * Shortcode: [vem_atletismo_planillas]
 * Versión: UI/UX Premium Refined
 */

/* ==========================================================================
   1. Tipografía y Contenedor Principal (Layout Global)
   ========================================================================== */
.vem-athletics-sheets-wrapper {
    width: 100% !important;
    max-width: 1500px !important;
    margin: 0 auto !important;
    padding: 30px !important;
    box-sizing: border-box !important;
    font-family: "Fira Sans", "Segoe UI", Roboto, Arial, sans-serif !important;
    background-color: #f1f5f9 !important; /* Contraste suave de fondo de pantalla */
    border-radius: 12px !important;
}

/* ==========================================================================
   2. Encabezado Premium con Identidad Visual
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-header-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border: 1px solid #334155 !important;
    border-bottom: 4px solid #3b82f6 !important;
    border-radius: 10px !important;
    padding: 30px !important;
    margin-bottom: 35px !important;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.15) !important;
    position: relative;
    overflow: hidden;
}

/* Decoración geométrica sutil en el banner */
.vem-athletics-sheets-wrapper .vem-header-section::after {
    content: "" !important;
    position: absolute !important;
    top: -50% !important;
    right: -10% !important;
    width: 300px !important;
    height: 300px !important;
    background: rgba(59, 130, 246, 0.05) !important;
    transform: rotate(45deg) !important;
    border-radius: 30px !important;
    pointer-events: none !important;
}

.vem-athletics-sheets-wrapper .vem-header-section h2 {
    color: #f8fafc !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    letter-spacing: -0.5px !important;
}

.vem-athletics-sheets-wrapper .vem-header-section p {
    color: #94a3b8 !important;
    font-size: 14px !important;
    margin: 0 !important;
    line-height: 1.6 !important;
    max-width: 800px !important;
}

/* ==========================================================================
   3. Tarjeta de Filtros Avanzada (Grid de 4 Columnas)
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-athletics-filter-card {
    width: 100% !important;
    max-width: none !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 28px !important;
    margin-bottom: 35px !important;
    box-shadow: 0 4px 20px rgba(148, 163, 184, 0.08) !important;
    box-sizing: border-box !important;
}

/* Forzar reestructuración simétrica del grid a 4 columnas */
.vem-athletics-sheets-wrapper .vem-athletics-filter-card > div:first-child {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 24px !important;
    align-items: start !important; /* Alinear arriba para contemplar el select múltiple alto */
}

.vem-athletics-sheets-wrapper .vem-filter-group {
    display: flex !important;
    flex-direction: column !important;
}

/* Etiquetas elegantes */
.vem-athletics-sheets-wrapper .vem-filter-group label {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    margin-bottom: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
}

/* Unificación y Homogeneidad de Campos (Instancia, Ciudad, Grupo) */
.vem-athletics-sheets-wrapper select#vem-athletics-instancia,
.vem-athletics-sheets-wrapper select#vem-athletics-city,
.vem-athletics-sheets-wrapper select#vem-athletics-group {
    width: 100% !important;
    height: 44px !important;
    padding: 0 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: #f8fafc !important;
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease-in-out !important;
    box-sizing: border-box !important;
}

/* Estilizado del Selector Múltiple de Zonas */
.vem-athletics-sheets-wrapper select#vem-athletics-zone {
    width: 100% !important;
    height: 110px !important; /* Altura generosa para mitigar dureza visual */
    padding: 10px 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: #f8fafc !important;
    color: #0f172a !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease-in-out !important;
    box-sizing: border-box !important;
}

/* Scrollbar minimalista para el select de zonas */
.vem-athletics-sheets-wrapper select#vem-athletics-zone::-webkit-scrollbar {
    width: 6px !important;
}
.vem-athletics-sheets-wrapper select#vem-athletics-zone::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 0 8px 8px 0 !important;
}
.vem-athletics-sheets-wrapper select#vem-athletics-zone::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 3px !important;
}
.vem-athletics-sheets-wrapper select#vem-athletics-zone::-webkit-scrollbar-thumb:hover {
    background: #94a3b8 !important;
}

/* Efectos de Foco Unificados */
.vem-athletics-sheets-wrapper select:focus {
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

.vem-athletics-sheets-wrapper select:disabled {
    background-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    border-color: #cbd5e1 !important;
    opacity: 0.7 !important;
}

/* ==========================================================================
   4. Botón de Generación Principal (Protagonista Centrado)
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-athletics-filter-card > div:last-child {
    margin-top: 30px !important;
    padding-top: 20px !important;
    border-top: 1px dashed #e2e8f0 !important;
    text-align: center !important;
}

.vem-athletics-sheets-wrapper #vem-athletics-generate.vem-athletics-main-btn {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%) !important;
    border: 1px solid #1d4ed8 !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    padding: 0 40px !important;
    height: 46px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.25) !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    letter-spacing: 0.2px !important;
}

.vem-athletics-sheets-wrapper #vem-athletics-generate.vem-athletics-main-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%) !important;
    border-color: #1e40af !important;
    box-shadow: 0 6px 14px rgba(30, 64, 175, 0.35) !important;
    transform: translateY(-1px) !important;
}

.vem-athletics-sheets-wrapper #vem-athletics-generate.vem-athletics-main-btn:active:not(:disabled) {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.25) !important;
}

.vem-athletics-sheets-wrapper #vem-athletics-generate.vem-athletics-main-btn:disabled {
    background: #cbd5e1 !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.8 !important;
}

/* ==========================================================================
   5. Acciones de Descarga y Bloque de Resultados
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-athletics-actions {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    padding: 18px 24px !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.05) !important;
    margin-bottom: 30px !important;
    display: flex !important;
    gap: 14px !important;
    align-items: center !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-actions span {
    font-size: 14px !important;
    color: #475569 !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-action-btn {
    height: 38px !important;
    padding: 0 20px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

/* Contenedor de estado vacío o indicaciones */
.vem-athletics-sheets-wrapper #vem-athletics-sheets-result > p {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    color: #64748b !important;
    text-align: center !important;
}

/* ==========================================================================
   6. Hojas/Planillas de Competencia (.vem-athletics-sheet)
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-athletics-sheet {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 30px !important;
    margin-bottom: 45px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02) !important;
}

/* Títulos de las Planillas */
.vem-athletics-sheets-wrapper .vem-athletics-sheet h3,
.vem-athletics-sheets-wrapper .vem-athletics-sheet h4 {
    color: #1e3a8a !important;
    background: #eff6ff !important;
    border-left: 4px solid #3b82f6 !important;
    padding: 14px 20px !important;
    margin-top: 0 !important;
    margin-bottom: 25px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
    border-radius: 0 8px 8px 0 !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-sheet h4 {
    background: #fff7ed !important;
    border-left-color: #f97316 !important;
    color: #7c2d12 !important;
}

/* ==========================================================================
   7. Tablas Estilizadas de Competencia
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-athletics-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
    margin-bottom: 15px !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-table th {
    background: #f8fafc !important;
    color: #334155 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 12px !important;
    letter-spacing: 0.5px !important;
    padding: 12px 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-top: none !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-table th:first-child {
    background: #f1f5f9 !important;
    text-align: center !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-table td {
    padding: 12px 14px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    font-size: 13.5px !important;
}

/* Alternancia de Filas Prolija */
.vem-athletics-sheets-wrapper .vem-athletics-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-table tbody tr:hover {
    background-color: #f1f5f9 !important;
}

/* ==========================================================================
   8. Reglas de Adaptabilidad (Responsive Queries)
   ========================================================================== */

/* Pantallas Medianas / Notebooks Pequeñas */
@media screen and (max-width: 1200px) {
    .vem-athletics-sheets-wrapper .vem-athletics-filter-card > div:first-child {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

/* Tablets */
@media screen and (max-width: 991px) {
    .vem-athletics-sheets-wrapper {
        padding: 20px !important;
    }
}

/* Dispositivos Móviles */
@media screen and (max-width: 767px) {
    .vem-athletics-sheets-wrapper {
        padding: 12px !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-header-section {
        padding: 20px !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-filter-card {
        padding: 20px !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-filter-card > div:first-child {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .vem-athletics-sheets-wrapper select#vem-athletics-zone {
        height: 95px !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-action-btn,
    .vem-athletics-sheets-wrapper #vem-athletics-generate.vem-athletics-main-btn {
        width: 100% !important;
    }
}

/* ==========================================================================
   9. Reglas de Impresión Oficial (Preservadas)
   ========================================================================== */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    #adminmenuback, #adminmenuwrap, #wpadminbar, #footer, .vem-athletics-actions, .vem-athletics-filter-card, .vem-header-section, .dt-buttons {
        display: none !important;
    }
    
    @page {
        size: A4 landscape;
        margin: 10mm 10mm 10mm 10mm;
    }
    
    .vem-athletics-sheets-wrapper {
        padding: 0 !important;
        max-width: none !important;
        width: 100% !important;
        background: transparent !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-sheet {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-sheet h3,
    .vem-athletics-sheets-wrapper .vem-athletics-sheet h4 {
        background: transparent !important;
        border: none !important;
        padding: 0 0 5px 0 !important;
        color: #000000 !important;
        font-size: 16pt !important;
        border-bottom: 2px solid #000000 !important;
        border-radius: 0 !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-table th {
        background: #e2e8f0 !important;
        color: #000000 !important;
        border: 1px solid #000000 !important;
        font-size: 10pt !important;
    }
    
    .vem-athletics-sheets-wrapper .vem-athletics-table td {
        border: 1px solid #000000 !important;
        font-size: 10pt !important;
        background: transparent !important;
    }
}

/* ==========================================================================
   10. Corrección Quirúrgica: Anulación de colisiones de visibilidad con JS
   ========================================================================== */
.vem-athletics-sheets-wrapper .vem-filter-group[style*="display: none"] {
    display: none !important;
}

.vem-athletics-sheets-wrapper .vem-athletics-group-filter[style*="display: none"],
.vem-athletics-sheets-wrapper .vem-athletics-zone-filter[style*="display: none"],
.vem-athletics-sheets-wrapper .vem-athletics-city-filter[style*="display: none"] {
    display: none !important;
}