/* ── Reset & Basis ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117; --bg2: #1a1d2e; --bg3: #252840;
  --border: #2e3150; --text: #e8eaf0; --muted: #7b80a0;
  --accent: #4f8ef7; --accent2: #7c4dff; --green: #2ecc71;
  --red: #e74c3c; --orange: #f39c12; --yellow: #f1c40f;
  --radius: 10px; --shadow: 0 4px 20px rgba(0,0,0,.4);
}
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topnav ─────────────────────────────────────────────────────────────── */
.topnav { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 56px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.logo { font-size: 1.2rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; align-items: center; gap: 12px; }
.btn-nav { padding: 6px 14px; border-radius: 6px; background: var(--bg3); color: var(--text); font-size: .85rem; }
.btn-nav.btn-outline { background: transparent; border: 1px solid var(--border); }
.btn-nav:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.footer { text-align: center; padding: 24px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; padding: 16px 24px; }
.section { margin-bottom: 40px; }
.section-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 16px; }
.live-title { color: var(--red); }
.empty-state { color: var(--muted); padding: 32px; text-align: center; background: var(--bg2); border-radius: var(--radius); }
.center-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50vh; gap: 16px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); cursor: pointer; font-size: .9rem; transition: all .15s; white-space: nowrap; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3a7de8; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-outline { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Cards Ligen ────────────────────────────────────────────────────────── */
.league-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.league-card { display: block; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: all .2s; color: var(--text); }
.league-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow); }
.league-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.league-card-name { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.league-card-season { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.league-card-stats { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); }
.league-type-badge { font-size: .75rem; color: var(--muted); }

/* ── Status Pills ───────────────────────────────────────────────────────── */
.status-pill, .league-status-badge { padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.status-pill.active, .league-status-badge.active { background: rgba(46,204,113,.15); color: var(--green); }
.status-pill.finished, .league-status-badge.finished { background: rgba(123,128,160,.15); color: var(--muted); }
.status-pill.planned, .league-status-badge.planned { background: rgba(79,142,247,.15); color: var(--accent); }

/* ── Live Badges ────────────────────────────────────────────────────────── */
.live-badge { position: absolute; top: 12px; right: 12px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; animation: pulse 1.5s infinite; }
.live-badge-sm { background: var(--red); color: #fff; font-size: .75rem; padding: 2px 6px; border-radius: 4px; animation: pulse 1.5s infinite; }
.live-dot { color: var(--red); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Game Cards (Startseite Live) ───────────────────────────────────────── */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 14px; }
.game-card { display: block; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; color: var(--text); transition: all .2s; }
.game-card:hover { border-color: var(--accent); text-decoration: none; }
.live-card { border-color: rgba(231,76,60,.4); }
.game-card-league { font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.game-card-teams { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.score-box { font-size: 1.3rem; font-weight: 800; background: var(--bg3); padding: 4px 12px; border-radius: 6px; white-space: nowrap; }
.game-card-info { font-size: .78rem; color: var(--muted); margin-top: 8px; }

/* ── Page Header ────────────────────────────────────────────────────────── */
.page-header { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.back-link { color: var(--muted); font-size: .85rem; }
.back-link:hover { color: var(--accent); }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Tabelle ────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.standings-table, .stats-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.standings-table th, .standings-table td,
.stats-table th, .stats-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.standings-table th, .stats-table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.standings-table tbody tr:hover, .stats-table tbody tr:hover { background: var(--bg2); }
.text-left { text-align: left !important; }
.pos { font-weight: 700; color: var(--muted); width: 30px; }
.points-cell { color: var(--accent); font-size: 1rem; }
.pos-diff { color: var(--green); }
.neg-diff { color: var(--red); }
.small { font-size: .78rem; color: var(--muted); }
.club-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.short-name { color: var(--muted); font-size: .8rem; }

/* ── Spielplan Rows ─────────────────────────────────────────────────────── */
.round-header { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 16px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.game-row { display: grid; grid-template-columns: 130px 1fr 80px; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--border); color: var(--text); gap: 12px; transition: background .15s; }
.game-row:hover { background: var(--bg2); text-decoration: none; }
.game-row-date { font-size: .82rem; color: var(--muted); }
.game-row-time { display: block; font-weight: 600; color: var(--text); }
.game-row-teams { display: flex; align-items: center; gap: 8px; font-size: .9rem; flex-wrap: wrap; }
.vs { color: var(--muted); font-size: .8rem; }
.game-row-loc { font-size: .78rem; color: var(--muted); text-align: right; }
.result-row .result-teams { gap: 12px; }
.result-score { font-weight: 700; background: var(--bg3); padding: 2px 10px; border-radius: 6px; white-space: nowrap; }
.winner { font-weight: 700; color: var(--text); }

/* ── Scoreboard ─────────────────────────────────────────────────────────── */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 28px; align-items: center; }
.team-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.away-block { align-items: flex-end; }
.team-color-bar { height: 4px; width: 60px; border-radius: 2px; }
.team-score-name { font-size: .95rem; font-weight: 600; text-align: center; }
.team-score-num { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.game-meta-center { text-align: center; }
.game-period { font-size: 1rem; font-weight: 700; color: var(--accent); }
.game-clock { font-size: 1.4rem; font-weight: 800; }
.game-date-small { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── Statistiken ────────────────────────────────────────────────────────── */
.stats-team-header { padding: 12px 16px; font-weight: 700; margin: 16px 0 8px; background: var(--bg2); border-radius: 6px; }
.bench-player { opacity: .55; }
.oncourt-dot { color: var(--green); font-size: .7rem; }
.foul-warn { color: var(--orange); font-weight: 700; }
.foul-out { color: var(--red); font-weight: 700; }

/* ── Log ────────────────────────────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-entry { display: flex; gap: 10px; padding: 8px 12px; background: var(--bg2); border-radius: 6px; font-size: .85rem; }
.log-period { color: var(--accent); font-weight: 700; min-width: 20px; }
.log-time { color: var(--muted); min-width: 45px; }
.new-entry { border-left: 3px solid var(--green); animation: slide-in .3s ease; }
@keyframes slide-in { from { opacity:0; transform:translateX(-10px); } to { opacity:1; transform:none; } }

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; }
.auth-logo { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 1.3rem; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--muted); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: .83rem; color: var(--muted); font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-input { background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 6px; font-size: .9rem; width: 100%; }
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input-sm { padding: 5px 10px; font-size: .82rem; }
input[type="color"].form-input { height: 40px; padding: 4px; cursor: pointer; }
.mt-xs { margin-top: 6px; }
.mt { margin-top: 14px; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: .88rem; }
.alert-error { background: rgba(231,76,60,.15); border: 1px solid rgba(231,76,60,.4); color: #e74c3c; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 201; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-inner { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 28px; min-width: 340px; }
.modal-inner.wide { min-width: min(680px, 90vw); }
.modal-inner h3 { font-size: 1.1rem; margin-bottom: 20px; }
.modal-inner h4 { font-size: .9rem; color: var(--muted); margin: 16px 0 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.hidden { display: none !important; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px; font-size: .88rem; font-weight: 500; z-index: 500; animation: slide-in .2s ease; }
.toast-ok { background: var(--green); color: #fff; }
.toast-err { background: var(--red); color: #fff; }

@media (max-width: 600px) {
  .game-row { grid-template-columns: 90px 1fr; }
  .game-row-loc { display: none; }
  .scoreboard { gap: 8px; padding: 16px 10px; }
  .team-score-num { font-size: 2.5rem; }
  .form-row { grid-template-columns: 1fr; }
}
