/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables - Light Theme (Default) */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --hover-bg: #f1f5f9;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #94a3b8;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --hover-bg: #334155;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Body and App Container */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}


.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-icon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon.sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-icon.moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

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

/* Search Section */
.search-section {
    margin-bottom: 40px;
    position: relative;
}

.search-container {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.city-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.city-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-btn,
.location-btn {
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover,
.location-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.location-btn {
    background: var(--secondary-color);
    padding: 14px 16px;
}

/* Suggestions Dropdown */
.suggestions {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow-lg);
}

.suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

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

.suggestion-item:hover {
    background: var(--hover-bg);
}

/* Current Weather Section */
.current-weather {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease;
}

.weather-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    margin-bottom: 30px;
    align-items: center;
}

.location-info {
    margin-bottom: 20px;
}

.city-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.current-date {
    color: var(--text-secondary);
    font-size: 1rem;
}

.temperature-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.temp-main {
    display: flex;
    align-items: flex-start;
}

.temperature {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.temp-unit {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-left: 5px;
}

.weather-icon-container {
    font-size: 4rem;
}

.weather-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    margin-top: 10px;
}

/* Weather Details Grid */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-icon {
    font-size: 1.5rem;
}

.detail-info {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Forecast Tabs */
.forecast-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Forecast Sections */
.forecast-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease;
}

.forecast-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Hourly Forecast */
.hourly-scroll {
    overflow-x: auto;
    padding-bottom: 10px;
}

.hourly-list {
    display: flex;
    gap: 15px;
    min-width: max-content;
}

.hourly-item {
    background: var(--hover-bg);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    min-width: 100px;
    transition: all 0.3s ease;
}

.hourly-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.hourly-time {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hourly-icon {
    font-size: 2rem;
    margin: 10px 0;
}

.hourly-temp {
    font-size: 1.2rem;
    font-weight: 600;
}

.hourly-rain {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Daily Forecast */
.daily-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.daily-item {
    display: grid;
    grid-template-columns: 120px 1fr auto auto;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: var(--hover-bg);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.daily-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

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

.daily-weather {
    display: flex;
    align-items: center;
    gap: 10px;
}

.daily-icon {
    font-size: 2rem;
}

.daily-desc {
    color: var(--text-secondary);
}

.daily-temps {
    display: flex;
    gap: 10px;
    align-items: center;
}

.temp-max {
    font-weight: 600;
    font-size: 1.1rem;
}

.temp-min {
    color: var(--text-secondary);
}

.daily-rain {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
}

/* History Section */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.clear-history-btn {
    padding: 10px 20px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: var(--hover-bg);
    border-radius: 12px;
    padding: 15px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    align-items: center;
}

.history-date {
    font-weight: 600;
    color: var(--text-secondary);
}

.history-location {
    font-weight: 600;
}

.history-temp {
    font-size: 1.2rem;
    font-weight: 700;
}

.no-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

[data-theme="dark"] .error-message {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.error-icon {
    font-size: 2rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 2rem;
    }

    .weather-main {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .temperature-display {
        justify-content: center;
    }

    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }

    .daily-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .daily-weather,
    .daily-temps,
    .daily-rain {
        justify-content: center;
    }

    .search-container {
        flex-direction: column;
    }

    .location-btn {
        width: 100%;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
    }


    .forecast-tabs {
        justify-content: space-between;
    }

    .tab-btn {
        flex: 1;
        padding: 10px;
        font-size: 0.9rem;
    }

    .app-footer {
        padding: 15px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 15px;
    }

    .current-weather,
    .forecast-section {
        padding: 20px;
        border-radius: 16px;
    }

    .temperature {
        font-size: 3rem;
    }

    .temp-unit {
        font-size: 1.5rem;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

}

@media (max-width: 480px) {
    .app-container {
        padding: 15px;
    }

    .current-weather,
    .forecast-section {
        padding: 20px;
        border-radius: 16px;
    }

    .temperature {
        font-size: 3rem;
    }

    .temp-unit {
        font-size: 1.5rem;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }
}

/* Footer Styles */
.app-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.app-footer p {
    margin: 0;
}

/* Print Styles */
@media print {
    .theme-toggle,
    .search-section,
    .forecast-tabs,
    .clear-history-btn,
    .language-selector,
    .app-footer {
        display: none !important;
    }

    .app-container {
        max-width: 100%;
    }

    * {
        box-shadow: none !important;
    }
}