/* Moderne stiler – samspiller med Tailwind (CDN) og klasser generert av app.js */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

header { display: none; }

.hero { line-height: 0; }

/* ── Kort ── */
.card {
  background: #ffffff;
  border: 1px solid rgb(226 232 240);          /* slate-200 */
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover { box-shadow: 0 6px 24px -8px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.06); }
}
.card h2 {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgb(192 57 43);                        /* brand-500 */
  margin: 0 0 18px;
}

/* ── Skjema ── */
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgb(226 232 240);
  border-radius: 10px;
  font-size: .95rem;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background 200ms var(--ease-out), color 200ms var(--ease-out);
  background: #fff;
  color: rgb(15 23 42);
  font-family: inherit;
}
select { margin-bottom: 24px; }
input:focus, select:focus {
  border-color: rgb(192 57 43);
  box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.12);
}

/* ── Knapper ── */
button {
  width: 100%;
  padding: 11px 16px;
  background: linear-gradient(135deg, #c0392b 0%, #a12a1f 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 200ms var(--ease-out), background 200ms var(--ease-out), opacity 200ms var(--ease-out);
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
@media (hover: hover) and (pointer: fine) {
  button:hover { box-shadow: 0 4px 12px -2px rgba(192, 57, 43, 0.35); }
}
button:active { transform: scale(0.97); }
button:disabled {
  background: rgb(203 213 225);
  cursor: default;
  box-shadow: none;
}
button.secondary {
  background: white;
  color: rgb(192 57 43);
  border: 1.5px solid rgb(192 57 43);
  margin-top: 8px;
  box-shadow: none;
}
@media (hover: hover) and (pointer: fine) {
  button.secondary:hover { background: rgb(253 244 243); }
}

/* ── Aktiver varsler-knapp ── */
#enable-notifications-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  padding: 13px 16px;
  border: 1.5px solid rgb(192 57 43);   /* brand-500 — samme som Oppdater */
}
#permission-status {
  font-weight: 500;
}

/* ── Tydelig kant på primære handlingsknapper ── */
#search-btn {
  border: 1.5px solid rgb(192 57 43);
}
body.dark #enable-notifications-btn,
body.dark #search-btn {
  border-color: rgb(224 123 114);   /* brand-400, samme som Oppdater i dark mode */
}

/* ── Søkeresultat (spillerkort) ── */
.player-result {
  border: 1.5px solid rgb(226 232 240);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 160ms var(--ease-out);
  background: #fff;
}
@media (hover: hover) and (pointer: fine) {
  .player-result:hover {
    background: rgb(253 244 243);
    border-color: rgb(224 123 114);
    transform: translateY(-1px);
  }
}
.player-result:active { transform: scale(0.99); }
.player-result .name { font-weight: 600; color: rgb(15 23 42); }
.player-result .matches { font-size: .82rem; color: rgb(100 116 139); margin-top: 2px; }

/* ── Fulgte spillere ── */
.followed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid rgb(241 245 249);
  gap: 12px;
}
.followed-item:last-child { border-bottom: none; }
.followed-item .info .name { font-weight: 600; font-size: .95rem; }
.followed-item .info .sub { font-size: .8rem; color: rgb(100 116 139); margin-top: 2px; }
.followed-item button {
  width: auto;
  padding: 7px 14px;
  font-size: .82rem;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-radius: 999px;
}

/* ── Statusmeldinger ── */
.status {
  font-size: .88rem;
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid transparent;
}
.status.ok   { background: rgb(236 253 245); color: rgb(6 95 70);   border-color: rgb(167 243 208); }
.status.warn { background: rgb(254 252 232); color: rgb(133 77 14); border-color: rgb(253 224 71); }
.status.err  { background: rgb(254 242 242); color: rgb(153 27 27); border-color: rgb(252 165 165); }

/* ── Install-knapp + veiledning ── */
#install-btn { display: none; }

