/* --- BODY BACKGROUND & LAYOUT --- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 1.5rem 0;
    box-sizing: border-box;
    color: #f8fafc;
    overflow-x: hidden;

    background-color: #020617;
    background-image: 
        radial-gradient(at 0% 0%, hsla(217, 32%, 17%, 1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(215, 27%, 16%, 1) 0, transparent 50%),
        radial-gradient(at 50% 100%, hsla(221, 45%, 12%, 1) 0, transparent 50%);
}

/* --- Weather CARD --- */
.card {
    background: rgba(45, 35, 60, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                0 0 30px 4px rgba(167, 100, 240, 0.12);
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(192, 132, 252, 0.30);
    text-align: center;
    transition: opacity 0.3s ease;
}

/* --- LOADING STATE --- */
.card.loading {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(56, 189, 248, 0.3);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* --- HEADER DISPLAY --- */
#weather-icon {
    font-size: 5.5rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

#main-temp {
    font-size: 4rem;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: -2px;
    display: none;
}

#main-temp.visible {
    display: block;
}

.temp-secondary {
    font-size: 1.6rem;
    font-weight: 400;
    color: #475569;
    letter-spacing: 0;
    margin-left: 8px;
}

h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #94a3b8;
}

#description {
    text-transform: capitalize;
    color: #64748b;
    margin: 0.5rem 0 0 0;
}

/* --- FUN DESCRIPTOR --- */
.descriptor {
    font-size: 1rem;
    font-weight: 700;
    color: #38bdf8;
    margin: 0.25rem 0 1.75rem 0;
    min-height: 1.4rem;
    letter-spacing: 0.3px;
    transition: opacity 0.4s ease;
}

.descriptor.hot   { color: #fb923c; }
.descriptor.cold  { color: #93c5fd; }
.descriptor.great { color: #38bdf8; }
.descriptor.mild  { color: #86efac; }

/* --- CONTROLS --- */
.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2.5rem;
}

input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #334155;
    padding: 16px;
    border-radius: 14px;
    color: white;
    outline: none;
    transition: 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

button {
    background: #38bdf8;
    color: #0f172a;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: #7dd3fc;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(56, 189, 248, 0.4);
}

/* --- BENTO GRID --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.6s ease-out;
}

.bento-item {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.25rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.bento-item.wide {
    grid-column: span 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
}

.value {
    font-size: 1.25rem;
    color: #f1f5f9;
}

/* --- ANIMATIONS --- */
@keyframes sun-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.4)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 25px rgba(255, 255, 0, 0.6)); }
}
.hot-animation { animation: sun-pulse 2.5s infinite ease-in-out; }

@keyframes shiver {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 1px); }
    75% { transform: translate(2px, -1px); }
}
.cold-animation { animation: shiver 0.25s infinite linear; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
.perfect-animation { animation: float 4s infinite ease-in-out; }

/* --- IDLE TYPEWRITER DISPLAY --- */
#idle-display {
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0 0.5rem 0;
    transition: opacity 0.4s ease;
}

#idle-display.hidden {
    opacity: 0;
    pointer-events: none;
    min-height: 0;
    margin: 0;
}

#typewriter {
    font-size: 1rem;
    color: #38bdf8;
    font-style: italic;
    margin: 0;
    letter-spacing: 0.3px;
    min-height: 1.4rem;
}

#typewriter::after {
    content: '|';
    margin-left: 2px;
    animation: blink 0.7s step-end infinite;
}

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

/* --- MOBILE --- */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding: 1rem;
    }

    .card {
        padding: 1.75rem 1.25rem;
        border-radius: 24px;
    }

    #weather-icon { font-size: 4rem; }
    #main-temp    { font-size: 3rem; }
}
  
