/* ===================== DASHBOARD STYLES ===================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--green-500) 0%, var(--green-100) 100%);
    min-height: 100vh;
    padding-top: 80px;
    color: var(--white);
    line-height: 1.6;
}

/* CONTENEDOR PRINCIPAL */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.dashboard-card {
    background: rgba(22, 56, 50, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(13, 124, 102, 0.3);
}

h1 {
    color: var(--white);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 900;
}

.subtitle {
    text-align: center;
    color: var(--green-50);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding: 15px;
    background: rgba(13, 124, 102, 0.15);
    border-radius: 12px;
    border: 2px solid rgba(13, 124, 102, 0.3);
}

.status-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.loading {
    background: var(--alert-yellow);
}

.status-dot.success {
    background: var(--alert-green);
}

.status-dot.error {
    background: var(--alert-red);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

#output {
    margin-top: 2rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.data-card {
    background: linear-gradient(135deg, var(--teal-100), var(--teal-200));
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    border: 2px solid transparent;
}

.data-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(13, 124, 102, 0.5);
    border-color: var(--green-50);
}

.data-card-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--white);
    text-align: center;
}

.data-card-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 700;
}

.data-card-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.data-card-unit {
    font-size: 1.2rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.95);
}

.timestamp-box {
    margin-top: 2rem;
    padding: 20px;
    background: rgba(13, 124, 102, 0.15);
    border-radius: 12px;
    border: 2px solid rgba(13, 124, 102, 0.3);
    text-align: center;
}

.timestamp-box i {
    color: var(--teal-200);
    margin-right: 10px;
}

.error-message {
    background: linear-gradient(135deg, #ff3333, #cc0000);
    color: #fff;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    margin-top: 2rem;
    box-shadow: 0 10px 30px rgba(255, 51, 51, 0.4);
}

.error-message i {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.error-message h3 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 70px;
    height: 70px;
    border: 6px solid rgba(13, 124, 102, 0.3);
    border-top: 6px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fire-alert {
    background: linear-gradient(135deg, #ff3333, #cc0000);
    color: #fff;
    padding: 25px;
    border-radius: 16px;
    margin-top: 2rem;
    text-align: center;
    animation: alertPulse 2s infinite;
    box-shadow: 0 10px 30px rgba(255, 51, 51, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.fire-alert i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    animation: shake 0.5s infinite;
}

.fire-alert h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 800;
}

@keyframes alertPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.info-box {
    margin-bottom: 2rem;
    padding: 20px;
    background: rgba(13, 124, 102, 0.15);
    border-radius: 12px;
    border-left: 4px solid var(--teal-200);
}

.info-box i {
    color: var(--teal-200);
    margin-right: 10px;
}

/* STATS SUMMARY */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 2rem;
}

.stat-item {
    background: rgba(13, 124, 102, 0.15);
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(13, 124, 102, 0.3);
    text-align: center;
    transition: all 0.3s;
}

.stat-item:hover {
    transform: translateY(-3px);
    border-color: var(--teal-200);
    box-shadow: 0 6px 20px rgba(13, 124, 102, 0.3);
}

.stat-item i {
    font-size: 1.5rem;
    color: var(--teal-200);
    margin-bottom: 8px;
}

.stat-item-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.stat-item-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
}

/* RESPONSIVE */
@media (max-width: 968px) {
    .container {
        padding: 0 1.5rem;
    }

    .dashboard-card {
        padding: 2rem 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .data-grid {
        grid-template-columns: 1fr;
    }

    .data-card-value {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    body {
        padding-top: 70px;
    }

    .container {
        margin: 1rem auto;
    }

    .dashboard-card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.7rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }
}

/* Pequeña animación cuando llegan nuevos datos */
.timestamp-box.update-flash {
  animation: pulseUpdate 0.6s ease-out;
}

@keyframes pulseUpdate {
  0% {
    background: rgba(0, 204, 68, 0.18); /* verdecito suave */
    transform: scale(1.02);
  }
  100% {
    background: transparent;
    transform: scale(1);
  }
}

/* Pequeña animación de pulso para el status */
.status-dot.status-pulse {
  animation: statusPulse 0.5s ease-out;
}

@keyframes statusPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 204, 68, 0.5);
  }
  100% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(0, 204, 68, 0);
  }
}
