/* --- Variables & Colors --- */
:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-white: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.7);
    --accent: #ff9f43;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-size: cover;
    background-position: center;
    transition: background 1s ease;
}

/* Background Variations */
.weather-clear { background: linear-gradient(135deg, #0969be 0%, #44fe00 100%); }
.weather-clouds { background: linear-gradient(135deg, #bdc3c7 0%, #2c3e50 100%); }
.weather-rain { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.weather-snow { background: linear-gradient(135deg, #e6e9f0 0%, #eef1f5 100%); }

/* --- Container --- */
.glass-container {
    width: 100%;
    max-width: 900px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    color: var(--text-white);
    position: relative;
    overflow: hidden;
}

/* --- Header & Search --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.search-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    padding: 8px 15px;
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder { color: var(--text-dim); }

.search-box button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#geo-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

#geo-btn:hover { background: var(--text-white); color: #2c3e50; }

/* --- Unit Toggle --- */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.toggle-track {
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    cursor: pointer;
    position: relative;
}

.toggle-ball {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.unit-toggle.f-active .toggle-ball { transform: translateX(20px); }
.unit-toggle span { opacity: 0.5; transition: 0.3s; }
.unit-toggle span.active { opacity: 1; text-shadow: 0 0 10px rgba(255,255,255,0.5); }

/* --- Current Weather Section --- */
.current-weather {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.main-info h1 { font-size: 3rem; font-weight: 700; }
.main-info p { color: var(--text-dim); margin-bottom: 20px; }

.temp-container {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

#main-temp { font-size: 6rem; font-weight: 800; line-height: 1; }
.degree-symbol { font-size: 3rem; vertical-align: top; margin-top: 10px; }

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.detail-card {
    background: rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--glass-border);
}

.detail-card i { font-size: 1.5rem; color: var(--accent); }
.detail-info span { display: block; font-size: 0.8rem; color: var(--text-dim); }
.detail-info strong { font-size: 1.1rem; }

/* --- Forecast Section --- */
.forecast-section { margin-top: 40px; }
.forecast-section h3 { margin-bottom: 20px; }

.forecast-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.forecast-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 10px;
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.forecast-item:hover { transform: translateY(-10px); background: rgba(255,255,255,0.1); }
.forecast-item img { width: 50px; }
.forecast-item .day { font-weight: 600; margin-bottom: 5px; }
.forecast-item .temp { font-size: 1.2rem; font-weight: 700; }

/* --- States & Animations --- */
.loading-state {
    display: none;
    text-align: center;
    padding: 50px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.error-msg {
    background: rgba(231, 76, 60, 0.2);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    display: none;
}

.app-footer { margin-top: 30px; color: rgba(255,255,255,0.6); font-size: 0.8rem; }

/* --- Responsive --- */
@media (max-width: 480px) {
    .current-weather { grid-template-columns: 1fr; text-align: center; }
    .temp-container { justify-content: center; }
    .forecast-container { grid-template-columns: repeat(3, 1fr); }
    .forecast-item:nth-child(n+4) { display: none; }
}