/* ═══════════════════════════════════════════════════════
   Meteostanice Žabeň — "Observatory Noir" Theme
   Dark, instrument-grade weather dashboard
   ═══════════════════════════════════════════════════════ */

/* ─── Custom Properties ─────────────────────────────── */
:root {
  --bg-base: #08080d;
  --bg-surface: #0e0e15;
  --bg-card: #12121b;
  --bg-card-hover: #161621;
  --bg-elevated: #1a1a26;

  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(232, 168, 56, 0.2);

  --text-primary: #edebe7;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.38);

  --amber: #e8a838;
  --amber-dim: rgba(232, 168, 56, 0.15);
  --blue: #5b9bd5;
  --blue-dim: rgba(91, 155, 213, 0.15);
  --purple: #a78bfa;
  --green: #6ee7b7;
  --red: #f87171;

  --font-data: 'JetBrains Mono', monospace;
  --font-ui: 'DM Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 30px rgba(232, 168, 56, 0.06);

  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
}

/* ─── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Subtle noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 256px;
  pointer-events: none;
  z-index: 9999;
}

#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-md) var(--space-lg);
}

/* ─── Error Banner ──────────────────────────────────── */
.error-banner {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--red);
  font-family: var(--font-data);
  font-size: 0.8rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  animation: slideDown 0.3s ease;
}

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

/* ─── Header ────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0 var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.header-title {
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.header-badge {
  font-family: var(--font-data);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transition: background 0.4s;
}
.status-dot.status-live { background: #34d399; box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); }
.status-dot.status-stale { background: var(--amber); box-shadow: 0 0 8px rgba(232, 168, 56, 0.4); }
.status-dot.status-offline { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, 0.4); }

.status-text {
  font-family: var(--font-data);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-time {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}
.refresh-btn:hover {
  background: var(--bg-card-hover);
  color: var(--amber);
  border-color: var(--border-accent);
}
.refresh-btn:active svg { transform: rotate(-180deg); }
.refresh-btn svg { transition: transform 0.4s ease; }

/* ─── Hero Section ──────────────────────────────────── */
.hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;
}

/* Soft radial glow behind hero */
.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(232, 168, 56, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.hero-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  position: relative;
}

