:root {
    --primary: #1e88e5;
    --primary-dark: #1565c0;
    --primary-light: #42a5f5;
    --accent: #ff6e40;
    --background: #f5f5f5;
    --surface: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --success: #4caf50;
    --error: #f44336;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--background);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.install-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.install-btn:hover {
    background-color: #ff5722;
    transform: scale(1.05);
}

.install-btn:active {
    transform: scale(0.98);
}

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Search section */
.search-section {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.city-input {
    flex: 1;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: var(--surface);
}

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

.search-btn {
    padding: 0.9rem 1.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.location-btn {
    padding: 0.9rem 1.2rem;
    background-color: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.location-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

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

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

/* Error */
.error {
    background-color: #ffebee;
    color: var(--error);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--error);
}

/* Weather Container */
.weather-container {
    animation: fadeIn 0.3s ease;
}

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

.weather-main {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.city-info {
    margin-bottom: 1.5rem;
}

.city-info h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.city-info p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.temperature-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.temperature-display {
    display: flex;
    align-items: flex-start;
}

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

.unit {
    font-size: 2rem;
    margin-top: 0.5rem;
}

.weather-description {
    flex: 1;
}

.weather-description p {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Weather Details */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-card {
    background-color: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.detail-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.detail-icon {
    font-size: 2rem;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-info {
    flex: 1;
}

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

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

/* Forecast */
.forecast-section {
    margin-top: 2rem;
}

.forecast-section h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.forecast-day {
    background-color: var(--surface);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.forecast-day:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.forecast-day .date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.forecast-day .icon {
    font-size: 2rem;
    margin: 0.5rem 0;
}

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

.forecast-day .temp-min {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Saved Cities */
.saved-cities {
    margin-top: 2rem;
}

.saved-cities h3 {
    margin-bottom: 1rem;
}

.cities-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.city-card {
    background-color: var(--surface);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.city-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background-color: #f0f7ff;
}

.city-card .city-name {
    font-weight: 500;
}

.city-card .delete-btn {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.city-card:hover .delete-btn {
    opacity: 1;
}

/* Footer */
.footer {
    background-color: var(--surface);
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

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

    .temperature-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .weather-main {
        padding: 1.5rem;
    }

    .temperature {
        font-size: 3rem;
    }

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

    .forecast-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

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

    .detail-card {
        padding: 1rem;
    }

    .temperature {
        font-size: 2.5rem;
    }

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #121212;
        --surface: #1e1e1e;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --border: #404040;
    }

    .city-card:hover {
        background-color: #1a1a2e;
    }
}
