:root {
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --accent: #ffd700;
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    background: #0f0c29;
    /* fallback for old browsers */
    background: -webkit-linear-gradient(to right, #24243e, #302b63, #0f0c29);
    /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to right, #24243e, #302b63, #0f0c29);
    /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

/* Background Animations */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite alternate ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #764ba2;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.globe-2 {
    width: 300px;
    height: 300px;
    background: #667eea;
    bottom: -50px;
    right: -50px;
    animation-delay: -3s;
}

.globe-3 {
    width: 250px;
    height: 250px;
    background: #ff758c;
    top: 40%;
    left: 40%;
    opacity: 0.4;
    animation-delay: -6s;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 30px);
    }
}

/* Container */
.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header & Search */
header {
    width: 100%;
    position: relative;
    z-index: 10;
}

.search-container {
    display: flex;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.unit-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s ease;
}

.unit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.unit-btn.active {
    background: white;
    color: #4a90e2;
    /* Match primary theme color or text color */
}

/* Ensure search container doesn't take full width if flexed */
.search-container {
    flex-grow: 1;
    /* max-width: 500px; - Removed to allow flex-grow to work better */
}


.search-container:focus-within {
    transform: scale(1.02);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

#city-search {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem;
    font-size: 1.1rem;
    outline: none;
    font-family: inherit;
}

#city-search::placeholder {
    color: var(--text-secondary);
}

#search-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

#search-btn:hover {
    color: var(--accent);
}

.search-results {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.search-results.hidden {
    display: none;
}

.search-item {
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Glass Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    padding: 2rem;
}

/* Current Weather */
.current-weather {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.current-weather::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: rotate(45deg);
    animation: shine 8s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.weather-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.weather-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.temp-container {
    font-size: 5rem;
    font-weight: 800;
    background: -webkit-linear-gradient(#fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.temp-container .unit {
    font-size: 2rem;
    vertical-align: super;
}

.weather-icon-container {
    text-align: center;
}

.weather-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

#weather-desc {
    font-size: 1.2rem;
    font-weight: 400;
    text-transform: capitalize;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.detail-item .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.detail-item .value {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Forecast */
.forecast-section h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.forecast-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.forecast-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.forecast-item:last-child {
    border-bottom: none;
}

.forecast-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.forecast-day {
    font-weight: 600;
}

.forecast-icon {
    font-size: 1.5rem;
    text-align: center;
}

.forecast-temp {
    text-align: right;
    font-weight: 600;
}

.forecast-temp .low {
    color: var(--text-secondary);
    margin-left: 0.5rem;
    opacity: 0.7;
}

.forecast-desc {
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results,
.glass-panel {
    animation: fadeIn 0.6s ease-out;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0;
        gap: 1.5rem;
    }

    .weather-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .weather-icon-container {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .forecast-item {
        grid-template-columns: 1fr 1fr 1.5fr;
        gap: 0.5rem;
    }

    .forecast-desc {
        display: none;
    }
}