/* ============================================================
   SWIFTtap "Signal" UI, app-udgave
   Samme designsprog som swifttap.dk, men til skærme man BRUGER
   (dashboard, formularer, lister) i stedet for at scrolle.

   Drop filen i static/ og link den:
   <link rel="stylesheet" href="/static/swifttap-signal-ui.css">

   Skrifterne ligger på vores egen server (static/fonts), ikke hos
   Google Fonts. Hentes de fra Google, sendes den besøgendes IP-adresse
   til Google uden samtykke, og det er et GDPR-problem på en offentlig side.

   Alt er præfikset .sw- så det aldrig kolliderer med noget andet.
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('/static/fonts/SpaceGrotesk-Variable.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/Inter-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sw-bg:        #0e0e10;
  --sw-bg-2:      #141417;
  --sw-bg-3:      #1a1a1e;
  --sw-line:      rgba(255,255,255,.08);
  --sw-line-2:    rgba(255,255,255,.14);
  --sw-ink:       #f2f1ed;
  --sw-ink-dim:   rgba(242,241,237,.62);
  --sw-ink-faint: rgba(242,241,237,.38);
  --sw-accent:    #3ecfcf;
  --sw-accent-dim:rgba(62,207,207,.55);
  --sw-good:      #4ade80;
  --sw-warn:      #fbbf24;
  --sw-display:   'Space Grotesk', system-ui, sans-serif;
  --sw-body:      'Inter', system-ui, sans-serif;
  --sw-r:         14px;   /* radius, kort */
  --sw-r-sm:      10px;   /* radius, felter og knapper */

  /* Skærmhøjden fryses af scriptet nederst i briefet, så browserlinjer
     der glider ind og ud ikke får siden til at hoppe. */
  --sw-vh: 100vh;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--sw-bg);
  color: var(--sw-ink);
  font-family: var(--sw-body);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--sw-accent); color: #0e0e10; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sw-accent); outline-offset: 3px; }

/* ---------- shell ---------- */
.sw-app   { max-width: 640px; margin: 0 auto; padding: 0 20px 120px; }
.sw-app--wide { max-width: 1040px; }

.sw-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 0 16px;
  background: linear-gradient(var(--sw-bg) 70%, rgba(14,14,16,0));
}
.sw-brand {
  font-family: var(--sw-display); font-size: 17px; letter-spacing: .02em;
  text-decoration: none; color: var(--sw-ink);
}
.sw-brand b { font-weight: 700; }
.sw-brand span { font-weight: 300; }

/* ---------- typografi ---------- */
.sw-kicker {
  font-family: var(--sw-display); font-size: 10px; font-weight: 500;
  letter-spacing: .32em; text-transform: uppercase;
  color: var(--sw-accent); margin: 0 0 12px;
}
.sw-h1 { font-family: var(--sw-display); font-weight: 600; letter-spacing: -.02em;
         font-size: clamp(28px, 7vw, 40px); line-height: 1.08; margin: 0 0 10px; }
.sw-h2 { font-family: var(--sw-display); font-weight: 600; letter-spacing: -.01em;
         font-size: 20px; line-height: 1.2; margin: 0 0 4px; }
.sw-lede { color: var(--sw-ink-dim); margin: 0; max-width: 38em; }
.sw-note { font-size: 12px; color: var(--sw-ink-faint); letter-spacing: .03em; }
.sw-num  { font-family: var(--sw-display); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Sektionsoverskrift med hairline, til at dele siden i trin */
.sw-rule {
  display: flex; align-items: center; gap: 14px;
  margin: 40px 0 16px;
  font-family: var(--sw-display); font-size: 11px; font-weight: 500;
  letter-spacing: .28em; text-transform: uppercase; color: var(--sw-ink-faint);
}
.sw-rule::after { content: ""; flex: 1; height: 1px; background: var(--sw-line); }

/* ---------- kort ---------- */
.sw-card {
  background: var(--sw-bg-2);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r);
  padding: 20px;
  margin-bottom: 14px;
}
.sw-card--flush { padding: 0; overflow: hidden; }
.sw-card--accent { border-color: var(--sw-accent-dim); }
.sw-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sw-card__body { padding: 20px; }
.sw-card__foot {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--sw-line); background: var(--sw-bg-3);
}

/* Billede øverst i et kort (bilfoto) */
.sw-card__img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--sw-bg-3); }

