/* Existing styles... */
:root {
    --bg-color: #0f1115;
    --card-bg: #181b21;
    --card-hover: #1f232b;
    --primary: #4e8cff;
    --secondary: #6c5ce7;
    --accent: #ff6b6b;
    --text-main: #ffffff;
    --text-muted: #8b92a5;
    --text-secondary: #a0aaec;
    --border: #2a2f3a;
    --card-border: #2a2f3a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius: 16px;
    --font-family: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-control {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.current-location {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
}

/* Search */
.search-wrapper {
    position: relative;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    width: 300px;
    transition: border-color 0.2s;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
}

.search-icon {
    font-size: 1.2rem;
    margin-right: 8px;
    opacity: 0.7;
}

#city-search {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow);
}

.search-results.hidden {
    display: none;
}

.search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

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

.search-item:hover {
    background: var(--card-hover);
}

.item-name {
    font-weight: 500;
    display: block;
}

.item-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Settings Button */
.settings-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 1rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    color: var(--text-muted);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.settings-modal.hidden {
    display: none;
}

.settings-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 2rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.toggle-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.4rem;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--primary-color);
    background-color: var(--primary);
    /* Fallback */
    color: white;
    font-weight: 600;
}

/* Recent Cities in Search */
.recent-header {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
}

.search-item.recent {
    border-left: 3px solid var(--secondary);
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Main Status Card spanning 2 rows, 2 columns */
.main-status {
    grid-column: span 2;
    grid-row: span 2;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(78, 140, 255, 0.1) 100%);
    position: relative;
    overflow: hidden;
}

.status-icon {
    font-size: 6rem;
    margin-bottom: 10px;
}

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

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

.unit {
    font-size: 2rem;
    margin-top: 10px;
    opacity: 0.8;
}

.condition-text {
    font-size: 1.5rem;
    text-transform: capitalize;
    margin-top: 10px;
    color: var(--text-muted);
}

.feels-like {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Detail Cards */
.detail-card {
    align-items: center;
    text-align: center;
    padding: 20px;
}

.detail-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.detail-label {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 2.5rem;
    font-weight: 600;
}

.detail-value small {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.detail-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Forecast Section */
.forecast-section {
    margin-bottom: 40px;
}

.forecast-section h2,
.charts-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.forecast-scroller {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
}

.forecast-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: center;
}

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

.forecast-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.forecast-icon {
    font-size: 2.5rem;
    margin: 10px 0;
}

.forecast-temp {
    font-weight: 600;
}

.forecast-low {
    opacity: 0.6;
    margin-left: 5px;
}

.forecast-precip {
    font-size: 0.8rem;
    color: #4e8cff;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Charts Section */
.charts-section {
    margin-bottom: 40px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-controls select {
    background: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.metric-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.metric-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.metric-toggle input {
    display: none;
}

.metric-toggle.active {
    background: rgba(78, 140, 255, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.chart-container {
    height: 400px;
    width: 100%;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 900px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    /* Slightly reduce sizes for tablet */
    .detail-icon {
        font-size: 2.5rem;
    }

    .detail-label {
        font-size: 1rem;
    }

    .detail-value {
        font-size: 2rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .location-control {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 10px;
    }

    .search-wrapper {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 600px) {
    /* Compact mobile layout - fit all tiles on screen */
    .app-container {
        padding: 10px;
    }

    .bento-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .main-status {
        grid-column: span 2;
        padding: 12px;
    }

    /* Compact main weather card */
    .status-icon {
        font-size: 2.8rem;
    }

    .temperature {
        font-size: 2.3rem;
    }

    .unit {
        font-size: 0.95rem;
    }

    .condition-text {
        font-size: 0.95rem;
    }

    .feels-like {
        font-size: 0.8rem;
    }

    /* Compact detail cards - 2 columns */
    .detail-card {
        padding: 10px;
        min-height: auto;
    }

    .detail-icon {
        font-size: 1.6rem;
        margin-bottom: 5px;
    }

    .detail-label {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }

    .detail-value {
        font-size: 1.2rem;
    }

    .detail-sub {
        font-size: 0.65rem;
    }

    header {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        margin-bottom: 8px;
        padding: 0;
    }

    .logo {
        font-size: 1rem;
        flex-shrink: 0;
        order: 1;
    }

    .settings-btn {
        font-size: 1.4rem;
        padding: 4px 6px;
        margin-left: 0;
        flex-shrink: 0;
        order: 2;
    }

    .location-control {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        order: 3;
        flex-basis: 100%;
    }

    .current-location {
        font-size: 0.85rem;
        text-align: left;
    }

    .search-wrapper {
        max-width: none;
        width: 100%;
        padding: 7px 12px;
    }

    /* Fix forecast horizontal scroll on mobile */
    .forecast-item {
        min-width: 120px;
        padding: 16px;
    }

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