/* TrappKoll – gemensamma varumärkestokens och komponenter */
@import url('../fonts/manrope.css');

:root {
  --navy: #13293D;
  --navy-2: #1E3A54;
  --navy-3: #2C5070;
  --orange: #FF8A1F;
  --orange-2: #E8740A;
  --orange-soft: #FFF1E3;
  --green: #1FA463;
  --green-soft: #E3F6EC;
  --red: #E0473C;
  --red-soft: #FDE9E7;
  --blue: #2F7DE1;
  --blue-soft: #E6F0FC;
  --purple: #7B5CD6;
  --purple-soft: #EFEAFB;

  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #EEF2F6;
  --line: #DDE3EA;
  --text: #13293D;
  --muted: #5E7184;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(19,41,61,.06), 0 6px 20px rgba(19,41,61,.08);
  --shadow-lg: 0 20px 60px rgba(19,41,61,.18);
  --font: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
img, svg { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Knappar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: transform .12s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 6px 16px rgba(255,138,31,.35); }
.btn-primary:hover { background: var(--orange-2); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Etiketter */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.tag-orange { background: var(--orange-soft); color: var(--orange-2); }
.tag-green  { background: var(--green-soft);  color: var(--green); }
.tag-red    { background: var(--red-soft);    color: var(--red); }
.tag-blue   { background: var(--blue-soft);   color: var(--blue); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }
.tag-brown  { background: #F4ECE3; color: #8A5A2B; }
.tag-pink   { background: #FBEAF3; color: #B83280; }

/* Formulär */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface); outline: none;
}
.input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,138,31,.18); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px;
}
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Kartmarkörer (Leaflet divIcon) */
.tk-pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  display: grid; place-items: center; border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3);
}
.tk-pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 12px; }
.leaflet-container { font-family: var(--font); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }

/* Bekräftelseruta */
.tk-ask { position: fixed; inset: 0; z-index: 10000; background: rgba(10,20,30,.5); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.tk-ask.show { opacity: 1; }
.tk-ask-box { background: var(--surface); border-radius: 18px; padding: 22px; width: 100%; max-width: 360px; box-shadow: var(--shadow-lg); }
.tk-ask-box p { margin: 0 0 18px; font-weight: 600; font-size: 16px; line-height: 1.4; }
.tk-ask-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Gatunamn på inbäddad karta */
.tk-street { pointer-events: none; }
.tk-street span { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; font: 600 11px var(--font); color: #5A5048; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 9999; box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Inloggning (live) ---------- */
.auth-title { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.auth-sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

/* ---------- Synkstatus (live) ---------- */
html[data-sync="error"] body::after {
  content: "⚠️ Ej sparat – försöker igen…"; position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 9999; background: #8A1C1C; color: #fff;
  font: 700 12px/1 Manrope, system-ui, sans-serif; padding: 8px 12px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  pointer-events: none;
}
html[data-sync="offline"] body::after {
  content: "📴 Offline – ändringarna sparas i telefonen och skickas när du har täckning"; position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 9999; background: #13293D; color: #fff; text-align: center; width: max-content; max-width: 92vw;
  font: 700 12px/1.3 Manrope, system-ui, sans-serif; padding: 8px 12px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  pointer-events: none;
}

/* Linjeikoner (ersatte emojis 2026-11-17) */
svg.tki { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tk-pin span svg.tki { width: 15px; height: 15px; color: #fff !important; vertical-align: middle; }
.empty .big svg.tki { width: 40px; height: 40px; color: var(--muted); stroke-width: 1.6; margin: 0 auto; display: block; }
.ic > svg.tki { width: 22px; height: 22px; }
