/* ============================================================
   Atmosphera — Weather App Styles
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --bg: #050d1a;
  --surface: rgba(10, 25, 47, 0.7);
  --surface2: rgba(15, 35, 65, 0.6);
  --border: rgba(100, 180, 255, 0.12);
  --border-bright: rgba(100, 180, 255, 0.3);
  --text: #e8f4ff;
  --text-dim: #7ba8cc;
  --text-muted: #3a6080;
  --accent: #4db8ff;
  --accent2: #f0a843;
  --accent3: #7de8a0;
  --danger: #ff4d6d;
  --warn: #ffb347;
  --glow: 0 0 20px rgba(77, 184, 255, 0.15);
}

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

/* ── Base ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated Starfield Background ── */
#canvas-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── App Wrapper ── */
.app-wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ============================================================
   Header
   ============================================================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #4db8ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo span {
  font-weight: 400;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ============================================================
   Location Bar
   ============================================================ */
.location-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  /* overflow must NOT be hidden — it clips the autocomplete dropdown */
  background: var(--surface);
  backdrop-filter: blur(12px);
}

/* Manually round inner corners so we don't need overflow:hidden */
.search-group .btn {
  border-radius: 0 7px 7px 0;
}

.search-group input {
  border-radius: 7px 0 0 7px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  padding: 10px 14px;
  width: 220px;
  letter-spacing: 0.02em;
}

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

.btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  color: var(--accent);
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: rgba(77, 184, 255, 0.1);
}

.btn-loc {
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 10px 16px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-loc:hover {
  background: rgba(77, 184, 255, 0.12);
}

/* ============================================================
   Alert Banner
   ============================================================ */
.alert-banner {
  background: linear-gradient(90deg, rgba(255, 77, 109, 0.25), rgba(255, 77, 109, 0.08));
  border: 1px solid rgba(255, 77, 109, 0.5);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: none;
  backdrop-filter: blur(8px);
  animation: alertPulse 2s ease-in-out infinite;
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); }
  50%       { box-shadow: 0 0 20px 4px rgba(255, 77, 109, 0.3); }
}

.alert-banner .alert-title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ff4d6d;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.alert-banner .alert-body {
  font-size: 0.85rem;
  color: #ffb3c1;
  line-height: 1.5;
}

/* ============================================================
   Glass Card Base
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  transition: border-color 0.3s;
}

.card:hover {
  border-color: var(--border-bright);
}

.card-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* ============================================================
   Current Conditions
   ============================================================ */
.current-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

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

.current-main {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 210px;
}

