:root {
    --primary-color: #2196f3;
    --primary-dark: #1976d2;
    --secondary-color: #37474f;
    --accent-color: #ff9800;
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-light: #ffffff;
    --card-background: rgba(255, 255, 255, 0.95);
    --card-background-dark: rgba(24, 33, 47, 0.90);
    --border-radius: 16px;
    --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --box-shadow-intense: 0 12px 24px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
}

body {
    background-image: url('https://images.unsplash.com/photo-1534088568595-a066f410bcda?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
    transition: var(--transition);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.5));
    z-index: -1;
    transition: var(--transition);
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 32px 16px;
    position: relative;
    z-index: 1;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 36px;
    color: var(--text-light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 36px;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

header .accent {
    color: var(--accent-color);
}

header p {
    font-size: 16px;
    opacity: 0.9;
}

/* Search Container */
.search-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

#city-input {
    width: 100%;
    padding: 16px 50px 16px 24px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.9);
}

#city-input:focus {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

#search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}

#search-btn:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.6);
    transform: translateY(-50%) scale(1.05);
}

/* Loading State */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 40px 0;
    color: var(--text-light);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-left-color: var(--text-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Message */
.error-message {
    display: none;
    background-color: rgba(244, 67, 54, 0.9);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    margin: 24px auto;
    text-align: center;
    max-width: 480px;
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.4);
    animation: fadeIn 0.3s ease;
}

.error-message i {
    font-size: 24px;
    margin-bottom: 8px;
}

/* Weather Container */
.weather-container {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 32px;
    display: none;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: var(--box-shadow-intense);
    transform-origin: top center;
    animation: dropIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.8), rgba(25, 118, 210, 0.9));
    color: white;
    transition: var(--transition);
}

.location h2 {
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.location p {
    font-size: 16px;
    opacity: 0.9;
}

.weather-icon img {
    width: 96px;
    height: 96px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.weather-icon img:hover {
    transform: scale(1.1);
}

.weather-info {
    display: flex;
    padding: 32px;
    background-color: white;
    transition: var(--transition);
}

.temperature {
    flex: 1;
    min-width: 180px;
    padding-right: 32px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    transition: var(--transition);
}

.temperature h2 {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 12px;
    font-weight: 300;
    color: var(--text-primary);
    transition: var(--transition);
}

.temperature p {
    color: var(--text-secondary);
    font-size: 18px;
    text-transform: capitalize;
    transition: var(--transition);
}

.details {
    flex: 2;
    padding-left: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 24px;
    align-content: center;
}

.detail {
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease;
}

.detail:hover {
    transform: translateY(-2px);
}

.detail i {
    font-size: 24px;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
    transition: var(--transition);
}

.detail-info p:first-child {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
    transition: var(--transition);
}

.detail-info p:last-child {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-primary);
    transition: var(--transition);
}

/* Forecast Section */
.forecast {
    padding: 0;
    background-color: #f7f7f7;
    transition: var(--transition);
}

.forecast h3 {
    padding: 24px 32px;
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 500;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background-color: rgba(33, 150, 243, 0.05);
    transition: var(--transition);
}

.forecast-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background-color: white;
    transition: var(--transition);
}

.forecast-item {
    padding: 20px 16px;
    text-align: center;
    transition: var(--transition);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.5s ease;
    animation-fill-mode: both;
}

.forecast-item:nth-child(1) { animation-delay: 0.1s; }
.forecast-item:nth-child(2) { animation-delay: 0.2s; }
.forecast-item:nth-child(3) { animation-delay: 0.3s; }
.forecast-item:nth-child(4) { animation-delay: 0.4s; }
.forecast-item:nth-child(5) { animation-delay: 0.5s; }

.forecast-item:last-child {
    border-right: none;
}

.forecast-item:hover {
    background-color: rgba(33, 150, 243, 0.05);
}

.forecast-date {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    transition: var(--transition);
}

.forecast-icon {
    width: 56px;
    height: 56px;
    margin: 8px 0;
    transition: transform 0.3s ease;
}

.forecast-item:hover .forecast-icon {
    transform: scale(1.1);
}

.forecast-temp {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: var(--transition);
}

