/* ============================================
   ESTILOS PRINCIPALES - GRÁFICA DE LÍNEAS
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    font-family: 'Segoe UI', 'Roboto', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: #0f0f1a !important;
    padding: 12px 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 600;
}

/* CONTENEDOR PRINCIPAL - OCUPA TODO EL ESPACIO */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 30px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* WRAPPER DE LA GRÁFICA - GRANDE */
.chart-wrapper {
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    flex: 1;
    min-height: 550px;
    position: relative;
}

/* CONTENEDOR DE LA GRÁFICA */
#chart_div {
    width: 100% !important;
    height: 550px !important;
    min-height: 500px !important;
    border-radius: 12px;
    position: relative;
}

/* BARRA DE CONTROLES */
.controls-bar {
    background: white;
    border-radius: 20px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.control-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.control-label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.custom-slider {
    width: 250px;
    height: 4px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 45px;
    text-align: center;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    padding: 10px 28px;
    border-radius: 30px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

/* INFO FOOTER - LEYENDA */
.info-footer {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 15px 25px;
    backdrop-filter: blur(10px);
}

.info-cards {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 40px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.info-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.blue-bg {
    background: #4285F4;
    box-shadow: 0 0 5px rgba(66, 133, 244, 0.5);
}

.red-bg {
    background: #EA4335;
    box-shadow: 0 0 5px rgba(234, 67, 53, 0.5);
}

.purple-bg {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.info-text {
    display: flex;
    flex-direction: column;
}

.info-text strong {
    font-size: 0.85rem;
    color: #333;
}

.info-text span {
    font-size: 0.7rem;
    color: #666;
}

.developer-info {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.8rem;
    color: #555;
}

.developer-info strong {
    color: #667eea;
}

/* ============================================
   MEJORAS - LOADER, ESTADÍSTICAS, TOOLTIPS
   ============================================ */

/* Loader */
.loader-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 12px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin-top: 15px;
    color: #667eea;
    font-weight: 500;
    font-size: 0.9rem;
}

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

/* Mensaje de error */
.error-message {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 1.1rem;
    color: #d32f2f;
    background: #ffebee;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

/* Panel de Estadísticas */
.stats-panel {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stats-grid {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
}

.stat-unit {
    font-size: 0.8rem;
    font-weight: normal;
    color: #888;
}

.stat-detail {
    font-size: 0.7rem;
    color: #666;
    margin-top: 4px;
}

/* Colores específicos para cada tarjeta de estadística */
.motivation-stat .stat-value {
    color: #4285F4;
}

.energy-stat .stat-value {
    color: #EA4335;
}

.productivity-stat .stat-value {
    color: #8e44ad;
}

/* Mejora en tooltips de Google Charts */
.google-visualization-tooltip {
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    border: none !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: white !important;
}

/* Animación suave para el panel de estadísticas */
.stats-panel {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE (MEJORADO)
   ============================================ */

@media (max-width: 992px) {
    .main-container {
        padding: 15px;
    }
    
    .chart-wrapper {
        min-height: 450px;
        padding: 15px;
    }
    
    #chart_div {
        height: 450px !important;
    }
    
    .controls-container {
        gap: 20px;
    }
    
    .custom-slider {
        width: 180px;
    }
    
    .stats-grid {
        gap: 15px;
    }
    
    .stat-card {
        min-width: 150px;
        padding: 10px 15px;
    }
    
    .stat-icon {
        font-size: 1.6rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .main-container {
        padding: 12px;
    }
    
    .chart-wrapper {
        min-height: 350px;
        padding: 10px;
    }
    
    #chart_div {
        height: 350px !important;
    }
    
    .controls-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .control-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .custom-slider {
        width: 200px;
    }
    
    .info-cards {
        gap: 15px;
    }
    
    .info-card {
        padding: 5px 12px;
    }
    
    .info-text strong {
        font-size: 0.75rem;
    }
    
    .info-text span {
        font-size: 0.65rem;
    }
    
    .stats-grid {
        gap: 12px;
    }
    
    .stat-card {
        min-width: 140px;
        padding: 10px 15px;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-detail {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .chart-wrapper {
        min-height: 280px;
    }
    
    #chart_div {
        height: 280px !important;
    }
    
    .custom-slider {
        width: 150px;
    }
    
    .info-cards {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .stats-grid {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-card {
        min-width: 100%;
        padding: 10px 15px;
    }
    
    .stat-icon {
        font-size: 1.4rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .generate-btn {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
    
    .control-label {
        font-size: 0.9rem;
    }
    
    .slider-value {
        padding: 3px 10px;
        font-size: 0.8rem;
    }
}

/* Soporte para pantallas muy grandes */
@media (min-width: 1600px) {
    .main-container {
        max-width: 1800px;
        padding: 30px 40px;
    }
    
    .chart-wrapper {
        min-height: 650px;
    }
    
    #chart_div {
        height: 650px !important;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .stat-icon {
        font-size: 2.5rem;
    }
}

/* Mejora para impresión */
@media print {
    body {
        background: white;
    }
    
    .navbar,
    .controls-bar,
    .info-footer,
    .loader-container {
        display: none;
    }
    
    .chart-wrapper {
        box-shadow: none;
        padding: 0;
    }
    
    #chart_div {
        height: auto !important;
    }
}

/* Accesibilidad - Focus visible */
.generate-btn:focus-visible,
.custom-slider:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reducción de movimiento para usuarios que prefieren menos animaciones */
@media (prefers-reduced-motion: reduce) {
    .generate-btn,
    .stat-card,
    .loader-spinner,
    .stats-panel {
        transition: none;
        animation: none;
    }
    
    .loader-spinner {
        animation: none;
        border-top-color: #667eea;
    }
}