.hero-condition {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.hero-icon {
  width: 64px;
  height: 64px;
  color: var(--amber);
  opacity: 0.85;
}
.hero-icon svg {
  width: 100%;
  height: 100%;
}

.hero-condition-label {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.hero-temp-group {
  text-align: center;
}

.hero-temp {
  font-family: var(--font-data);
  font-size: 4.8rem;
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(232, 168, 56, 0.1);
}

.hero-feels {
  font-family: var(--font-data);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 8px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 90px;
}

.hero-stat-label {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-stat-value {
  font-family: var(--font-data);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── Cards Grid ────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}
.card:hover::before { opacity: 1; }

.card-temp::before { background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.card-precip::before { background: linear-gradient(90deg, transparent, var(--blue), transparent); }
.card-pressure::before { background: linear-gradient(90deg, transparent, var(--purple), transparent); }
.card-wind::before { background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.card-humidity::before { background: linear-gradient(90deg, transparent, var(--blue), transparent); }
.card-solar::before { background: linear-gradient(90deg, transparent, #fbbf24, transparent); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── Badges ────────────────────────────────────────── */
.badge {
  font-family: var(--font-data);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-label {
  color: var(--text-muted);
  font-weight: 400;
}

.badge-high { color: var(--amber); border-color: var(--border-accent); }
.badge-low { color: var(--blue); border-color: rgba(91, 155, 213, 0.2); }
.badge-avg { color: var(--text-secondary); }
.badge-accent { color: var(--amber); }
.badge-mono { font-family: var(--font-data); font-weight: 600; color: var(--text-primary); }
.badge-lg { font-size: 1.1rem; padding: 5px 14px; }
.badge-trend { color: var(--purple); border-color: rgba(167, 139, 250, 0.2); }

/* ─── Chart Container ───────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 180px;
}
.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ─── Wind Card ─────────────────────────────────────── */
.wind-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.wind-compass-wrap {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
}
.wind-compass-wrap canvas {
  width: 100%;
  height: 100%;
}

.wind-data {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.wind-data-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wind-data-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wind-data-value {
  font-family: var(--font-data);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── Humidity Card ─────────────────────────────────── */
.humidity-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.humidity-gauge-wrap {
  width: 140px;
  height: 80px;
  flex-shrink: 0;
}
.humidity-gauge-wrap canvas {
  width: 100%;
  height: 100%;
}

.humidity-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.humidity-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.humidity-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.humidity-val {
  font-family: var(--font-data);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── Solar & UV Card ───────────────────────────────── */
.solar-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.solar-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.solar-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 50px;
}

.solar-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.solar-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.solar-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), #fbbf24);
  border-radius: 4px;
  width: 0%;
  transition: width 0.6s ease;
}

.solar-value {
  font-family: var(--font-data);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 72px;
  text-align: right;
}

.solar-uv-row {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.solar-uv-display {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.uv-number {
  font-family: var(--font-data);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

.uv-badge {
  font-family: var(--font-data);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.uv-low { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.uv-moderate { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.uv-high { background: rgba(232, 168, 56, 0.15); color: var(--amber); }
.uv-very-high { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.uv-extreme { background: rgba(167, 139, 250, 0.15); color: var(--purple); }

/* ─── Weekly Section ────────────────────────────────── */
.weekly-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.weekly-chart-wrap {
  height: 220px;
  margin-bottom: var(--space-md);
}
.weekly-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.weekly-cards {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.weekly-cards::-webkit-scrollbar { height: 4px; }
.weekly-cards::-webkit-scrollbar-track { background: transparent; }
.weekly-cards::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.weekly-day-card {
  flex: 0 0 auto;
  min-width: 130px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  text-align: center;
  transition: border-color 0.2s;
}
.weekly-day-card:hover { border-color: rgba(255,255,255,0.1); }

.weekly-day-name {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.weekly-day-temps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.weekly-high {
  font-family: var(--font-data);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--amber);
}

.weekly-low {
  font-family: var(--font-data);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--blue);
}

.weekly-day-detail {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── Footer ────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer-info {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.footer-sep { opacity: 0.3; }

.footer-link {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--amber); }

/* ─── Loading Skeleton ──────────────────────────────── */
.skeleton.loading {
  color: transparent !important;
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    rgba(255,255,255,0.04) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: 4px;
  min-width: 40px;
  display: inline-block;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.is-loading .card { opacity: 0.7; }

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

.hero { animation: fadeUp 0.5s ease both; }
.card { animation: fadeUp 0.5s ease both; }
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.weekly-section { animation: fadeUp 0.5s ease 0.35s both; }

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  :root { font-size: 16px; }

  #app { padding: var(--space-sm); }

  .header { padding: var(--space-sm) 0 var(--space-md); margin-bottom: var(--space-md); }
  .header-title { font-size: 1.2rem; }
  .header-time { display: none; }

  .hero { padding: var(--space-lg) var(--space-md); }
  .hero-temp { font-size: 3.6rem; }
  .hero-stats { gap: var(--space-md); }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .wind-content { flex-direction: column; }
  .wind-compass-wrap { width: 160px; height: 160px; }

  .humidity-content { flex-direction: column; align-items: flex-start; }

  .weekly-section { padding: var(--space-md); }
}

@media (max-width: 480px) {
  .hero-main { flex-direction: column; gap: var(--space-md); }
  .hero-icon { width: 44px; height: 44px; }
  .hero-temp { font-size: 2.8rem; }
  .hero-stats { flex-direction: column; align-items: center; }
  .hero-stat { flex-direction: row; gap: var(--space-sm); width: 100%; justify-content: space-between; }

  .header-right { gap: var(--space-sm); }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
