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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f4f4;
  color: #222;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

header {
  background: #738aa1;
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

header h1 { font-size: 1.4rem; font-weight: 700; }
header span { font-size: 0.85rem; opacity: 0.85; }

#dark-mode-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  width: auto;
  border-radius: 8px;
  transition: background 0.2s;
  flex-shrink: 0;
}
#dark-mode-btn:hover { background: rgba(255,255,255,0.15); }

main { max-width: 600px; margin: 0 auto; padding: 20px 16px; }

.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: background 0.2s, box-shadow 0.2s;
}

.card h2 { font-size: 1rem; color: #a15c54; margin-bottom: 14px; }

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  background: white;
  color: #222;
}
input:focus, select:focus { border-color: #8e0201; }

button {
  width: 100%;
  padding: 12px;
  background: #337ab7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover { background: #286090; }
button:disabled { background: #ccc; cursor: default; }
button.secondary {
  background: white;
  color: #c0392b;
  border: 1.5px solid #c0392b;
  margin-top: 8px;
}

.player-result {
  border: 1.5px solid #eee;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.player-result:hover { background: #fef9f9; border-color: #c0392b; }
.player-result .name { font-weight: 600; }
.player-result .matches { font-size: 0.85rem; color: #666; margin-top: 2px; }

.followed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.followed-item:last-child { border-bottom: none; }
.followed-item .info .name { font-weight: 600; font-size: 0.95rem; }
.followed-item .info .sub { font-size: 0.8rem; color: #888; }
.followed-item button { width: auto; padding: 6px 14px; font-size: 0.85rem; background: #e74c3c; }

.status {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 10px;
}
.status.ok   { background: #eafaf1; color: #1e8449; }
.status.warn { background: #fef9e7; color: #9a7d0a; }
.status.err  { background: #fdf2f2; color: #c0392b; }

#install-btn { display: none; margin-bottom: 16px; background: #2c3e50; }

/* ── Installasjonsveiledning ── */
#install-guide {
  background: #fff8e1;
  border: 1.5px solid #f0c040;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.install-guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.install-guide-header strong {
  flex: 1;
  font-size: 0.95rem;
}
#install-guide-dismiss {
  width: auto;
  background: none;
  border: none;
  color: #aaa;
  font-size: 1rem;
  padding: 0 4px;
  cursor: pointer;
  line-height: 1;
}
#install-guide-dismiss:hover { color: #555; background: none; }
.install-guide-desc {
  font-size: 0.82rem;
  color: #777;
  margin-bottom: 12px;
}
.ios-install-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  margin-bottom: 10px;
}
.ios-install-num {
  background: #c0392b;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ios-share-icon {
  font-size: 1.1rem;
  margin-left: 4px;
}
.ios-install-note {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
  margin-top: 4px;
}
/* Mørk modus for installasjonsveiledning */
body.dark #install-guide {
  background: #2a2410;
  border-color: #8a7030;
}
body.dark .install-guide-desc { color: #999; }
body.dark #install-guide-dismiss { color: #666; }

.loader { text-align: center; color: #888; padding: 16px; font-size: 0.9rem; }

.notify-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.9rem;
}
.notify-setting input { width: 60px; margin-bottom: 0; }

.empty { text-align: center; color: #aaa; font-size: 0.9rem; padding: 20px; }

/* ── Tab-bar ── */
.tab-bar {
  display: flex;
  background: white;
  border-bottom: 2px solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background 0.2s, border-color 0.2s;
}
.tab-bar button {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 14px 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -2px;
}
.tab-bar button.active {
  color: #c0392b;
  border-bottom-color: #c0392b;
  background: none;
}
.tab-bar button:hover:not(.active) { color: #555; background: none; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Kampkort ── */
.match-card {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-left: 4px solid #c0392b;
  transition: background 0.2s;
}
.match-card .mc-player {
  font-size: 0.78rem;
  font-weight: 700;
  color: #c0392b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.match-card .mc-event {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 6px;
}
.match-card .mc-vs {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.match-card .mc-meta {
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
  color: #555;
}
.match-card .mc-meta span { display: flex; align-items: center; gap: 4px; }
.mc-vs-sep { color: #bbb; font-weight: 400; margin: 0 4px; }
.mc-refresh {
  width: auto;
  padding: 8px 18px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  background: white;
  color: #c0392b;
  border: 1.5px solid #c0392b;
}

/* ── Resultat-badge ── */
.mc-winner {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 6px;
}
.mc-winner.won  { background: #eafaf1; color: #1e8449; }
.mc-winner.lost { background: #fdf2f2; color: #c0392b; }

/* ── Auto-oppdatering indikator ── */
.auto-refresh-indicator {
  font-size: 0.78rem;
  color: #aaa;
  text-align: right;
  margin-bottom: 8px;
}
.auto-refresh-indicator.refreshing { color: #337ab7; }

/* ══════════════════════════════════════
   MØRK MODUS
══════════════════════════════════════ */
body.dark {
  background: #121212;
  color: #e0e0e0;
}
body.dark header {
  background: #1e2d3d;
}
body.dark .card {
  background: #1e1e1e;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
body.dark .card h2 { color: #e07b72; }
body.dark input[type="text"],
body.dark input[type="number"],
body.dark select {
  background: #2a2a2a;
  border-color: #444;
  color: #e0e0e0;
}
body.dark input:focus,
body.dark select:focus { border-color: #e07b72; }
body.dark button.secondary {
  background: #1e1e1e;
  color: #e07b72;
  border-color: #e07b72;
}
body.dark .tab-bar {
  background: #1e1e1e;
  border-bottom-color: #333;
}
body.dark .tab-bar button { color: #666; }
body.dark .tab-bar button.active { color: #e07b72; border-bottom-color: #e07b72; }
body.dark .tab-bar button:hover:not(.active) { color: #aaa; }
body.dark .player-result {
  border-color: #333;
}
body.dark .player-result:hover { background: #2a2a2a; border-color: #e07b72; }
body.dark .player-result .matches { color: #999; }
body.dark .followed-item { border-bottom-color: #2a2a2a; }
body.dark .followed-item .info .sub { color: #888; }
body.dark .match-card {
  background: #1e1e1e;
  border-left-color: #e07b72;
}
body.dark .match-card .mc-player { color: #e07b72; }
body.dark .match-card .mc-event { color: #777; }
body.dark .match-card .mc-meta { color: #888; }
body.dark .mc-vs-sep { color: #555; }
body.dark .mc-refresh {
  background: #1e1e1e;
  color: #e07b72;
  border-color: #e07b72;
}
body.dark .status.ok  { background: #1a2e20; color: #5dbb7a; }
body.dark .status.warn { background: #2a2510; color: #c9a84c; }
body.dark .status.err { background: #2e1a1a; color: #e07b72; }
body.dark #ios-install-banner {
  background: #2a2410;
  border-color: #8a7030;
}
body.dark .ios-install-note { color: #777; }
body.dark .loader { color: #666; }
body.dark .empty { color: #555; }
body.dark .auto-refresh-indicator { color: #555; }
body.dark .auto-refresh-indicator.refreshing { color: #5b9bd5; }
body.dark .mc-winner.won  { background: #1a2e20; color: #5dbb7a; }
body.dark .mc-winner.lost { background: #2e1a1a; color: #e07b72; }
