:root {
    /* Premium High-End Color Palette */
    --bg-dark: #030712;
    --glass-bg: rgba(17, 24, 39, 0.6);
    --glass-border: rgba(255, 255, 255, 0.05);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --accent: #818cf8;
    /* Soft Electric Indigo */
    --font-main: 'Poppins', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background: radial-gradient(circle at top, #0f172a 0%, var(--bg-dark) 80%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-weight: 800;
    letter-spacing: -1px;
}

header h1 span {
    color: var(--accent);
}

form {
    display: flex;
    position: relative;
    width: 100%;
    max-width: 400px;
}

input {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    outline: none;
    font-size: 1rem;
    backdrop-filter: blur(12px);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(129, 140, 248, 0.15);
}

button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.3s;
}

button:hover {
    color: var(--accent);
}

/* --- Micro-interactions & 3D Interactive Hovers --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease-in-out;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
    transform: translateY(-5px) scale(1.005);
    border-color: rgba(129, 140, 248, 0.25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 30px rgba(129, 140, 248, 0.08);
}

.glass-card:hover .card-icon {
    transform: scale(1.15) rotate(10deg);
    filter: drop-shadow(0 0 8px currentColor);
}

.card-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Layout Engine */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 1.5rem;
}

.main-temp {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.main-temp h2 {
    font-size: 2.2rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.desc {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.temp-display {
    font-size: 5.5rem;
    font-weight: 800;
    margin: 0.8rem 0;
    line-height: 1;
    letter-spacing: -3px;
    color: #fff;
}

.feels-like {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.sun-curve-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
}

.sun-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sun-card-header h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 600;
}

.sun-times-badge {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem 0.9rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.canvas-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
}

.detail h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 600;
}

.detail p {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

/* Palette Theme Overrides */
.text-blue {
    color: #60a5fa;
}

.text-teal {
    color: #2dd4bf;
}

.text-purple {
    color: #c084fc;
}

.text-green {
    color: #34d399;
}

.text-yellow {
    color: #facc15;
}

.hidden {
    display: none !important;
}

#loading {
    text-align: center;
    color: var(--accent);
    padding: 2rem;
    animation: pulse 1.5s infinite;
    font-weight: 600;
    letter-spacing: 1px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --- Staggered Cascading Open Animations --- */
.animate-pop {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
}

.run-animation {
    animation: popUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popUp {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.delay-1 {
    animation-delay: 0.0s;
}

.delay-2 {
    animation-delay: 0.06s;
}

.delay-3 {
    animation-delay: 0.12s;
}

.delay-4 {
    animation-delay: 0.18s;
}

.delay-5 {
    animation-delay: 0.24s;
}

.delay-6 {
    animation-delay: 0.30s;
}

/* --- Advanced Mobile Customizations --- */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
        align-items: start;
    }

    .container {
        gap: 1.25rem;
        width: 100%;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding-left: 0.25rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    form {
        max-width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .glass-card {
        padding: 1.25rem 1rem;
        border-radius: 20px;
    }

    .main-temp {
        padding: 2rem 1rem;
    }

    .main-temp h2 {
        font-size: 1.8rem;
    }

    .temp-display {
        font-size: 4.5rem;
        margin: 0.5rem 0;
    }

    .sun-curve-card {
        min-height: 260px;
        /* Fixed height expansion */
        gap: 0.5rem;
    }

    .sun-times-badge {
        padding: 0.3rem 0.7rem;
        font-size: 0.75rem;
    }

    /* 2x2 Grid with Fixed Margin to Prevent Overlap */
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .detail p {
        font-size: 1.2rem;
    }
}