/* CSS Variables for consistent theming */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header h1 i {
    margin-right: 0.5rem;
    color: #fbbf24;
}

.app-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main content */
.weather-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Search section */
.search-section {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.search-form {
    width: 100%;
}

.input-group {
    display: flex;
    gap: 0.75rem;
}

#city-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--surface-color);
}

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

#city-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    padding: 0.875rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
    justify-content: center;
}

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

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

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 2rem;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

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

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

.loading p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Error message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error-color);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.error-message i {
    font-size: 1.25rem;
}

/* Weather display */
.weather-display {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.weather-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

/* Weather header */
.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.location-info h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.location-info p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.weather-icon img {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Weather main */
.weather-main {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.temperature-section {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.temperature {
    font-size: 4rem;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
}

.temp-unit {
    font-size: 2rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.weather-description {
    margin-bottom: 1rem;
}

.main-desc {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: capitalize;
    margin-bottom: 0.25rem;
}

.detail-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Weather details */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
}

.detail-item i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

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

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

/* Weather footer */
.weather-footer {
    text-align: center;
}

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

/* App footer */
.app-footer {
    margin-top: 2rem;
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 0.875rem;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .app-header p {
        font-size: 1rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .weather-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .temp-unit {
        font-size: 1.5rem;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .weather-card {
        padding: 1.5rem;
    }
    
    .weather-icon img {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .weather-card {
        padding: 1rem;
    }
    
    .temperature {
        font-size: 2.5rem;
    }
    
    .main-desc {
        font-size: 1.25rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .search-btn {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
    
    .weather-display {
        animation: none;
    }
    
    .search-btn {
        transition: none;
    }
    
    #city-input {
        transition: none;
    }
}
