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

:root {
    /* Light Mode Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-accent: #3b82f6;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --search-bg: #ffffff;
    --search-border: #d1d5db;
    --search-focus: #3b82f6;
    --button-bg: #3b82f6;
    --button-hover: #2563eb;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --success-color: #10b981;
    --error-color: #ef4444;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-accent: #60a5fa;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --search-bg: #374151;
    --search-border: #4b5563;
    --search-focus: #60a5fa;
    --button-bg: #4f46e5;
    --button-hover: #4338ca;
    --modal-bg: rgba(0, 0, 0, 0.7);
    --success-color: #34d399;
    --error-color: #f87171;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.theme-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.app-title {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 1rem;
}

/* Search Section */
.search-section {
    width: 100%;
    max-width: 500px;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    background: var(--search-bg);
    border: 2px solid var(--search-border);
    border-radius: 50px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.search-container:focus-within {
    border-color: var(--search-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

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

.search-btn {
    background: var(--button-bg);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-btn:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
}

.search-btn:active {
    transform: translateY(0);
}

/* Weather Display */
.weather-display {
    width: 100%;
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.weather-display.show {
    opacity: 1;
    transform: translateY(0);
}

.weather-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.weather-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.location-info {
    text-align: center;
    margin-bottom: 2rem;
}

.location-name {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.temperature-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.temperature {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.weather-icon {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.weather-description {
    text-align: right;
}

.description {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

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

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

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

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

/* Loading Spinner */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading.show {
    display: flex;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-btn {
    background: var(--button-bg);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-family: inherit;
}

.modal-btn:hover {
    background: var(--button-hover);
}

/* Temperature Toggle Button */
.temp-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.temp-toggle:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.temp-toggle:active {
    transform: translateY(0);
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 2rem 0 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.footer a {
    color: var(--text-accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: var(--button-bg);
    text-decoration: underline;
}

.footer a:focus {
    outline: 2px solid var(--button-bg);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .app-title {
        font-size: 2.5rem;
    }
    
    .weather-main {
        flex-direction: column;
        text-align: center;
    }
    
    .weather-description {
        text-align: center;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .weather-icon {
        font-size: 3rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-container {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .search-input {
        border-radius: 10px;
    }
    
    .search-btn {
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .weather-card {
        padding: 1.5rem;
    }
    
    .app-title {
        font-size: 2rem;
    }
}