/* ---------- knapper ---------- */
.sw-btn {
  font-family: var(--sw-display); font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  min-height: 48px; padding: 0 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--sw-r-sm);
  text-decoration: none; cursor: pointer;
  transition: background .25s, border-color .25s, color .25s, filter .25s;
}
.sw-btn--accent { background: var(--sw-accent); color: #0e0e10; font-weight: 600; }
.sw-btn--accent:hover { filter: brightness(1.1); }
.sw-btn--solid  { background: var(--sw-ink); color: #0e0e10; }
.sw-btn--solid:hover { background: #fff; }
.sw-btn--ghost  { border-color: var(--sw-line-2); color: var(--sw-ink); background: none; }
.sw-btn--ghost:hover { border-color: var(--sw-accent); color: var(--sw-accent); }
.sw-btn--quiet  { color: var(--sw-ink-dim); background: none; padding: 0 8px; letter-spacing: .1em; }
.sw-btn--quiet:hover { color: var(--sw-ink); }
.sw-btn--full   { width: 100%; }
.sw-btn[disabled], .sw-btn.is-busy { opacity: .5; pointer-events: none; }

.sw-btnrow { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- felter ---------- */
.sw-field { margin-bottom: 14px; }
.sw-label {
  display: block; margin-bottom: 7px;
  font-family: var(--sw-display); font-size: 10px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--sw-ink-faint);
}
.sw-input, .sw-select, .sw-textarea {
  width: 100%; min-height: 50px; padding: 13px 15px;
  background: var(--sw-bg-3); color: var(--sw-ink);
  border: 1px solid var(--sw-line); border-radius: var(--sw-r-sm);
  font-family: var(--sw-body); font-size: 16px; /* 16px = ingen zoom på iOS */
  transition: border-color .25s;
}
.sw-input::placeholder { color: var(--sw-ink-faint); }
.sw-input:focus, .sw-select:focus, .sw-textarea:focus { border-color: var(--sw-accent); outline: none; }
.sw-textarea { min-height: 110px; resize: vertical; }
.sw-hint { margin: 6px 0 0; font-size: 12px; color: var(--sw-ink-faint); }

/* To felter side om side når der er plads */
.sw-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 460px) { .sw-grid2 { grid-template-columns: 1fr; } }

/* Kodefelt, store tegn */
.sw-input--code {
  font-family: var(--sw-display); font-size: 22px; font-weight: 600;
  letter-spacing: .3em; text-align: center; text-transform: uppercase;
}

/* ---------- lister ---------- */
.sw-list { list-style: none; margin: 0; padding: 0; }
.sw-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--sw-line);
}
.sw-row:last-child { border-bottom: 0; }
.sw-row__thumb { width: 68px; height: 48px; flex: none; border-radius: 8px; object-fit: cover; background: var(--sw-bg-3); }
.sw-row__main { min-width: 0; flex: 1; }
.sw-row__title { font-family: var(--sw-display); font-weight: 500; font-size: 15px;
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-row__meta { font-size: 12.5px; color: var(--sw-ink-dim); }
.sw-row__right { text-align: right; flex: none; }

/* ---------- badges og status ---------- */
.sw-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sw-display); font-size: 10px; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--sw-line-2); color: var(--sw-ink-dim);
}
.sw-badge--accent { border-color: var(--sw-accent-dim); color: var(--sw-accent); }
.sw-badge--good   { border-color: rgba(74,222,128,.4); color: var(--sw-good); }
.sw-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Pris, gammel og ny */
.sw-price { font-family: var(--sw-display); font-weight: 600; font-size: 19px; font-variant-numeric: tabular-nums; }
.sw-price--was { font-size: 13px; font-weight: 400; color: var(--sw-ink-faint); text-decoration: line-through; }
.sw-price--down { color: var(--sw-accent); }

/* ---------- QR ---------- */
.sw-qr {
  display: grid; place-items: center; gap: 12px;
  padding: 20px; background: #fff; border-radius: var(--sw-r);
}
.sw-qr img { display: block; width: 100%; max-width: 240px; height: auto; }
.sw-qr__cap { font-family: var(--sw-display); font-size: 10px; letter-spacing: .22em;
              text-transform: uppercase; color: #0e0e10; }

/* ---------- tom tilstand ---------- */
.sw-empty {
  text-align: center; padding: 44px 20px;
  border: 1px dashed var(--sw-line-2); border-radius: var(--sw-r); color: var(--sw-ink-dim);
}

/* ---------- toast ---------- */
.sw-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  z-index: 60; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--sw-r-sm);
  background: var(--sw-bg-3); border: 1px solid var(--sw-line-2);
  box-shadow: 0 18px 44px rgba(0,0,0,.55);
  font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.sw-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.sw-toast--good { border-color: rgba(74,222,128,.45); }

/* ---------- sticky handling nederst ---------- */
.sw-bar {
  position: sticky; bottom: 0; z-index: 30;
  margin: 24px -20px 0; padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(14,14,16,0), var(--sw-bg) 32%);
}

/* ---------- centreret port (kodeskærm) ---------- */
.sw-gate {
  min-height: var(--sw-vh); display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse 70% 55% at 50% 34%, #1b1b20 0%, var(--sw-bg) 65%);
}
.sw-gate__box { width: 100%; max-width: 360px; text-align: center; }

/* ---------- animation ---------- */
@keyframes sw-rise { to { opacity: 1; transform: none; } }
.sw-rise { opacity: 0; transform: translateY(14px); animation: sw-rise .7s cubic-bezier(.22,1,.36,1) forwards; }
.sw-rise:nth-child(2) { animation-delay: .06s; }
.sw-rise:nth-child(3) { animation-delay: .12s; }
.sw-rise:nth-child(4) { animation-delay: .18s; }

@keyframes sw-flash { 0% { background: rgba(62,207,207,.16); } 100% { background: transparent; } }
.sw-flash { animation: sw-flash 1.2s ease-out; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
