/* ============================================
   MEJOR MES - Gráfico de precios mensuales
   Versión optimizada para ApexCharts
   ============================================ */

/* ============================================
   1. CONTENEDORES PRINCIPALES
   ============================================ */

.ohio-mejor-mes-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    padding: 25px;
    margin: 30px 0;
    border: 1px solid #eaeaea;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.ohio-mejor-mes-content {
    position: relative;
}

/* ============================================
   2. HEADER Y TÍTULOS
   ============================================ */

.ohio-mejor-mes-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.ohio-mejor-mes-titulo {
    margin: 0;
    color: #2c3e50;
    font-size: 1.6em;
    font-weight: 600;
    text-align: center;
}

.ohio-mejor-mes-subtitulo {
    margin: 8px 0 0 0;
    color: #7f8c8d;
    font-size: 0.95em;
    text-align: center;
    font-weight: 400;
    line-height: 1.4;
}

/* ============================================
   3. ESTADÍSTICAS Y DATOS
   ============================================ */

.ohio-mejor-mes-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.ohio-stat-box {
    flex: 1;
    min-width: 200px;
    background: #f8f9fa;
    padding: 18px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    transition: transform 0.2s ease;
}

.ohio-stat-box:hover {
    transform: translateY(-2px);
}

.ohio-stat-box-link {
    border-left-color: #e74c3c;
}

.ohio-stat-label {
    display: block;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ohio-stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.ohio-stat-best {
    color: #27ae60;
}

.ohio-stat-range {
    display: block;
    font-size: 0.85em;
    color: #95a5a6;
    margin-top: 5px;
}

.ohio-stat-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e74c3c;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(231, 76, 60, 0.1);
    transition: all 0.2s ease;
    margin-top: 8px;
}

.ohio-stat-link:hover {
    background: rgba(231, 76, 60, 0.2);
    transform: translateY(-1px);
}

/* ============================================
   4. CONTENEDOR DEL GRÁFICO
   ============================================ */

.ohio-mejor-mes-chart-container {
    position: relative;
    margin: 30px 0;
    background: white;
    border-radius: 12px;
    padding: 20px;
    min-height: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

/* Optimizaciones para ApexCharts */
.apexcharts-canvas {
    animation: chart-fade-in 0.8s ease-out;
}

.apexcharts-tooltip {
    border-radius: 10px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    font-family: inherit !important;
}

.apexcharts-bar-area:hover {
    cursor: pointer;
}

/* ============================================
   5. TABLA DE DATOS
   ============================================ */

.ohio-mejor-mes-tabla {
    margin-top: 30px;
    overflow-x: auto;
}

.ohio-mejor-mes-tabla h4 {
    margin: 0 0 18px 0;
    color: #34495e;
    font-size: 1.3em;
    font-weight: 600;
}

.ohio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.ohio-table thead {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.ohio-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 0.95em;
}

.ohio-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    color: #555;
    vertical-align: middle;
}

.ohio-table tbody tr {
    transition: all 0.2s ease;
}

.ohio-table tbody tr:hover {
    background-color: #f9f9f9;
}

.ohio-table-best {
    background-color: #e8f5e9 !important;
    border-left: 4px solid #27ae60;
}

/* ============================================
   6. BOTONES Y ENLACES
   ============================================ */

.ohio-table-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #3498db;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 80px;
}

.ohio-table-link:hover {
    background: #2980b9;
    transform: scale(1.05);
    color: white;
}

.ohio-mejor-mes-boton {
    margin-top: 30px;
    text-align: center;
}

.ohio-boton-busqueda {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 16px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    border: none;
    cursor: pointer;
    min-width: 280px;
}

.ohio-boton-busqueda:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.ohio-boton-busqueda i {
    font-size: 1.1em;
}

/* ============================================
   7. INDICADORES Y TENDENCIAS
   ============================================ */

.ohio-tendencia {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    border-left: 3px solid transparent;
}

.ohio-tendencia-baja {
    background-color: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border-left-color: #27ae60;
}

.ohio-tendencia-baja-media {
    background-color: rgba(213, 245, 227, 0.8);
    color: #0f5132;
    border-left-color: #75b798;
}

.ohio-tendencia-media {
    background-color: rgba(255, 243, 205, 0.8);
    color: #856404;
    border-left-color: #ffc107;
}

.ohio-tendencia-alta-media {
    background-color: rgba(248, 215, 218, 0.8);
    color: #842029;
    border-left-color: #ea868f;
}

.ohio-tendencia-alta {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border-left-color: #e74c3c;
}

/* ============================================
   8. INFORMACIÓN ADICIONAL
   ============================================ */

