:root {
    --bg-gradient: linear-gradient(135deg, #60a5fa, #22d3ee);
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --input-bg: rgba(255, 255, 255, 0.25);
    --input-focus: rgba(255, 255, 255, 0.35);
    --icon-color: #ffffff;
}

.dark-mode {
    --text-color: #e2e8f0;
    --glass-bg: rgba(0, 0, 0, 0.3);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-focus: rgba(0, 0, 0, 0.4);
    --icon-color: #cbd5e1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
    color: var(--text-color);
    overflow-x: hidden;
}

.background-wrapper {
    min-height: 100vh;
    width: 100%;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: background 1s ease;
    position: relative;
}

.bg-clear-day { background: linear-gradient(135deg, #2980b9, #6dd5fa, #ffffff); }
.bg-clear-night { background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); }
.bg-cloudy-day { background: linear-gradient(135deg, #606c88, #3f4c6b); }
.bg-cloudy-night { background: linear-gradient(135deg, #232526, #414345); }
.bg-rain { background: linear-gradient(135deg, #373b44, #4286f4); }
.bg-snow { background: linear-gradient(135deg, #83a4d4, #b6fbff); }
.bg-thunder { background: linear-gradient(135deg, #141e30, #243b55); }

.container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 10;
}

header {
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: fadeInDown 1s ease-out;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header p {
    opacity: 0.9;
}

.search-bar {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    animation: fadeIn 1s ease-out 0.3s backwards;
}

.search-bar input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-bar input:focus {
    background: var(--input-focus);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.search-bar button {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar button:hover {
    background: rgba(255,255,255,0.2);
}

.search-bar button i {
    font-size: 1.25rem;
}

.weather-card {
    width: 100%;
}

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    padding: 2rem;
    text-align: center;
    color: var(--text-color);
    overflow: hidden;
    position: relative;
}

.reveal-element {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

.weather-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.weather-card p {
    font-size: 1.1rem;
    text-transform: capitalize;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.weather-icon-container {
    margin-bottom: 1rem;
}

.weather-icon-container i {
    font-size: 5rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    color: var(--icon-color);
    animation: float 3s ease-in-out infinite;
}

.temperature {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: linear-gradient(to bottom, #fff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    background: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s;
}

.detail-item:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.15);
}

.detail-item i {
    font-size: 1.5rem;
}

.detail-item div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.detail-item .label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.detail-item .value {
    font-size: 1.1rem;
    font-weight: 600;
}

.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 20;
}

.theme-toggle button {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.theme-toggle button:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(15deg) scale(1.1);
}

.theme-toggle i {
    font-size: 1.25rem;
}

.loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.error {
    background: rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    color: white;
    animation: shake 0.5s ease-in-out;
}

.hidden {
    display: none;
}

footer {
    position: absolute;
    bottom: 1rem;
    font-size: 0.8rem;
    opacity: 0.6;
    animation: fadeIn 1s ease-out 1s backwards;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@media (max-width: 480px) {
    header h1 { font-size: 2rem; }
    .temperature { font-size: 3rem; }
    .details { grid-template-columns: 1fr; }
}