:root {
    --bg: #070B14;
    --bg-secondary: #0B1220;
    --bg-card: #101B2B;
    --bg-card-hover: #14233A;
    --primary: #16C79A;
    --primary-hover: #0FC48C;
    --primary-light: rgba(22, 199, 154, 0.15);
    --accent: #35D6C5;
    --accent-hover: #2DD0BF;
    --blue: #2678E8;
    --blue-hover: #1E68D0;
    --text: #F3F7FC;
    --text-secondary: #C8D4E4;
    --text-muted: #8998AA;
    --text-dim: #5A6A7F;
    --border: #1E2D3F;
    --border-light: #2A3F54;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --header-height: 64px;
    --sidebar-width: 280px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #F0F4F8;
        --bg-secondary: #E8EEF4;
        --bg-card: #FFFFFF;
        --bg-card-hover: #F5F9FC;
        --primary: #0D9A72;
        --primary-hover: #0BA87C;
        --primary-light: rgba(13, 154, 114, 0.12);
        --accent: #14B8A6;
        --blue: #2563EB;
        --text: #0F172A;
        --text-secondary: #334155;
        --text-muted: #64748B;
        --text-dim: #94A3B8;
        --border: #E2E8F0;
        --border-light: #CBD5E1;
        --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
        --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
        --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
        --shadow-xl: 0 16px 48px rgba(15, 23, 42, 0.15);
    }
}

[data-theme="light"] {
    --bg: #F0F4F8;
    --bg-secondary: #E8EEF4;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F5F9FC;
    --primary: #0D9A72;
    --primary-hover: #0BA87C;
    --primary-light: rgba(13, 154, 114, 0.12);
    --accent: #14B8A6;
    --blue: #2563EB;
    --text: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --text-dim: #94A3B8;
    --border: #E2E8F0;
    --border-light: #CBD5E1;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 16px 48px rgba(15, 23, 42, 0.15);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    min-height: 100vh;
    grid-template-areas:
        "header header"
        "sidebar main";
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    display: inline-block;
    vertical-align: middle;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

.icon-xl {
    width: 32px;
    height: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-card);
    color: var(--text);
}

.btn-icon {
    padding: 10px;
    border-radius: var(--radius-full);
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-card);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
}

.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    position: sticky;
    top: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text);
    background: var(--bg-card);
}

.nav-btn.active {
    color: var(--primary);
    background: var(--primary-light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.location-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 180px;
    max-width: 240px;
}

.location-display:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}

.location-display:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.location-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-display .chevron {
    color: var(--text-dim);
    transition: transform var(--transition-fast);
}

.location-display[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.unit-toggle {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}

.unit-btn {
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.unit-btn.active {
    color: var(--bg);
    background: var(--primary);
}

.refresh-btn,
.settings-btn {
    color: var(--text-muted);
}

.refresh-btn:hover,
.settings-btn:hover {
    color: var(--text);
    background: var(--bg-card);
}

.refresh-btn.loading .icon {
    animation: spin 1s linear infinite;
}

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

.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    overflow-y: auto;
    z-index: 50;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.sidebar-close {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    margin-bottom: 4px;
}

.sidebar-nav-btn:hover {
    color: var(--text);
    background: var(--bg-card);
}

.sidebar-nav-btn.active {
    color: var(--primary);
    background: var(--primary-light);
}

.sidebar-section {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    margin-bottom: 8px;
}

.sidebar-action-btn:hover {
    color: var(--text);
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.version-info {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.data-attribution {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.data-attribution a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.data-attribution a:hover {
    color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.visible {
    opacity: 1;
}

.main {
    grid-area: main;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg);
}

.view {
    display: none;
    animation: fadeIn var(--transition-base);
}

.view.active {
    display: block;
}

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

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

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

.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 16px;
}

.loading-state p,
.error-state p {
    color: var(--text-muted);
    font-size: 1rem;
}

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

.current-weather-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.current-weather-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--blue));
}

.current-weather-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 32px;
    align-items: start;
}

.location-time {
    margin-bottom: 8px;
}

.location-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.local-time {
    font-size: 1rem;
    color: var(--text-muted);
}

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

