/* miwparkering — bubbly 2026 aesthetic.
   Soft mesh-gradient backdrop, pillowy rounded controls, springy taps.
   Parkeringsgriddet fylder ~70% og ligger til hojre (tommelfinger-venligt). */

:root {
  --ink: #2c2545;
  --ink-soft: #6b6486;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --stroke: rgba(124, 58, 237, 0.12);

  --free-1: #4ade80;
  --free-2: #10b981;
  --occupied-1: #ffffff;
  --occupied-2: #ece9fb;

  --accent-1: #a855f7;
  --accent-2: #ec4899;
  --gold-1: #fbbf24;
  --gold-2: #f59e0b;

  --r-lg: 30px;
  --r-md: 22px;
  --r-sm: 16px;

  --shadow-soft: 0 18px 40px -18px rgba(76, 29, 149, 0.45);
  --shadow-pop: 0 12px 24px -8px rgba(16, 185, 129, 0.55);
  --shadow-inset: inset 0 2px 4px rgba(255, 255, 255, 0.9), inset 0 -3px 6px rgba(124, 58, 237, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "SF Pro Rounded", ui-rounded, "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(120% 90% at 100% 0%, #ffe3f1 0%, rgba(255, 227, 241, 0) 55%),
    radial-gradient(120% 90% at 0% 15%, #dcd6ff 0%, rgba(220, 214, 255, 0) 50%),
    radial-gradient(140% 120% at 80% 100%, #c9f7e5 0%, rgba(201, 247, 229, 0) 55%),
    linear-gradient(160deg, #f6f2ff 0%, #fbf3f8 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --------------------------------------------------------------- */
.topbar { text-align: center; padding: 30px 18px 4px; }
.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(105deg, var(--accent-1), var(--accent-2) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 18px calc(48px + env(safe-area-inset-bottom, 0px));
}

/* --- Summary bubbles ------------------------------------------------------ */
.summary {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0 6px;
}
.stat {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 12px 24px;
  text-align: center;
  min-width: 96px;
  box-shadow: var(--shadow-soft);
}
.stat span { display: block; font-size: 1.9rem; font-weight: 800; line-height: 1.05; }
.stat small {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.stat-free span {
  background: linear-gradient(120deg, var(--free-1), var(--free-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-occupied span { color: var(--ink); }
.stat-total span {
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.status { text-align: center; min-height: 1.2em; margin: 6px 0; color: var(--ink-soft); font-size: 0.92rem; font-weight: 600; }
.status-error { color: #e11d6f; font-weight: 700; }

/* --- Kort: griddet ligger til hojre og fylder ~70% ------------------------ */
.rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 14px 0 0;
  width: 72%;
  margin-left: auto;        /* skub blokken mod hojre */
}
.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.row-section {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --- Bubbly parkeringsplads ---------------------------------------------- */
.spot {
  position: relative;
  appearance: none;
  border: none;
  cursor: pointer;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease;
}
.spot.occupied {
  background: linear-gradient(160deg, var(--occupied-1), var(--occupied-2));
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft), var(--shadow-inset);
}
.spot.free {
  background: linear-gradient(160deg, var(--free-1), var(--free-2));
  color: #ffffff;
  box-shadow: var(--shadow-pop);
  transform: translateY(-1px) scale(1.04);
}
.spot:hover { filter: brightness(1.04); }
.spot:active { transform: scale(0.9); }
.spot:focus-visible { outline: 3px solid var(--accent-1); outline-offset: 3px; }
.spot.busy { opacity: 0.5; pointer-events: none; }
.spot-label { font-size: 1.2rem; font-weight: 800; line-height: 1; }
.spot.free .spot-label { font-size: 1.02rem; }
.spot-timer {
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(6, 95, 70, 0.35);
}
.spot-timer[hidden] { display: none; }

/* Top-3 markering pa kortet */
.spot.top { box-shadow: 0 0 0 3px var(--gold-1), var(--shadow-soft); }
.spot.top::after {
  content: "\2605";
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.72rem;
  color: #fff;
  background: linear-gradient(160deg, var(--gold-1), var(--gold-2));
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px -2px rgba(245, 158, 11, 0.7);
}

/* --- Top-panel ------------------------------------------------------------ */
.top-view { margin-top: 18px; animation: pop-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.top-list { list-style: none; margin: 0 auto; padding: 0; max-width: 540px; display: flex; flex-direction: column; gap: 10px; }
.top-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-soft);
}
.top-rank {
  font-weight: 800;
  min-width: 40px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
}
.top-spot { font-weight: 700; flex: 1; }
.top-count { color: var(--ink-soft); font-size: 0.9rem; font-weight: 600; }
.top-empty { text-align: center; color: var(--ink-soft); margin-top: 22px; font-weight: 600; }

/* --- Footer --------------------------------------------------------------- */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
}

.top-toggle {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 40px;
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 16px 30px -10px rgba(168, 85, 247, 0.7);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, filter 0.2s ease;
}
.top-toggle:hover { filter: brightness(1.05); transform: translateY(-2px); }
.top-toggle:active { transform: scale(0.95); }
.top-toggle.active { box-shadow: 0 8px 18px -8px rgba(168, 85, 247, 0.8), inset 0 3px 8px rgba(76, 29, 149, 0.35); }
.top-toggle-icon { margin-right: 4px; }

.updated { color: var(--ink-soft); font-size: 0.82rem; font-weight: 600; }
.footer-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.reset {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 20px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, color 0.2s ease;
}
.reset:hover { color: var(--ink); transform: translateY(-1px); }
.reset:active { transform: scale(0.96); }

/* --- Sma skaerme: hold griddet til hojre men lidt bredere ----------------- */
@media (max-width: 560px) {
  .rows { width: 74%; gap: 12px; }
  .row { gap: 9px; }
  .row-section { gap: 8px; padding: 10px; }
  .spot { width: 52px; height: 52px; border-radius: 17px; }
  .spot-label { font-size: 1.05rem; }
  .spot.free .spot-label { font-size: 0.9rem; }
  .spot-timer { font-size: 0.55rem; }
}

@media (max-width: 380px) {
  .rows { width: 78%; }
  .spot { width: 46px; height: 46px; }
  .spot.free .spot-label { font-size: 0.82rem; }
  .spot-timer { font-size: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
