/* ============================================================
   QRap — app.css
   Clean, professional Nordic aesthetic
   DM Sans body + Syne display
   ============================================================ */

:root {
  --c-bg:        #F5F6F8;
  --c-surface:   #FFFFFF;
  --c-border:    #E2E5EA;
  --c-text:      #1A1D23;
  --c-muted:     #6B7280;
  --c-accent:    #1B6CF2;
  --c-accent-h:  #1456C8;
  --c-accent-lt: #EBF2FF;
  --c-success:   #16A34A;
  --c-warning:   #D97706;
  --c-danger:    #DC2626;

  /* severity colours */
  --sev-1: #22C55E;
  --sev-2: #84CC16;
  --sev-3: #F59E0B;
  --sev-4: #F97316;
  --sev-5: #EF4444;

  --radius:  10px;
  --radius-sm: 6px;
  --shadow:  0 2px 12px rgba(0,0,0,.07);
  --shadow-md: 0 4px 24px rgba(0,0,0,.10);
  --font-body:    'DM Sans', sans-serif;
  --font-display: 'Syne', sans-serif;
  --transition:   0.18s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p  { line-height: 1.65; }
a  { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navigation ─────────────────────────────────────────── */
.app-nav {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.nav-brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
  color: var(--c-text); text-decoration: none;
}
.brand-icon { color: var(--c-accent); font-size: 1.4rem; }
.brand-name { letter-spacing: -0.03em; }

.nav-links {
  display: flex; list-style: none; gap: .25rem; flex: 1;
}
.nav-links a {
  padding: .4rem .75rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; color: var(--c-muted);
  text-decoration: none; transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--c-accent); background: var(--c-accent-lt);
}
.nav-user {
  display: flex; align-items: center; gap: .75rem; margin-left: auto;
}
.nav-username { font-size: .875rem; font-weight: 500; color: var(--c-muted); }
.btn-logout {
  font-size: .8rem; padding: .3rem .7rem; border-radius: var(--radius-sm);
  background: var(--c-bg); border: 1px solid var(--c-border); color: var(--c-muted);
  text-decoration: none; transition: var(--transition);
}
.btn-logout:hover { background: var(--c-danger); border-color: var(--c-danger); color: #fff; text-decoration: none; }

/* ── Page wrapper ────────────────────────────────────────── */
.page { padding: 2.5rem 2rem; max-width: 1200px; margin: 0 auto; flex: 1; width: 100%; }
.page-header { margin-bottom: 2rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.25rem; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; font-family: var(--font-display); }

/* ── Stat grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0;
  width: 4px; background: var(--c-accent); border-radius: var(--radius) 0 0 var(--radius);
}
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--c-muted); margin-top: .35rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius-sm); font-size: .875rem;
  font-weight: 600; font-family: var(--font-body); border: none; cursor: pointer;
  transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-h); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--c-bg); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: var(--c-border); text-decoration: none; color: var(--c-text); }
.btn-danger { background: #FEF2F2; color: var(--c-danger); border: 1px solid #FECACA; }
.btn-danger:hover { background: var(--c-danger); color: #fff; text-decoration: none; }
.btn-success { background: #F0FDF4; color: var(--c-success); border: 1px solid #BBF7D0; }
.btn-success:hover { background: var(--c-success); color: #fff; text-decoration: none; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-icon { padding: .4rem .6rem; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--c-border); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: var(--c-bg); padding: .75rem 1rem; text-align: left;
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-muted); border-bottom: 1px solid var(--c-border); white-space: nowrap;
}
tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFC; }

/* ── Forms ───────────────────────────────────────────────── */
.form-grid { display: grid; gap: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
label { font-size: .85rem; font-weight: 600; color: var(--c-text); }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  padding: .55rem .85rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: .9rem; background: var(--c-surface);
  color: var(--c-text); transition: var(--transition); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-lt);
}
textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: .78rem; color: var(--c-muted); }

/* ── Severity badge ──────────────────────────────────────── */
.sev {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; font-weight: 700;
  font-size: .78rem; color: #fff;
}
.sev-1 { background: var(--sev-1); }
.sev-2 { background: var(--sev-2); color: var(--c-text); }
.sev-3 { background: var(--sev-3); }
.sev-4 { background: var(--sev-4); }
.sev-5 { background: var(--sev-5); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: .85rem 1.1rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1.25rem; border: 1px solid transparent; }
.alert-error   { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #14532D; }
.alert-info    { background: var(--c-accent-lt); border-color: #93C5FD; color: #1E40AF; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F6F8 60%, #E0F2FE 100%);
  padding: 2rem;
}
.auth-box {
  background: var(--c-surface); border-radius: 16px; padding: 2.5rem;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-md);
  border: 1px solid var(--c-border);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .brand-symbol { font-size: 3rem; color: var(--c-accent); font-family: var(--font-display); }
.auth-logo h1 { font-size: 2rem; letter-spacing: -.04em; }
.auth-logo p { color: var(--c-muted); font-size: .9rem; margin-top: .25rem; }

/* ── Scan page ───────────────────────────────────────────── */
.scan-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1B6CF2 0%, #0F4BBF 100%);
  padding: 1.5rem;
}
.scan-box {
  background: #fff; border-radius: 20px; padding: 2rem;
  width: 100%; max-width: 480px; box-shadow: 0 8px 40px rgba(0,0,0,.18);
}
.scan-placement { text-align: center; margin-bottom: 1.75rem; }
.scan-placement .type-icon {
  width: 64px; height: 64px; background: var(--c-accent-lt); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto .75rem;
  font-size: 2rem;
}
.scan-placement h2 { font-size: 1.4rem; }
.scan-placement p { color: var(--c-muted); font-size: .9rem; margin-top: .3rem; }

