/* ============================================
   Estación Meteorológica IoT - Estilos
   Tema oscuro profesional con acentos azules
   ============================================ */

/* Google Fonts - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Reset y base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    line-height: 1.6;
}

/* Contenedor principal */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Encabezado */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}

.header .subtitle {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 400;
}

.header .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

/* Tarjetas */
.card {
    background-color: #1e293b;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3),
                0 1px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
}

/* Tarjeta de temperatura actual */
.card-temperatura {
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card-temperatura::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.card-temperatura .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 8px;
}

.temperatura-valor {
    font-size: 5rem;
    font-weight: 700;
    color: #38bdf8;
    line-height: 1;
    margin: 12px 0;
    position: relative;
}

.temperatura-valor .unidad {
    font-size: 2rem;
    font-weight: 400;
    color: #7dd3fc;
    vertical-align: super;
    margin-left: 4px;
}

.estado-sensor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 8px;
}

.estado-sensor .punto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    display: inline-block;
    animation: pulso 2s ease-in-out infinite;
}

@keyframes pulso {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Tarjeta de gráfica */
.card-grafica {
    padding: 20px;
}

.card-grafica .titulo-grafica {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
}

/* Info inferior */
.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.info-item {
    font-size: 0.78rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-item strong {
    color: #94a3b8;
    font-weight: 500;
}

/* Estado de conexión */
.estado-conexion {
    text-align: center;
    padding: 12px;
    font-size: 0.8rem;
    color: #64748b;
}

.estado-conexion.error {
    color: #f87171;
}

.estado-conexion.cargando {
    color: #38bdf8;
}

/* Estadísticas rápidas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #1e293b;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
}

.stat-card .stat-value.min { color: #38bdf8; }
.stat-card .stat-value.max { color: #f87171; }
.stat-card .stat-value.prom { color: #a78bfa; }

/* Footer */
.footer {
    text-align: center;
    margin-top: 24px;
    padding: 16px;
    font-size: 0.75rem;
    color: #475569;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    .container {
        padding: 16px 12px;
    }

    .header h1 {
        font-size: 1.35rem;
    }

    .temperatura-valor {
        font-size: 3.5rem;
    }

    .temperatura-valor .unidad {
        font-size: 1.5rem;
    }

    .card {
        padding: 20px;
        border-radius: 12px;
    }

    .chart-wrapper {
        height: 240px;
    }

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

    .stat-card {
        padding: 12px 8px;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .info-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}