.location-label {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

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

.temp-big {
  font-family: 'DM Mono', monospace;
  font-size: 5rem;
  font-weight: 400;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.04em;
}

.temp-unit-big {
  font-family: 'DM Mono', monospace;
  font-size: 2rem;
  color: var(--accent);
  margin-top: 10px;
}

.condition-text {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

.feels-like {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
}

.current-icon {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(77, 184, 255, 0.4));
}

/* ============================================================
   Details Grid
   ============================================================ */
.details-card {
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'DM Mono', monospace;
}

.detail-value {
  font-family: 'DM Mono', monospace;
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 500;
}

.detail-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

/* ── Wind Compass ── */
.wind-compass {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compass-ring {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border-bright);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.compass-arrow {
  position: absolute;
  width: 2px;
  height: 12px;
  background: linear-gradient(to top, var(--danger), var(--accent));
  left: 50%;
  top: 50%;
  transform-origin: bottom center;
  transform: translateX(-50%) translateY(-100%) rotate(0deg);
  border-radius: 2px;
}

/* ============================================================
   Sun & Moon Card
   ============================================================ */
.sun-moon-card {
  padding: 22px;
  margin-bottom: 16px;
}

.sun-moon-grid {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 20px;
  align-items: start;
}

.divider-v {
  background: var(--border);
  height: 100%;
  min-height: 80px;
}

.sun-arc-wrap {
  position: relative;
  height: 80px;
  margin: 10px 0;
  overflow: hidden;
}

.sun-arc-svg {
  width: 100%;
  height: 100%;
}

.sun-times {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sun-time-item {
  text-align: center;
}

.sun-time-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 3px;
}

.sun-time-val {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  color: var(--accent2);
  font-weight: 500;
}

/* ── Moon Section ── */
.moon-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.moon-icon {
  font-size: 2.8rem;
  filter: drop-shadow(0 0 10px rgba(200, 180, 255, 0.5));
  line-height: 1;
}

.moon-phase-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: #c8b4ff;
  text-align: center;
  letter-spacing: 0.06em;
}

.moon-illumination {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   Hourly Forecast
   ============================================================ */
.hourly-card {
  padding: 22px;
  margin-bottom: 16px;
  overflow: hidden;
}

.hourly-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

.hourly-scroll::-webkit-scrollbar        { height: 4px; }
.hourly-scroll::-webkit-scrollbar-track  { background: transparent; }
.hourly-scroll::-webkit-scrollbar-thumb  { background: var(--border-bright); border-radius: 2px; }

.hour-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 10px;
  min-width: 60px;
  flex-shrink: 0;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: default;
}

.hour-item:hover {
  background: var(--surface2);
  border-color: var(--border-bright);
}

.hour-item.now {
  background: rgba(77, 184, 255, 0.1);
  border-color: rgba(77, 184, 255, 0.35);
}

.hour-time {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.hour-item.now .hour-time {
  color: var(--accent);
}

.hour-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.hour-temp {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.hour-precip {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: #6ab0dd;
}

/* ============================================================
   7-Day Outlook
   ============================================================ */
.week-card {
  padding: 22px;
  margin-bottom: 16px;
}

.day-row {
  display: grid;
  grid-template-columns: 90px 40px 1fr 60px 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  border-radius: 6px;
}

.day-row:last-child {
  border-bottom: none;
}

.day-row:hover {
  background: var(--surface2);
  padding-left: 8px;
}

.day-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.day-name.today {
  color: var(--accent);
  font-weight: 500;
}

.day-icon {
  font-size: 1.4rem;
  text-align: center;
}

.day-bar-wrap {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.day-bar-fill {
  position: absolute;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #4db8ff, #f0a843);
}

.day-lo {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.day-hi {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

/* ============================================================
   Barometric Pressure
   ============================================================ */
.pressure-section {
  padding: 22px;
  margin-bottom: 16px;
}

.pressure-vals {
  display: flex;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pressure-big {
  font-family: 'DM Mono', monospace;
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--accent3);
  letter-spacing: -0.03em;
}

.pressure-unit {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pressure-bar-wrap {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.pressure-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #7de8a0, #4db8ff);
  transition: width 1s ease;
}

.pressure-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* ============================================================
   Loading Overlay
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-logo {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #4db8ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loader-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.04em;
}

/* ============================================================
   Error Message
   ============================================================ */
.error-msg {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  display: none;
}

/* ============================================================
   Utility & Misc
   ============================================================ */
.section-sep {
  margin-bottom: 16px;
}

.unit-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  overflow: hidden;
}

.unit-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.unit-btn.active {
  background: rgba(77, 184, 255, 0.18);
  color: var(--accent);
}

.content-area {
  display: none;
}

.content-area.visible {
  display: block;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* ============================================================
   Welcome / Empty State
   ============================================================ */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px 80px;
  gap: 14px;
  animation: fadeIn 0.4s ease forwards;
}

.welcome-icon {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(77, 184, 255, 0.35));
  margin-bottom: 6px;
}

.welcome-title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.welcome-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.6;
}

.welcome-sub strong {
  color: var(--accent);
  font-weight: 500;
}

.welcome-hint {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--warn);
  max-width: 420px;
  line-height: 1.5;
  min-height: 1.2em;
}

/* ============================================================
   Autocomplete Dropdown
   ============================================================ */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #0a1a30;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  list-style: none;
  padding: 4px;
  margin: 0;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(77, 184, 255, 0.08);
  backdrop-filter: blur(16px);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

.autocomplete-list:empty {
  display: none;
}

.ac-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.ac-item:hover,
.ac-item.ac-active {
  background: rgba(77, 184, 255, 0.12);
}

.ac-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.85;
}

.ac-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ac-primary {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-secondary {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item.ac-active .ac-primary  { color: var(--accent); }
.ac-item.ac-active .ac-secondary { color: var(--text-dim); }