*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --color-btn: #4facfe;
    --color-btn-hover: #00f2fe;
}

/* --- Premium Backgrounds (Aurora Theme) --- */
.wrapper {
    width: 100vw;
    min-height: 100vh;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 10px;
    background-size: 300% 300%;
    animation: gradientMove 15s ease infinite;
    transition: background-image 0.8s ease-in-out;
    
    /* Default: Deep Midnight */
    background-image: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Dynamic Weather Gradients */
.wrapper.clear { background-image: linear-gradient(135deg, #ff7e5f, #feb47b); } /* Sunset */
.wrapper.clouds { background-image: linear-gradient(135deg, #2c3e50, #4ca1af); } /* Stormy Grey */
.wrapper.rain { background-image: linear-gradient(135deg, #000428, #004e92); } /* Deep Ocean */
.wrapper.snow { background-image: linear-gradient(135deg, #83a4d4, #b6fbff); color: #333; }
.wrapper.mist { background-image: linear-gradient(135deg, #134E5E, #71B280); } /* Forest Haze */

/* --- Glass Card --- */
.card-ui {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden; 
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
}

/* --- Tab Switcher --- */
.tab-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 30px;
    padding: 5px;
    z-index: 10;
}

.tab {
    cursor: pointer;
    font-size: 0.85rem; 
    letter-spacing: 0.5px;
    padding: 12px 5px;
    flex: 1;
    text-align: center;
    border-radius: 25px;
    transition: all 0.3s ease;
    white-space: nowrap; 
}

.tab.current-tab {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* --- Search Bar --- */
.form-container {
    display: none;
    width: 100%;
    margin-bottom: 2rem;
    position: relative;
    justify-content: center;
    gap: 10px;
    padding-top: 1rem;
}
.form-container.active { display: flex; }

.form-container input {
    all: unset;
    width: 70%;
    height: 45px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: white;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.form-container input:focus {
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    border-color: rgba(255,255,255,0.5);
}
.form-container input::placeholder { color: rgba(255, 255, 255, 0.6); }

/* --- Loader --- */
.loading-container { 
    display: none; 
    flex-direction: column;
    align-items: center;
    padding-top: 3rem; 
}
.loading-container.active { display: flex; }

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s infinite linear;
    margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Weather Info --- */
.user-info-container { display: none; padding-top: 1rem; }
.user-info-container.active { display: flex; animation: slideUp 0.6s ease; }
@keyframes slideUp { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

.name { display: flex; align-items: center; gap: 10px; margin-bottom: 0.5rem; }
.name p { font-size: 2rem; font-weight: 600; }
.name img { width: 30px; height: 20px; border-radius: 4px; }

.hero-weather { display: flex; flex-direction: column; align-items: center; margin-bottom: 2rem; }
.hero-weather img { width: 100px; height: 100px; filter: drop-shadow(0 0 15px rgba(255,255,255,0.4)); }
.hero-weather p[data-temp] { font-size: 4rem; font-weight: 800; margin: 5px 0; line-height: 1; }
.hero-weather p[data-weatherDesc] { font-size: 1.2rem; text-transform: capitalize; opacity: 0.9; }

/* Bento Grid */
.parameter-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.parameter {
    width: 30%;
    min-width: 90px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255,255,255,0.1);
}
.parameter img { width: 30px; height: 30px; }
.parameter p:first-of-type { font-size: 0.75rem; text-transform: uppercase; opacity: 0.7; }
.parameter .parameter-value { font-size: 1.1rem; font-weight: 600; }

/* 5-Day Forecast */
.forecast-container { width: 100%; margin-top: 2rem; display: flex; flex-direction: column; }
.forecast-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; text-transform: uppercase; opacity: 0.8; }
.forecast-items {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.forecast-card {
    min-width: 90px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}
.forecast-card img { width: 40px; height: 40px; }

/* Buttons */
.btn {
    all: unset;
    font-size: 0.9rem;
    border-radius: 30px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
    cursor: pointer;
    padding: 12px 30px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-align: center;
    font-weight: 600;
}
.btn:hover { transform: scale(1.05); }

/* Utility & Mobile */
.sub-container { display: flex; flex-direction: column; align-items: center; width: 100%; }
.grant-location-container, .error { display: none; text-align: center; margin-top: 2rem;}
.grant-location-container.active, .error.active { display: flex; }
.grant-location-container img, .error img { width: 100px; margin-bottom: 1rem; opacity: 0.8; }
.weather-container { width: 100%; display: flex; flex-direction: column; align-items: center; min-height: 300px; }

/* Mobile Tweaks */
@media (max-width: 400px) {
    .card-ui { padding: 1.5rem 1rem; }
    .hero-weather p[data-temp] { font-size: 3rem; }
    .parameter-container { gap: 10px; }
    .parameter { padding: 0.8rem 0.2rem; }
    
    /* Ensure tabs fit on tiny screens */
    .tab { font-size: 0.75rem; padding: 10px 2px; }
}

.user-info-container.active ~ .loading-container {
    display: none !important;
}