.ohio-mejor-mes-info {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.ohio-mejor-mes-nota {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9em;
    line-height: 1.6;
    text-align: center;
}

.ohio-mejor-mes-nota i {
    color: #3498db;
    margin-right: 8px;
}

/* ============================================
   9. ALERTAS Y MENSAJES
   ============================================ */

.ohio-alert {
    padding: 18px 22px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid;
    font-size: 0.95em;
    line-height: 1.5;
}

.ohio-alert-warning {
    background-color: rgba(255, 243, 205, 0.9);
    border-color: #ffc107;
    color: #856404;
}

.ohio-alert-info {
    background-color: rgba(209, 236, 241, 0.9);
    border-color: #17a2b8;
    color: #0c5460;
}

/* ============================================
   10. ANIMACIONES
   ============================================ */

@keyframes chart-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ohio-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.ohio-loading {
    animation: ohio-pulse 1.5s infinite;
    text-align: center;
    padding: 50px;
    color: #7f8c8d;
    font-size: 1.1em;
}

/* ============================================
   11. RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 992px) {
    .ohio-mejor-mes-container {
        padding: 20px;
        margin: 25px 0;
    }
    
    .ohio-stat-box {
        min-width: calc(50% - 15px);
    }
}

@media (max-width: 768px) {
    .ohio-mejor-mes-container {
        padding: 18px;
        margin: 20px 0;
        border-radius: 10px;
    }
    
    .ohio-mejor-mes-titulo {
        font-size: 1.4em;
    }
    
    .ohio-mejor-mes-subtitulo {
        font-size: 0.9em;
    }
    
    .ohio-mejor-mes-stats {
        flex-direction: column;
        gap: 12px;
    }
    
    .ohio-stat-box {
        min-width: 100%;
        padding: 16px;
    }
    
    .ohio-mejor-mes-chart-container {
        padding: 15px;
        margin: 25px 0;
        min-height: 350px;
    }
    
    .ohio-table th,
    .ohio-table td {
        padding: 12px 15px;
        font-size: 0.9em;
    }
    
    .ohio-boton-busqueda {
        padding: 14px 28px;
        font-size: 1em;
        min-width: 250px;
        width: 100%;
        max-width: 300px;
    }
    
    .ohio-table-link {
        padding: 5px 10px;
        font-size: 0.8em;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .ohio-mejor-mes-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .ohio-mejor-mes-titulo {
        font-size: 1.2em;
    }
    
    .ohio-stat-value {
        font-size: 1.3em;
    }
    
    .ohio-mejor-mes-chart-container {
        padding: 12px;
        min-height: 300px;
    }
    
    .ohio-boton-busqueda {
        padding: 12px 24px;
        font-size: 0.95em;
        min-width: 200px;
    }
    
    .ohio-table {
        font-size: 0.85em;
    }
    
    .ohio-table th,
    .ohio-table td {
        padding: 10px 12px;
    }
}

/* ============================================
   12. ESTADOS DE INTERACCIÓN
   ============================================ */

.ohio-stat-box:active,
.ohio-table-link:active,
.ohio-boton-busqueda:active {
    transform: scale(0.98);
}

/* ============================================
   13. ESTILOS PARA FALLBACK (cuando no hay gráfico)
   ============================================ */

.simple-chart-fallback {
    padding: 20px;
    text-align: center;
}

.simple-chart-fallback h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.simple-chart-fallback > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.simple-chart-fallback > div > div {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    transition: transform 0.2s ease;
}

.simple-chart-fallback > div > div:hover {
    transform: translateY(-2px);
    background: #eef2f7;
}

.simple-chart-fallback > div > div > div:first-child {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
    margin-bottom: 8px;
}

.simple-chart-fallback > div > div > div:nth-child(2) {
    color: #27ae60;
    font-size: 1.4em;
    font-weight: 700;
    margin: 10px 0;
}

.simple-chart-fallback > div > div > a {
    display: inline-block;
    padding: 6px 14px;
    background: #3498db;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.simple-chart-fallback > div > div > a:hover {
    background: #2980b9;
}

/* ============================================
   14. UTILIDADES
   ============================================ */

.price-indicator {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 10px;
    right: 10px;
}

.price-low { background-color: #27ae60; }
.price-medium { background-color: #f39c12; }
.price-high { background-color: #e74c3c; }

/* Clases para accesibilidad */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ============================================
   15. MEJORAS PARA IMPRESIÓN
   ============================================ */

@media print {
    .ohio-mejor-mes-container {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .ohio-boton-busqueda,
    .ohio-table-link,
    .ohio-stat-link {
        display: none !important;
    }
    
    .ohio-mejor-mes-chart-container {
        background: white;
        border: 1px solid #ccc;
    }
}