:root {
    --bg-deep: #020617;
    --accent-blue: #38bdf8;
    --accent-teal: #2dd4bf;
    --accent-rose: #fb7185;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --gradient-primary: linear-gradient(135deg, #38bdf8 0%, #2dd4bf 100%);
    --gradient-danger: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* --- Dynamic Mesh Background --- */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 0% 0%, #0c1e3a 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, #062130 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, #1a1b3a 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, #1e1b4b 0%, transparent 50%);
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    animation: move 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, rgba(45, 212, 191, 0.15) 0%, transparent 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 30%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 50px) scale(1.1);
    }
}

/* --- Container & Layout --- */
.container {
    width: 100%;
    max-width: 1100px;
    padding: 2.5rem;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 400;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2.5rem;
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.5rem;
    }
}

/* --- Premium Glassmorphism Cards --- */
.card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: 0 4px 64px -8px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    z-index: 5;
}

.card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 80px -12px rgba(56, 189, 248, 0.15);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

/* --- Weather Widget --- */
.weather-main {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.weather-icon {
    font-size: 4.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.3));
}

.weather-temp {
    font-size: 4.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
}

.weather-desc {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Ventilation Status --- */
.ventilation-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-viz {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.05);
}

.status-indicator {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.status-icon {
    font-size: 3.5rem;
    color: var(--accent-blue);
    transition: all 0.5s ease;
}

.pulse-ring {
    position: absolute;
    width: 130%;
    height: 130%;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    opacity: 0;
}

/* --- Active State Styling --- */
.is-ventilating .status-indicator {
    background: rgba(251, 113, 133, 0.1);
    box-shadow: 0 0 40px rgba(251, 113, 133, 0.2);
}

.is-ventilating .status-icon {
    color: var(--accent-rose);
    animation: rotateVent 4s linear infinite;
}

@keyframes rotateVent {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.is-ventilating .pulse-ring {
    border-color: var(--accent-rose);
    animation: pulseOut 2s infinite;
}

@keyframes pulseOut {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.timer-display {
    font-size: 5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.5s ease;
}

.is-ventilating .timer-display {
    background: var(--gradient-danger);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.timer-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 2.5rem;
}

/* --- Buttons --- */
.btn {
    position: relative;
    width: 100%;
    padding: 1.25rem;
    border-radius: 20px;
    border: none;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    background: var(--gradient-primary);
    box-shadow: 0 10px 25px -5px rgba(56, 189, 248, 0.4);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(56, 189, 248, 0.5);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.is-ventilating .btn {
    background: #1e293b;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.is-ventilating .btn:hover {
    background: #334155;
}

/* --- Utility --- */
.fadeIn {
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loader {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.loader-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    margin: 0 4px;
    animation: bounce 0.6s infinite alternate;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    to {
        transform: translateY(-10px);
    }
}