.option-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.25rem; }
.option-btn {
  display: flex; align-items: center; gap: .85rem;
  padding: .9rem 1rem; border-radius: 10px; border: 2px solid var(--c-border);
  background: #fff; cursor: pointer; text-align: left; transition: var(--transition);
  font-family: var(--font-body); font-size: .95rem; font-weight: 500;
}
.option-btn:hover { border-color: var(--c-accent); background: var(--c-accent-lt); }
.option-btn.selected { border-color: var(--c-accent); background: var(--c-accent-lt); }
.option-btn .sev { flex-shrink: 0; }

/* ── Overview ────────────────────────────────────────────── */
.report-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--c-border);
  transition: var(--transition);
}
.report-row:last-child { border-bottom: none; }
.report-row:hover { background: #FAFBFC; }
.report-meta { font-size: .78rem; color: var(--c-muted); margin-top: .2rem; }
.report-title { font-weight: 600; font-size: .9rem; }

.placement-block { border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.placement-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem; background: var(--c-bg); border-bottom: 1px solid var(--c-border);
}
.placement-header h3 { font-size: .95rem; margin: 0; }
.placement-score {
  margin-left: auto; font-family: var(--font-display); font-weight: 800;
  font-size: 1.1rem; color: var(--c-danger);
}

/* ── QR code display ─────────────────────────────────────── */
.qr-preview { text-align: center; }
.qr-preview img { max-width: 180px; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 8px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--c-surface); border-radius: 16px; padding: 2rem;
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--c-muted); line-height: 1; }

/* ── Chips / Tags ────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.chip-blue { background: var(--c-accent-lt); color: var(--c-accent); }
.chip-green { background: #F0FDF4; color: var(--c-success); }
.chip-red { background: #FEF2F2; color: var(--c-danger); }
.chip-gray { background: var(--c-bg); color: var(--c-muted); }

/* ── Footer ──────────────────────────────────────────────── */
.app-footer {
  padding: 1.25rem 2rem; background: var(--c-surface);
  border-top: 1px solid var(--c-border); text-align: center;
  font-size: .78rem; color: var(--c-muted); margin-top: auto;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty {
  text-align: center; padding: 3rem 1rem; color: var(--c-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .4; }
.empty h3 { font-size: 1rem; color: var(--c-text); margin-bottom: .5rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .page { padding: 1.5rem 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 1.25rem; }
}

/* ============================================================
   v2 — navigation med "Opsætning"-menu + mobil-hamburger
   ============================================================ */
.nav-menu { display: flex; align-items: center; flex: 1; gap: 1rem; min-width: 0; }
.nav-links { align-items: center; flex-wrap: nowrap; margin: 0; padding: 0; }
.nav-links li { list-style: none; }
.nav-more { position: relative; }
.nav-more summary {
  list-style: none; cursor: pointer; padding: .4rem .75rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; color: var(--c-muted); user-select: none;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: ' ▾'; font-size: .7rem; }
.nav-more summary:hover, .nav-more details[open] summary { color: var(--c-accent); background: var(--c-accent-lt); }
.nav-more ul {
  position: absolute; top: calc(100% + .4rem); left: 0; min-width: 210px; z-index: 150;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: .4rem; margin: 0; display: flex; flex-direction: column; gap: .1rem;
}
.nav-more ul a { display: block; }
.nav-username { text-decoration: none; }
.nav-username:hover { color: var(--c-accent); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; cursor: pointer; padding: .5rem; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--c-text); margin: 4px 0; border-radius: 2px; transition: var(--transition); }

@media (max-width: 980px) {
  .app-nav { padding: 0 1rem; gap: .75rem; flex-wrap: wrap; height: auto; min-height: 60px; }
  .nav-toggle { display: block; }
  .nav-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .5rem 0 1rem; }
  .app-nav.open .nav-menu { display: flex; }
  .nav-links { flex-direction: column; align-items: stretch; gap: .1rem; }
  .nav-links a, .nav-more summary { display: block; padding: .65rem .75rem; font-size: .95rem; }
  .nav-more ul { position: static; box-shadow: none; border: 0; padding: 0 0 0 .75rem; min-width: 0; }
  .nav-user { margin-left: 0; justify-content: space-between; border-top: 1px solid var(--c-border); padding-top: .75rem; }
  .app-nav.open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .app-nav.open .nav-toggle span:nth-child(2) { opacity: 0; }
  .app-nav.open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ── Fælles komponenter v2 ──────────────────────────────── */
.muted { color: var(--c-muted); }
.small { font-size: .82rem; }
.section-label { font-size: .8rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .85rem; font-family: var(--font-body); }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check input { width: auto; margin: 0; }
.esc-box { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 1rem; display: flex; flex-direction: column; gap: .85rem; }
.esc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.esc-preview { font-size: .8rem; color: var(--c-accent); padding: .35rem .6rem; background: var(--c-accent-lt); border-radius: var(--radius-sm); }
.is-paused td { opacity: .55; }
.honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.comment-line { display: flex; gap: .55rem; font-size: .84rem; }
.comment-line::before { content: ''; width: 3px; background: var(--c-accent); border-radius: 2px; flex-shrink: 0; }
.detail-panel { padding: .9rem 1.25rem 1.1rem; background: #FAFBFC; border-bottom: 1px solid var(--c-border); }
.qr-canvas { display: inline-block; line-height: 0; }
.qr-canvas svg, .qr-canvas img { width: 100%; height: auto; }
code.url { font-size: .75rem; word-break: break-all; }
@media (max-width: 600px) { .esc-fields { grid-template-columns: 1fr; } .table-wrap table { font-size: .8rem; } }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.grid-2-1 > .card + .card { margin-top: 0; }
@media (max-width: 860px) { .grid-2-1 { grid-template-columns: 1fr; } }