.temperature-value {
    font-size: 6rem;
    font-weight: 300;
    line-height: 1;
    color: var(--text);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.temperature-unit {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 12px;
}

.condition-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.condition-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.condition-text {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}

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

.high-low {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sun-times {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sun-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.sun-time .icon {
    color: var(--accent);
}

.metrics-section {
    margin-top: 32px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-base);
    cursor: default;
}

.metric-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.metric-card:hover .metric-icon {
    transform: scale(1.05);
}

.metric-icon.humidity { background: rgba(59, 130, 246, 0.15); color: #3B82F6; }
.metric-icon.wind { background: rgba(139, 92, 246, 0.15); color: #8B5CF6; }
.metric-icon.pressure { background: rgba(249, 115, 22, 0.15); color: #F97316; }
.metric-icon.visibility { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.metric-icon.uv { background: rgba(234, 179, 8, 0.15); color: #EAB308; }
.metric-icon.clouds { background: rgba(100, 116, 139, 0.15); color: #64748B; }
.metric-icon.dewpoint { background: rgba(56, 189, 248, 0.15); color: #38BDF8; }
.metric-icon.precipitation { background: rgba(34, 197, 94, 0.15); color: #22C55E; }
.metric-icon.airquality { background: rgba(236, 72, 153, 0.15); color: #EC4899; }

.metric-info {
    flex: 1;
    min-width: 0;
}

.metric-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.metric-detail {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.hourly-section {
    margin-top: 32px;
}

.hourly-nav {
    display: flex;
    gap: 8px;
}

.hourly-scroll-container {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 4px 16px;
    margin: 0 -4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.hourly-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.hourly-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.hourly-scroll-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.hourly-timeline {
    display: flex;
    gap: 12px;
    min-width: max-content;
}

.hourly-card {
    flex: 0 0 80px;
    scroll-snap-align: start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
    transition: all var(--transition-base);
    min-width: 80px;
}

.hourly-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hourly-card.current {
    border-color: var(--primary);
    background: var(--primary-light);
}

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

.hourly-card.current .hourly-time {
    color: var(--primary);
}

.hourly-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    color: var(--text-secondary);
}

.hourly-temp {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.hourly-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.hourly-detail {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hourly-detail .icon {
    width: 12px;
    height: 12px;
}

.daily-section {
    margin-top: 32px;
}

.daily-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.daily-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all var(--transition-base);
}

.daily-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.daily-card.today {
    border-color: var(--primary);
    background: var(--primary-light);
}

.daily-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.daily-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.daily-day {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.daily-card.today .daily-day {
    color: var(--primary);
}

.daily-month {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.daily-condition {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.daily-icon {
    width: 32px;
    height: 32px;
}

.daily-temps {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.daily-temp-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.daily-temp-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.daily-temp-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono);
}

.daily-temp-value.low {
    color: var(--text-muted);
}

.daily-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.daily-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.daily-detail .icon {
    width: 16px;
    height: 16px;
    color: var(--text-dim);
}

.maps-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 48px);
}

.maps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.maps-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.map-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.map-layer-selector {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
}

.map-layer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.map-layer-btn:hover {
    color: var(--text);
}

.map-layer-btn.active {
    color: var(--bg);
    background: var(--primary);
}

.map-overlay-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text);
    border-radius: var(--radius-full);
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: var(--bg);
}

.map-container {
    flex: 1;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-secondary);
}

.map {
    width: 100%;
    height: 100%;
}

.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    z-index: 10;
    gap: 12px;
}

.map-legend {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    z-index: 100;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
}

.map-legend.hidden {
    display: none;
}

.map-legend-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.map-legend-gradient {
    height: 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.map-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.map-info {
    padding: 16px 0 0;
}

.map-location-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.map-location-info .icon {
    color: var(--primary);
}

.forecast-view,
.charts-view,
.favorites-view,
.recent-view {
    max-width: 1200px;
}

.forecast-header,
.charts-header,
.favorites-header,
.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.forecast-header h2,
.charts-header h2,
.favorites-header h2,
.recent-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.forecast-unit-toggle,
.chart-timeframe {
    display: flex;
    gap: 8px;
}

.chart-tab {
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chart-tab:hover {
    color: var(--text);
    border-color: var(--border-light);
}

.chart-tab.active {
    color: var(--bg);
    background: var(--primary);
    border-color: var(--primary);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

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

.forecast-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

.forecast-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.forecast-card.today {
    border-color: var(--primary);
    background: var(--primary-light);
}

.forecast-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.forecast-day-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.forecast-card.today .forecast-day-name {
    color: var(--primary);
}

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

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

.forecast-condition {
    display: flex;
    align-items: center;
    gap: 12px;
}

.forecast-icon {
    width: 56px;
    height: 56px;
}

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

.forecast-temps {
    display: flex;
    align-items: baseline;
    gap: 16px;
    text-align: right;
}

.forecast-high {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text);
    font-family: var(--font-mono);
}

.forecast-low {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.forecast-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.forecast-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.forecast-detail-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

.forecast-detail-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    font-family: var(--font-mono);
}

.favorites-grid,
.recent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.favorite-city-card,
.recent-city-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: all var(--transition-base);
}

.favorite-city-card:hover,
.recent-city-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.favorite-city-info,
.recent-city-info {
    flex: 1;
    min-width: 0;
}

.favorite-city-name,
.recent-city-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.favorite-city-region,
.recent-city-time {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.favorite-city-temp,
.recent-city-temp {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.favorite-city-actions,
.recent-city-actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.empty-state .icon {
    width: 64px;
    height: 64px;
    color: var(--text-dim);
}

.empty-state p {
    font-size: 1rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
}

.modal-overlay:not(.hidden) .modal {
    transform: scale(1) translateY(0);
}

.modal-lg {
    max-width: 640px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    color: var(--text-muted);
    padding: 8px;
}

.modal-close:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.search-suggestions {
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestion-item,
.recent-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-suggestion-item:hover,
.recent-search-item:hover {
    background: var(--bg-secondary);
}

.suggestion-icon,
.recent-icon {
    color: var(--text-dim);
}

.suggestion-info,
.recent-info {
    flex: 1;
    min-width: 0;
}

.suggestion-name,
.recent-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.suggestion-region,
.recent-time {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.search-recent {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.search-recent h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.settings-tab {
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.settings-tab:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

.settings-tab.active {
    color: var(--primary);
    background: var(--primary-light);
}

.settings-panel {
    animation: fadeIn var(--transition-fast);
}

.setting-group {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.setting-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.setting-group h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.setting-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.setting-option:hover {
    border-color: var(--border-light);
    background: var(--bg-card);
}

.setting-option input {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.toggle-setting {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-setting input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-setting .toggle-slider {
    flex-shrink: 0;
}

.toggle-setting span:last-child {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.about-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.version {
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.about-content > p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.data-sources h4,
.tech-stack h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.data-sources ul,
.tech-stack ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-sources a,
.tech-stack a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.data-sources a:hover {
    color: var(--primary);
}

.links {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.links a {
    color: var(--text-muted);
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
}

.links a:hover {
    color: var(--primary);
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
    animation: slideIn var(--transition-base);
    min-width: 280px;
    max-width: 400px;
}

.toast.success { border-left: 4px solid var(--primary); }
.toast.error { border-left: 4px solid #EF4444; }
.toast.warning { border-left: 4px solid #F59E0B; }
.toast.info { border-left: 4px solid var(--blue); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast.success .toast-icon { color: var(--primary); }
.toast.error .toast-icon { color: #EF4444; }
.toast.warning .toast-icon { color: #F59E0B; }
.toast.info .toast-icon { color: var(--blue); }

.toast-message {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    padding: 4px;
    color: var(--text-dim);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.toast-close:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .menu-toggle {
        display: flex;
    }

    .header-nav {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        bottom: 0;
        width: var(--sidebar-width);
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        z-index: 60;
        height: calc(100vh - var(--header-height));
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: flex;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .main {
        padding: 16px;
    }

    .current-weather-main {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .temperature-value {
        font-size: 4.5rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .daily-grid {
        grid-template-columns: 1fr;
    }

    .maps-header {
        flex-direction: column;
        align-items: stretch;
    }

    .map-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .map-layer-selector {
        width: 100%;
        justify-content: center;
    }

    .modal {
        margin: 12px;
        max-height: calc(100vh - 24px);
    }
}

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

    .location-text {
        display: none;
    }

    .location-display {
        min-width: auto;
        padding: 8px;
    }

    .temperature-value {
        font-size: 3.5rem;
    }

    .sun-times {
        flex-direction: column;
        gap: 12px;
    }

    .chart-container {
        height: 250px;
    }
}