/* Design System & Base Variables */
:root {
    --bg-dark: #0b1120;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --card-hover-bg: rgba(255, 255, 255, 0.1);
    --card-hover-border: rgba(96, 165, 250, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary-blue: #3b82f6;
    --primary-light: #60a5fa;
    --accent-cyan: #06b6d4;
    --accent-indigo: #6366f1;
    --accent-rose: #f43f5e;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Animated Background */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.18) 0%, transparent 40%),
                radial-gradient(circle at 85% 25%, rgba(99, 102, 241, 0.15) 0%, transparent 45%),
                radial-gradient(circle at 50% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
                var(--bg-dark);
    z-index: -1;
    transition: var(--transition);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* Glassmorphism Panel Class */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

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

/* Header Component */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

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

.logo-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-indigo));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    box-shadow: var(--shadow-glow);
}

.header-brand h1 {
    font-family: 'Outfit', 'Pretendard', sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 30%, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-brand .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

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

/* Status Pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--accent-emerald);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Buttons */
.primary-btn, .icon-btn {
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-indigo));
    color: white;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary-light);
}

/* Alert Banner */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-amber);
    font-size: 14px;
    margin-bottom: 20px;
}

.close-banner-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--accent-amber);
    font-size: 18px;
    cursor: pointer;
}

/* KPI Dashboard Cards */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--primary-light); }
.kpi-icon.red { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }
.kpi-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.kpi-icon.purple { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
    font-family: 'Outfit', 'Pretendard', sans-serif;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* Controls Toolbar */
.toolbar-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 240px;
    flex: 1;
    max-width: 320px;
}

.search-box i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary-blue);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

/* Region Chips */
.region-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.region-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.chip.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Toolbar Right */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.select-wrapper select {
    padding: 8px 14px 8px 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.select-wrapper select option {
    background: #0f172a;
    color: var(--text-primary);
}

.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 3px;
}

.view-btn {
    padding: 6px 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.view-btn.active {
    background: var(--card-hover-bg);
    color: var(--primary-light);
}

/* Weather Grid */
.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 20px;
}

/* Weather Card */
.weather-card {
    position: relative;
    padding: 22px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.weather-card:hover {
    transform: translateY(-5px);
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: 0 14px 35px -10px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.card-city-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-city-en {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    margin-top: 1px;
}

.region-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary-light);
}

.card-middle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-temp-main {
    font-size: 38px;
    font-weight: 800;
    font-family: 'Outfit', 'Pretendard', sans-serif;
    letter-spacing: -1px;
    background: linear-gradient(180deg, #ffffff 40%, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-weather-icon {
    font-size: 42px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* Metric Pill Grid in Card */
.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.metric-item i {
    font-size: 12px;
    color: var(--primary-light);
    width: 14px;
}

/* Map Container */
.map-container {
    padding: 24px;
}

.map-header {
    margin-bottom: 20px;
}

.map-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.map-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.korea-map-wrapper {
    position: relative;
    width: 100%;
    height: 520px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.korea-map {
    position: relative;
    width: 480px;
    height: 500px;
    background: radial-gradient(ellipse at center, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Map Pins */
.map-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.map-pin:hover {
    transform: translate(-50%, -60%) scale(1.15);
    z-index: 20;
}

.pin-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-full);
    color: white;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.pin-temp {
    color: var(--accent-amber);
    font-family: 'Outfit', sans-serif;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 54px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Detail Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 540px;
    padding: 32px;
    border-radius: var(--radius-lg);
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    animation: modalSlideUp 0.3s ease-out;
}

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

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: rgba(254, 226, 226, 0.2);
    color: var(--accent-rose);
}

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

.modal-city-info h2 {
    font-size: 28px;
    font-weight: 800;
    margin: 4px 0 2px;
}

.modal-city-en {
    color: var(--text-muted);
    font-size: 14px;
}

.modal-temp-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 44px;
}

.modal-temp {
    font-size: 32px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

.modal-metric {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-metric i {
    font-size: 20px;
    color: var(--primary-light);
}

.metric-title {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.metric-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

.modal-sun-info {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sun-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.sun-item i {
    font-size: 22px;
    color: var(--accent-amber);
}

.sun-item span {
    color: var(--text-muted);
    font-size: 12px;
    display: block;
}

.sun-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
}

/* Footer */
.main-footer {
    margin-top: 48px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 20px;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .toolbar-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .toolbar-right {
        justify-content: space-between;
    }
    
    .korea-map-wrapper {
        height: 420px;
    }
    
    .korea-map {
        width: 340px;
        height: 380px;
    }
}
