/* ============================================================
   GamePlan – delad stil
   Laddas av index.php, cb-planritare.php,
   cb-pass.php
   ============================================================ */

:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --card:      #1a1a1a;
  --card2:     #1e1e1e;
  --border:    #262626;
  --border2:   #3a3a3a;

  /* Sätts om av temat i cb-common.js. Värdena här är Original. */
  --accent:    #f0a03c;
  --accent2:   #f5c842;
  --court:     #d2691e;
  --nav-1:     #241a10;
  --nav-2:     #4a3016;
  /* Textfärg ovanpå accentfärgade ytor. Alla teman har ljusa
     accenter, så mörk text ger bäst kontrast på samtliga. */
  --on-accent: #14100a;
  --blue:      #4f8ef7;
  --green:     #22c87a;
  --red:       #f75050;
  --gold:      #f5c842;
  --orange:    #f79c3e;

  /* Kontrast: gamla #2a2a2a/#505050 mot #1a1a1a var oläsligt i solljus */
  --text:      #e8edf5;
  --muted:     #9aa3b2;
  --muted2:    #6b7280;
  --faint:     #4b5563;

  --radius:    8px;
}

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

/* ── Ikoner (PNG istället för emoji) ───────────────────────── */
.ico {
  width: 1.05em;
  height: 1.05em;
  object-fit: contain;
  vertical-align: -0.15em;
  display: inline-block;
  flex-shrink: 0;
}
.ico-lg { width: 1.6em; height: 1.6em; }
.ico-xl { width: 48px; height: 48px; opacity: 0.55; }

/* ── Tillgänglighet ────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Typ-/kategoribadges (identiska på alla sidor) ─────────── */
.b {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.b-offence    { background: #3d2b00; color: #ffc107; }
.b-defence    { background: #002244; color: #4fc3f7; }
.b-drill      { background: #22223a; color: #b0b0ff; }
.b-shot       { background: #2d0a14; color: #ef9a9a; }
.b-press      { background: #1f0d33; color: #d5a5e0; }
.b-transition { background: #2d0a20; color: #f48fb1; }
.b-other      { background: #262626; color: #9aa3b2; }
.b-stretch    { background: #0f2a17; color: #81c784; }
.b-game       { background: #2e1d05; color: #ffb74d; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ── Lagringsvarning (kvot full / localStorage otillgängligt) ─ */
#cb-storage-warning {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  background: #3a1414;
  border: 1px solid #7a2a2a;
  color: #ffd7d7;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  z-index: 5000;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
#cb-storage-warning button {
  background: #7a2a2a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Termbadge (lexikonkoppling) ───────────────────────────── */
.b-term { background: #12303a; color: #7fd0e8; }


/* ── Logotyp ────────────────────────────────────────────────
   Accentdelen av ordet "GamePlan". Definieras här så att
   alla fyra sidor ser likadana ut. */
.logo-dot { color: var(--accent); }

/* ── Gemensam navigering ────────────────────────────────────
   Samma meny på alla sidor. Scrollar i sidled på små skärmar
   istället för att radbrytas till tre rader. */
.cb-nav {
  background: linear-gradient(135deg, var(--nav-1), var(--nav-2));
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.cb-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15em;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.cb-nav-links {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 0;
  flex: 1;
}
.cb-nav-links::-webkit-scrollbar { display: none; }
.cb-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.62);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}
.cb-tab:hover { color: #fff; background: rgba(255,255,255,0.07); }
.cb-tab.active { background: rgba(255,255,255,0.16); color: #fff; }

@media (max-width: 720px) {
  .cb-nav { gap: 10px; padding: 0 12px; }
  .cb-logo { font-size: 1em; }
  .cb-tab { padding: 8px 10px; }
  .cb-tab span { display: none; }          /* bara ikoner när det är trångt */
  .cb-tab.active span { display: inline; } /* utom på den aktiva */
  .cb-tab .ico { width: 1.25em; height: 1.25em; }
}


/* ── Temaberoende ytor ──────────────────────────────────────
   Klasser som sidorna delar och som ska följa färgtemat. */
.cb-grad { background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* ── Språkväljare i menyn ───────────────────────────────── */
.cb-langpick { display: flex; gap: 6px; flex-shrink: 0; }
.cb-langpick select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  max-width: 150px;
}
.cb-langpick select option { background: #1a1a2e; color: #fff; }
@media (max-width: 720px) {
  .cb-langpick select { max-width: 88px; font-size: 11px; padding: 4px 6px; }
}


/* ── Flikar för lagverktygen (laguppställning, grupper, speltid) ── */
.lagflikar { display: flex; gap: 4px; max-width: 1180px; margin: 14px auto 0; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.lagflikar::-webkit-scrollbar { display: none; }
.lagflik { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 9px 9px 0 0;
  font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; border-bottom: 2px solid transparent; }
.lagflik:hover { color: var(--text); }
.lagflik.aktiv { color: var(--text); background: var(--card); border-color: var(--border); border-bottom-color: var(--accent); }
.lagflik .ico { width: 1.2em; height: 1.2em; }
@media print { .lagflikar { display: none !important; } }
/* Telefon: alla fyra flikarna får plats bredvid varandra, med ikonen
   ovanför texten. Förut hamnade den fjärde utanför skärmen. */
@media (max-width: 560px) {
  .lagflikar { gap: 2px; padding: 0 8px; overflow: visible; }
  .lagflik { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; padding: 7px 2px 6px; font-size: 10.5px; line-height: 1.15; text-align: center; }
  .lagflik span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .lagflik .ico { width: 1.7em; height: 1.7em; }
}

/* ── Sparade lottningar och uppställningar (cb-trupp.js, cb-lag.php) ── */
.sparlista { display: flex; flex-direction: column; gap: 6px; }
.sparrad { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--card2); }
.sparrad.oppen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sparnamn { flex: 1; min-width: 0; background: none; border: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; padding: 2px 6px; }
.sparnamn b { display: block; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sparnamn > span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sparmarke { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: var(--accent); vertical-align: 1px; }
.sparfara { color: #ff9b9b; }
.sparfara:hover { border-color: #c62828; }
.sparstatus { font-size: 12px; color: var(--muted); }
.sparstatus.osparad { color: #f0b878; }
@media (max-width: 520px) { .sparrad .knapp .sp-text { display: none; } }
@media print { .sparlista, .sparstatus { display: none !important; } }

/* ── Färgväljare (CB.Farger i cb-common.js) ── */
.cbf { display: flex; flex-direction: column; gap: 8px; }
.cbf-rad { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.cbf-etikett { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); min-width: 62px; }
.cbf-farg, .cbf-egen { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.22); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 900; line-height: 1; flex-shrink: 0; }
.cbf-farg:hover, .cbf-egen:hover { transform: scale(1.1); }
.cbf-farg.vald { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.cbf-egen { position: relative; overflow: hidden; color: #fff; border-style: dashed;
  background: conic-gradient(#f44336, #ffeb3b, #4caf50, #03a9f4, #9c27b0, #f44336); text-shadow: 0 0 3px #000; }
.cbf-egen input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.cbf-egen:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media print { .cbf { display: none !important; } }
