/* ==========================================================================
   IEUM LAB - K-WEATHER STYLESHEET
   Design System: Glassmorphism, Dark Mode, Vibrant Sky Accents
   ========================================================================== */

:root {
  --font-primary: 'Outfit', 'Noto Sans KR', -apple-system, sans-serif;
  
  /* Color Tokens */
  --bg-dark: #0b0f19;
  --bg-card: rgba(18, 26, 43, 0.7);
  --bg-card-hover: rgba(28, 40, 66, 0.85);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-glass-bright: rgba(56, 189, 248, 0.3);
  
  --primary-cyan: #38bdf8;
  --primary-blue: #0284c7;
  --accent-sun: #fbbf24;
  --accent-rain: #60a5fa;
  --accent-cloud: #94a3b8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-cyan: 0 0 25px rgba(56, 189, 248, 0.25);
  
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Background Ambient Glows */
.background-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 50%, #090d16 100%);
  z-index: -2;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  animation: pulse-glow 10s infinite alternate ease-in-out;
}

.glow-1 {
  top: -10%;
  left: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4), transparent 70%);
}

.glow-2 {
  bottom: 10%;
  right: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 70%);
}

@keyframes pulse-glow {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.15) translate(30px, -20px); }
}

/* Header */
.app-header {
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 1.5rem;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-cyan);
}

.brand-icon i {
  color: #fff;
  width: 24px;
  height: 24px;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary-cyan);
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

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

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

.live-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
}

.live-clock i {
  width: 14px;
  height: 14px;
  color: var(--primary-cyan);
}

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

.unit-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.unit-btn.active {
  background: var(--primary-cyan);
  color: #0b0f19;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.icon-btn.spinning i {
  animation: spin 1s linear infinite;
}

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

/* Main Layout */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Controls & Filter Panel */
.control-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  width: 18px;
  height: 18px;
}

.search-box input {
  width: 100%;
  background: rgba(18, 26, 43, 0.8);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 10px 38px 10px 42px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.pill.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary-cyan);
  border-color: var(--primary-cyan);
}

/* Featured Card (Gimhae) */
.featured-card {
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.4) 0%, rgba(15, 23, 42, 0.85) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-cyan);
  position: relative;
  overflow: hidden;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent 70%);
  pointer-events: none;
}

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

.location-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--primary-cyan);
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.featured-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  align-items: center;
}

.featured-main-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weather-visual {
  display: flex;
  align-items: center;
  gap: 20px;
}

.main-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.main-icon-wrapper i {
  width: 48px;
  height: 48px;
  color: var(--accent-sun);
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.5));
}

.temp-display {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
}

.temp-unit {
  font-size: 2rem;
  color: var(--primary-cyan);
  font-weight: 500;
}

.condition-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 4px;
}

.temp-range {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider {
  color: var(--text-dim);
}

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

.metric-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-item i {
  width: 22px;
  height: 22px;
  color: var(--primary-cyan);
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Cities Grid Section */
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.section-title-bar h2 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-bar i {
  color: var(--primary-cyan);
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sort-controls select {
  background: rgba(18, 26, 43, 0.8);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 12px;
  font-family: inherit;
  outline: none;
}

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

/* City Card */
.city-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.city-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-bright);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.city-card.featured-tag-border {
  border: 1px solid rgba(56, 189, 248, 0.4);
}

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

.city-name {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.city-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.2);
  color: var(--primary-cyan);
  padding: 2px 6px;
  border-radius: 6px;
}

.card-weather-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-weather-icon i {
  width: 24px;
  height: 24px;
  color: var(--accent-sun);
}

.card-middle {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.card-temp {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.card-condition {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-bottom i {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 4px;
  color: var(--primary-cyan);
}

/* Loading & Spinner */
.loading-spinner-container {
  grid-column: 1 / -1;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  padding: 1.5rem;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform var(--transition-fast);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

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

.modal-city-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-city-title i {
  color: var(--primary-cyan);
  width: 24px;
  height: 24px;
}

.modal-city-title h3 {
  font-size: 1.5rem;
  font-weight: 800;
}

.modal-city-title span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-temp-badge {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-cyan);
}

.modal-weather-summary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 1.5rem;
}

.modal-icon i {
  width: 40px;
  height: 40px;
  color: var(--accent-sun);
}

.modal-condition {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-details-row {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.hourly-forecast-container h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hourly-forecast-container h4 i {
  width: 16px;
  height: 16px;
  color: var(--primary-cyan);
}

.hourly-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

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

.hourly-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.hourly-item {
  flex: 0 0 70px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  font-size: 0.75rem;
}

.hourly-item .time {
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hourly-item i {
  width: 20px;
  height: 20px;
  margin: 4px 0;
  color: var(--accent-sun);
}

.hourly-item .temp {
  font-weight: 700;
  font-size: 0.85rem;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-glass);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.code {
  font-family: monospace;
  color: var(--primary-cyan);
}

/* Responsive */
@media (max-width: 768px) {
  .featured-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .control-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .temp-display {
    font-size: 2.8rem;
  }
}