#install-guide {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid rgb(253 224 71);
  border-radius: 16px;
  padding: 16px 18px;
}
.install-guide-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.install-guide-header strong { flex: 1; font-size: .95rem; color: rgb(120 53 15); }
#install-guide-dismiss {
  width: auto;
  background: none;
  border: none;
  color: rgb(120 113 108);
  font-size: 1rem;
  padding: 2px 6px;
  cursor: pointer;
  line-height: 1;
  box-shadow: none;
}
@media (hover: hover) and (pointer: fine) {
  #install-guide-dismiss:hover { color: rgb(63 63 70); background: rgba(0,0,0,0.04); }
}
.install-guide-desc { font-size: .84rem; color: rgb(120 113 108); margin-bottom: 12px; }
.ios-install-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .92rem;
  margin-bottom: 10px;
}
.ios-install-num {
  background: linear-gradient(135deg, #c0392b 0%, #a12a1f 100%);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(192, 57, 43, 0.3);
}
.ios-install-note { font-size: .8rem; color: rgb(120 113 108); margin: 4px 0 10px; }

.loader {
  text-align: center;
  color: rgb(148 163 184);
  padding: 18px;
  font-size: .9rem;
}

/* ── Varsel-innstilling ── */
.notify-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 6px;
  font-size: .9rem;
  color: rgb(71 85 105);
}
.notify-setting input { width: 68px; margin-bottom: 0; text-align: center; }

.empty {
  text-align: center;
  color: rgb(148 163 184);
  font-size: .9rem;
  padding: 24px 10px;
}

