* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.22);
    --glass-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    
    /* Weather Gradient Colors */
    --gradient-clear: linear-gradient(135deg, #f97316 0%, #eab308 100%);
    --gradient-clouds: linear-gradient(135deg, #64748b 0%, #475569 100%);
    --gradient-rain: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --gradient-snow: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    --gradient-mist: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    background-image: radial-gradient(circle at 10% 20%, rgba(30, 41, 59, 1) 0%, rgba(15, 23, 42, 1) 90%);
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Navbar Styling */
.navbar {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 40px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo-icon {
    font-size: 1.5rem;
    color: #38bdf8;
    filter: drop-shadow(0 2px 4px rgba(56, 189, 248, 0.3));
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 28px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease, border-color 0.3s ease;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

.nav-link i {
    font-size: 0.9rem;
    color: inherit;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff;
}

.nav-link.active {
    font-weight: 600;
    border-bottom-color: #38bdf8;
}

/* Main Content Container */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    width: 100%;
}

/* Glassmorphic App Card */
.main-div {
    width: 100%;
    max-width: 440px;
    min-height: 140px;
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    transition: background 0.6s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.main-div::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    transition: all 0.7s;
    pointer-events: none;
}

.main-div:hover {
    transform: translateY(-8px);
}

/* Dynamic Weather Backgrounds */
.weather-clear {
    background: var(--gradient-clear);
}
.weather-clouds {
    background: var(--gradient-clouds);
}
.weather-rain, .weather-drizzle, .weather-thunderstorm {
    background: var(--gradient-rain);
}
.weather-snow {
    background: var(--gradient-snow);
}
.weather-mist, .weather-smoke, .weather-haze, .weather-dust, .weather-fog, .weather-sand, .weather-ash, .weather-squall, .weather-tornado {
    background: var(--gradient-mist);
}

/* Header & Unit Switcher */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
}

.unit-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.15);
    padding: 4px 10px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.unit-label {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.5;
    transition: opacity 0.3s;
    cursor: pointer;
}

.unit-label.active {
    opacity: 1;
}

/* Toggle Switch slider */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.25);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: rgba(255, 255, 255, 0.4);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Search Box & Inputs */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

input#city-input {
    flex: 1;
    font-size: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 50px;
    padding: 12px 20px;
    height: 48px;
    transition: all 0.3s ease;
    font-family: inherit;
}

input#city-input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

input#city-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* Buttons */
.geo-btn, .search-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    height: 48px;
    width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: #ffffff;
}

.geo-btn:hover, .search-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.geo-btn:active, .search-btn:active {
    transform: scale(0.95);
}

.geo-btn i, .search-btn i {
    font-size: 1.1rem;
    color: #ffffff;
}

/* Recent Search Chips */
.recent-searches-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.recent-searches-container::-webkit-scrollbar {
    height: 3px;
}

.recent-searches-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
}

.recent-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.7;
    white-space: nowrap;
}

.recent-chips {
    display: flex;
    gap: 8px;
}

.chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
}

/* Loader / Spinner */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error message */
h3#error-msg {
    text-align: center;
    color: #fca5a5;
    margin: 20px 0;
    font-size: 1.15rem;
    background: rgba(239, 68, 68, 0.15);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Weather Hero Layout */
.hero-weather {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
}

#main-img {
    width: 140px;
    height: 140px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.weather-temp {
    margin-top: 8px;
}

#temp {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
}

.weather-desc {
    font-size: 1.15rem;
    font-weight: 500;
    opacity: 0.9;
    text-transform: capitalize;
    display: block;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

h1#city {
    font-size: 1.6rem;
    font-weight: 600;
    margin-top: 6px;
    letter-spacing: -0.5px;
    color: #ffffff;
}

/* Metrics Grid (2x2) */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.metric-card:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.18);
}

.metric-icon {
    height: 36px;
    width: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon i {
    font-size: 1.05rem;
}

/* FontAwesome Color Helpers */
.text-blue { color: #38bdf8; }
.text-teal { color: #2dd4bf; }
.text-orange { color: #fb923c; }
.text-purple { color: #c084fc; }

.metric-info {
    flex: 1;
}

.metric-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 5-Day Forecast Styling */
.forecast-section {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 20px;
}

.forecast-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: left;
}

.forecast-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forecast-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
}

.forecast-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.forecast-day {
    font-size: 0.9rem;
    font-weight: 600;
    width: 80px;
}

.forecast-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
}

.forecast-icon {
    font-size: 1.15rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* High/Low Temperature block */
.forecast-temp {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    gap: 8px;
}

.forecast-temp-max {
    color: #ffffff;
}

.forecast-temp-min {
    color: var(--text-secondary);
}

/* Professional Page Footer Styling */
.page-footer {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px 40px;
    text-align: center;
    z-index: 10;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-attribution {
    font-size: 0.8rem;
    opacity: 0.95;
}

.footer-attribution a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s, text-decoration 0.2s;
}

.footer-attribution a:hover {
    color: #0ea5e9;
    text-decoration: underline;
}

/* General removal state */
.remove {
    display: none !important;
}

/* Responsive Tweaks */
@media (max-width: 768px) {
    .navbar {
        padding: 14px 20px;
    }
    
    .nav-links {
        gap: 16px;
    }

    .main-content {
        padding: 28px 16px;
    }

    .page-footer {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .main-div {
        padding: 20px;
        border-radius: 24px;
    }

    #temp {
        font-size: 3rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .metric-card {
        padding: 10px 12px;
        gap: 8px;
    }

    .metric-icon {
        height: 30px;
        width: 30px;
    }

    .metric-value {
        font-size: 0.95rem;
    }

    .nav-brand .brand-name {
        font-size: 1.15rem;
    }

    .nav-links {
        gap: 12px;
    }

    .nav-link {
        font-size: 0.85rem;
    }
}