/* Base Styles */
:root {
    --primary-color: #3498db;
    --accent-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #333;
    --text-secondary: #666;
    --bg-color: #f5f5f5;
    --card-bg: white;
    --card-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --border-color: #ddd;
    --hover-bg: #f1f1f1;
    --transition-speed: 0.3s;
    
    /* Weather condition colors */
    --sunny-color: #f39c12;
    --cloudy-color: #95a5a6;
    --rainy-color: #3498db;
    --snowy-color: #ecf0f1;
    --stormy-color: #34495e;
}

.dark-theme {
    --primary-color: #3498db;
    --accent-color: #2ecc71;
    --danger-color: #e74c3c;
    --text-color: #f1f1f1;
    --text-secondary: #aaa;
    --bg-color: #1a1a1a;
    --card-bg: #2c2c2c;
    --card-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    --border-color: #444;
    --hover-bg: #333;
    
    /* Weather condition colors */
    --sunny-color: #f39c12;
    --cloudy-color: #95a5a6;
    --rainy-color: #3498db;
    --snowy-color: #bdc3c7;
    --stormy-color: #34495e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    position: relative;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-weight: 600;
    animation: slideDown 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
}

p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Theme Switch */
.theme-switch-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 28px;
    position: relative;
    width: 54px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 6px;
}

.slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    height: 20px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 20px;
    z-index: 1;
}

.slider .fa-sun {
    color: #f39c12;
    font-size: 12px;
}

.slider .fa-moon {
    color: #f1c40f;
    font-size: 12px;
}

input:checked + .slider {
    background-color: #2c3e50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Search Container */
.search-container {
    display: flex;
    margin-bottom: 25px;
    animation: fadeIn 0.5s ease;
}

.search-input {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input input {
    width: 100%;
    padding: 14px 15px 14px 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px 0 0 10px;
    font-size: 16px;
    transition: all 0.3s;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.geolocation-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s;
}

.geolocation-btn:hover {
    background-color: var(--hover-bg);
    transform: translateY(-50%) scale(1.1);
}

.search-container button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
}

.search-container button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.search-container button:active {
    transform: translateY(0);
}

/* Error Container */
.error-container {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--danger-color);
    display: none;
}

.error-container.show {
    display: flex;
    animation: fadeIn 0.5s;
}

.error-icon {
    font-size: 40px;
    color: var(--danger-color);
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-content {
    flex: 1;
}

.error-content h3 {
    color: var(--danger-color);
    margin-bottom: 10px;
}

.error-content p {
    margin-bottom: 15px;
}

#error-retry-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
}

#error-retry-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* Weather Container */
.weather-container {
    background: linear-gradient(to right bottom, var(--primary-color), #2980b9);
    color: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.2);
    display: none;
    position: relative;
    overflow: hidden;
}

.weather-container.show {
    display: block;
    animation: fadeIn 0.5s;
}

.weather-container.sunny {
    background: linear-gradient(to right bottom, #f39c12, #e67e22);
}

.weather-container.cloudy {
    background: linear-gradient(to right bottom, #95a5a6, #7f8c8d);
}

.weather-container.rainy {
    background: linear-gradient(to right bottom, #3498db, #2980b9);
}

.weather-container.snowy {
    background: linear-gradient(to right bottom, #ecf0f1, #bdc3c7);
    color: #34495e;
}

.weather-container.stormy {
    background: linear-gradient(to right bottom, #34495e, #2c3e50);
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.location {
    flex: 1;
}

.location h2 {
    margin-bottom: 5px;
    font-size: 28px;
    color: white;
}

.weather-container.snowy .location h2 {
    color: #34495e;
}

.date {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

.weather-container.snowy .date {
    color: rgba(52, 73, 94, 0.9);
}

.weather-icon {
    width: 100px;
    height: 100px;
    margin-left: 20px;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

/* Weather animations */
.weather-icon.rain {
    animation: rain-bounce 2s infinite ease-in-out;
}

.weather-icon.snow {
    animation: snow-float 3s infinite ease-in-out;
}

.weather-icon.sunny {
    animation: sun-pulse 4s infinite linear;
}

.weather-icon.cloudy {
    animation: cloud-float 6s infinite ease-in-out;
}

.weather-icon.stormy {
    animation: storm-shake 1s infinite ease-in-out;
}

@keyframes rain-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

@keyframes snow-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(5px) rotate(5deg); }
}

@keyframes sun-pulse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes cloud-float {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

@keyframes storm-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.temperature {
    font-size: 64px;
    font-weight: 600;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.weather-description {
    text-align: right;
}

.description {
    font-size: 22px;
    text-transform: capitalize;
    margin-bottom: 5px;
    font-weight: 500;
}

.feels-like {
    font-size: 16px;
    opacity: 0.9;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.weather-container.snowy .weather-details {
    color: #34495e;
}

.detail-item {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(5px);
}

.weather-container.snowy .detail-item {
    background-color: rgba(52, 73, 94, 0.1);
}

.detail-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 24px;
    text-align: center;
}

.detail-info {
    flex: 1;
}

.detail-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 18px;
    font-weight: 500;
}

/* Animated Background Elements */
.weather-bg-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.weather-container > * {
    position: relative;
    z-index: 2;
}

.raindrop, .snowflake, .cloud, .sun-ray, .lightning {
    position: absolute;
    opacity: 0.5;
}

/* Hourly forecast */
.hourly-container {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    display: none;
    overflow: hidden;
}

.hourly-container.show {
    display: block;
    animation: fadeIn 0.5s;
}

.hourly-forecast {
    display: flex;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.hourly-forecast::-webkit-scrollbar {
    height: 6px;
}

.hourly-forecast::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.hourly-forecast::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

.hourly-item {
    min-width: 100px;
    background-color: var(--bg-color);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    margin-right: 15px;
    transition: transform 0.3s;
    animation: fadeInRight 0.5s;
}

.hourly-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.hourly-time {
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 14px;
}

.hourly-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
}

.hourly-temp {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 5px;
}

.hourly-desc {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Forecast Container */
.forecast-container {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    display: none;
}

.forecast-container.show {
    display: block;
    animation: fadeIn 0.5s;
}

.forecast-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.forecast-item {
    flex: 1;
    min-width: 150px;
    background-color: var(--bg-color);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s;
    animation: fadeInUp 0.5s;
}

.forecast-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.forecast-date {
    font-weight: 500;
    margin-bottom: 15px;
    font-size: 16px;
}

.forecast-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
}

.forecast-temp-high {
    font-weight: 600;
    font-size: 20px;
    color: var(--text-color);
}

.forecast-temp-low {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.forecast-description {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Additional Info */
.additional-info {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    animation: fadeIn 0.5s;
}

.weather-features {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.feature {
    flex: 1;
    min-width: 120px;
    background-color: var(--bg-color);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.feature i {
    font-size: 24px;
    color: var(--primary-color);
}

.feature span {
    font-size: 14px;
    text-align: center;
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loader-spinner {
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Back Button */
.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 14px 20px;
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 16px;
}

.back-button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.back-button:active {
    transform: translateY(0);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from { 
        opacity: 0; 
        transform: translateX(-20px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .weather-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .weather-icon {
        margin: 15px 0 0;
    }
    
    .weather-main {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .weather-description {
        text-align: center;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .forecast-items {
        flex-direction: column;
    }
    
    .forecast-item {
        width: 100%;
    }
    
    .feature {
        min-width: 45%;
    }
    
    .error-container {
        flex-direction: column;
        text-align: center;
    }
    
    .error-icon {
        margin: 0 0 15px;
    }
    
    #error-retry-btn {
        margin: 0 auto;
    }
}