/* ── Tab-bar (segmentert pill) ── */
.tab-bar {
  padding: 6px;
  gap: 4px;
}
.tab-bar button {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px 8px;
  font-size: .92rem;
  font-weight: 600;
  color: rgb(71 85 105);
  cursor: pointer;
  transition: color 200ms var(--ease-out), background 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
  box-shadow: none;
  font-family: inherit;
}
.tab-bar button.active {
  color: rgb(192 57 43);
  background: rgba(192, 57, 43, 0.10);
  box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.20);
}
@media (hover: hover) and (pointer: fine) {
  .tab-bar button:hover:not(.active) {
    color: rgb(15 23 42);
    background: rgba(0,0,0,0.04);
  }
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 200ms var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── Kampkort ── */
.match-card {
  background: #fff;
  border: 1px solid rgb(226 232 240);
  border-radius: 14px;
  padding: 14px 16px 14px 18px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.05);
  border-left: 4px solid rgb(192 57 43);
  transition: background 200ms var(--ease-out), transform 160ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .match-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -6px rgba(15,23,42,0.12);
  }
}
.match-card .mc-player {
  font-size: .72rem;
  font-weight: 700;
  color: rgb(192 57 43);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.match-card .mc-event { font-size: .82rem; color: rgb(100 116 139); margin-bottom: 6px; }
.match-card .mc-vs { font-size: .98rem; font-weight: 600; margin-bottom: 8px; color: rgb(15 23 42); }
.match-card .mc-meta {
  display: flex;
  gap: 12px;
  font-size: .82rem;
  color: rgb(71 85 105);
  flex-wrap: wrap;
}
.match-card .mc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.mc-vs-sep { color: rgb(203 213 225); font-weight: 400; margin: 0 6px; }

.mc-refresh {
  width: auto;
  padding: 8px 16px;
  font-size: .85rem;
  margin-bottom: 14px;
  background: white;
  color: rgb(192 57 43);
  border: 1.5px solid rgb(192 57 43);
  box-shadow: none;
  border-radius: 999px;
}
@media (hover: hover) and (pointer: fine) {
  .mc-refresh:hover { background: rgb(253 244 243); box-shadow: none; }
}

/* ── Resultat-badge ── */
.mc-winner {
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 6px;
  letter-spacing: .02em;
}
.mc-winner.won  { background: rgb(220 252 231); color: rgb(22 101 52); }
.mc-winner.lost { background: rgb(254 226 226); color: rgb(153 27 27); }

/* ── Auto-oppdatering-indikator ── */
.auto-refresh-indicator {
  font-size: .76rem;
  color: rgb(148 163 184);
  text-align: right;
  margin-bottom: 8px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.auto-refresh-indicator.refreshing { color: rgb(59 130 246); }
.auto-refresh-indicator.refreshing::before {
  content: "";
  width: 10px; height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════
   MØRK MODUS
══════════════════════════════════════ */
body.dark { background: #0b1220; color: rgb(226 232 240); }
body.dark .card {
  background: rgb(17 24 39);
  border-color: rgb(30 41 59);
  box-shadow: 0 2px 8px -2px rgba(0,0,0,0.5);
}
body.dark .card h2 { color: rgb(224 123 114); }
body.dark input[type="text"],
body.dark input[type="number"],
body.dark select {
  background: rgb(15 23 42);
  border-color: rgb(51 65 85);
  color: rgb(226 232 240);
}
body.dark input::placeholder { color: rgb(100 116 139); }
body.dark input:focus,
body.dark select:focus {
  border-color: rgb(224 123 114);
  box-shadow: 0 0 0 4px rgba(224, 123, 114, 0.15);
}
body.dark button.secondary {
  background: rgb(17 24 39);
  color: rgb(224 123 114);
  border-color: rgb(224 123 114);
}
@media (hover: hover) and (pointer: fine) {
  body.dark button.secondary:hover { background: rgb(30 41 59); }
}

body.dark .tab-bar button { color: rgb(148 163 184); }
body.dark .tab-bar button.active {
  color: rgb(224 123 114);
  background: rgba(224, 123, 114, 0.16);
  box-shadow: inset 0 0 0 1px rgba(224, 123, 114, 0.28);
}
@media (hover: hover) and (pointer: fine) {
  body.dark .tab-bar button:hover:not(.active) { color: rgb(241 245 249); background: rgba(255,255,255,0.06); }
}

body.dark .player-result {
  background: rgb(17 24 39);
  border-color: rgb(30 41 59);
}
@media (hover: hover) and (pointer: fine) {
  body.dark .player-result:hover { background: rgb(30 41 59); border-color: rgb(224 123 114); }
}
body.dark .player-result .name { color: rgb(241 245 249); }
body.dark .player-result .matches { color: rgb(148 163 184); }

body.dark .followed-item { border-bottom-color: rgb(30 41 59); }
body.dark .followed-item .info .sub { color: rgb(148 163 184); }

body.dark .match-card {
  background: rgb(17 24 39);
  border-color: rgb(30 41 59);
  border-left-color: rgb(224 123 114);
}
body.dark .match-card .mc-player { color: rgb(224 123 114); }
body.dark .match-card .mc-event { color: rgb(148 163 184); }
body.dark .match-card .mc-vs { color: rgb(241 245 249); }
body.dark .match-card .mc-meta { color: rgb(148 163 184); }
body.dark .mc-vs-sep { color: rgb(71 85 105); }

body.dark .mc-refresh {
  background: rgb(17 24 39);
  color: rgb(224 123 114);
  border-color: rgb(224 123 114);
}
@media (hover: hover) and (pointer: fine) {
  body.dark .mc-refresh:hover { background: rgb(30 41 59); }
}

body.dark .status.ok   { background: rgb(6 78 59 / 0.4);  color: rgb(110 231 183); border-color: rgb(6 95 70); }
body.dark .status.warn { background: rgb(120 53 15 / 0.4); color: rgb(253 224 71);  border-color: rgb(133 77 14); }
body.dark .status.err  { background: rgb(127 29 29 / 0.4); color: rgb(252 165 165); border-color: rgb(153 27 27); }

body.dark #install-guide {
  background: linear-gradient(135deg, #2a2410 0%, #3a2f14 100%);
  border-color: rgb(133 77 14);
}
body.dark .install-guide-header strong { color: rgb(253 224 71); }
body.dark .install-guide-desc { color: rgb(148 163 184); }
body.dark #install-guide-dismiss { color: rgb(100 116 139); }
@media (hover: hover) and (pointer: fine) {
  body.dark #install-guide-dismiss:hover { color: rgb(226 232 240); background: rgba(255,255,255,0.05); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .auto-refresh-indicator.refreshing::before {
    animation-duration: 1.2s !important;
    animation-iteration-count: infinite !important;
  }
}
body.dark .ios-install-note { color: rgb(100 116 139); }

body.dark .loader { color: rgb(100 116 139); }
body.dark .empty  { color: rgb(71 85 105); }
body.dark .auto-refresh-indicator { color: rgb(71 85 105); }
body.dark .auto-refresh-indicator.refreshing { color: rgb(96 165 250); }
body.dark .mc-winner.won  { background: rgb(6 78 59 / 0.5);  color: rgb(110 231 183); }
body.dark .mc-winner.lost { background: rgb(127 29 29 / 0.5); color: rgb(252 165 165); }