.forecast-desc {
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: capitalize;
    transition: var(--transition);
}

/* Night Mode Toggle */
.mode-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.mode-toggle:hover {
    background-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
}

.mode-toggle i {
    transition: transform 0.5s ease;
}

/* Dark Mode */
body.dark-mode {
    background-image: url('https://images.unsplash.com/photo-1532978379173-523e16f371f4?auto=format&fit=crop&w=1920&q=80');
}

body.dark-mode::before {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7));
}

body.dark-mode .mode-toggle i {
    transform: rotate(180deg);
}

body.dark-mode #city-input {
    background: rgba(24, 33, 47, 0.8);
    color: var(--text-light);
}

body.dark-mode #city-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

body.dark-mode .weather-container {
    background-color: var(--card-background-dark);
}

body.dark-mode .weather-header {
    background: linear-gradient(135deg, rgba(13, 71, 161, 0.9), rgba(0, 0, 0, 0.8));
}

body.dark-mode .weather-info,
body.dark-mode .forecast-container {
    background-color: #1d2733;
}

body.dark-mode .temperature h2,
body.dark-mode .detail-info p:last-child,
body.dark-mode .forecast-item .forecast-temp,
body.dark-mode .forecast-item .forecast-date {
    color: var(--text-light);
}

body.dark-mode .temperature p,
body.dark-mode .detail-info p:first-child,
body.dark-mode .forecast-item .forecast-desc {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .forecast {
    background-color: #151f2b;
}

body.dark-mode .forecast h3 {
    background-color: rgba(13, 71, 161, 0.2);
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .forecast-item {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .forecast-item:hover {
    background-color: rgba(13, 71, 161, 0.2);
}

body.dark-mode .temperature {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .detail i {
    color: #64b5f6; /* Lighter blue in dark mode */
}

/* Weather Condition Backgrounds */
body.clear-day {
    background-image: url('https://images.unsplash.com/photo-1566228015668-4c45dbc4e2f5?auto=format&fit=crop&w=1920&q=80');
}

body.clear-night {
    background-image: url('https://images.unsplash.com/photo-1532978379173-523e16f371f4?auto=format&fit=crop&w=1920&q=80');
}

body.clouds {
    background-image: url('https://images.unsplash.com/photo-1525920980995-f8a382bf42c5?auto=format&fit=crop&w=1920&q=80');
}

body.rain {
    background-image: url('https://images.unsplash.com/photo-1515694346937-94d85e41e6f0?auto=format&fit=crop&w=1920&q=80');
}

body.snow {
    background-image: url('https://images.unsplash.com/photo-1478265409131-1f65c88f965c?auto=format&fit=crop&w=1920&q=80');
}

/* Weather Condition Headers */
.weather-header.clear-day {
    background: linear-gradient(135deg, #FF9800, #FF5722);
}

.weather-header.clear-night {
    background: linear-gradient(135deg, #1A237E, #000051);
}

.weather-header.clouds {
    background: linear-gradient(135deg, #78909C, #455A64);
}

.weather-header.rain {
    background: linear-gradient(135deg, #0277BD, #01579B);
}

.weather-header.snow {
    background: linear-gradient(135deg, #90A4AE, #607D8B);
}

.weather-header.mist {
    background: linear-gradient(135deg, #546E7A, #37474F);
}

.weather-header.thunderstorm {
    background: linear-gradient(135deg, #303F9F, #1A237E);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    color: var(--text-light);
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

footer a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

footer a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }
    
    .weather-header {
        padding: 24px;
    }
    
    .weather-info {
        flex-direction: column;
        padding: 24px;
    }
    
    .temperature {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        margin-bottom: 24px;
        padding-right: 0;
        padding-bottom: 24px;
        text-align: center;
    }
    
    body.dark-mode .temperature {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .details {
        padding-left: 0;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .forecast-container {
        grid-template-columns: 1fr;
    }
    
    .forecast-item {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 16px;
    }
    
    body.dark-mode .forecast-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .forecast-item:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 28px;
    }
    
    .weather-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .details {
        grid-template-columns: 1fr;
    }
    
    .temperature h2 {
        font-size: 52px;
    }
}