/* ── Савося — Modern Football UI ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

:root {
  --pitch: #10b981;
  --pitch-light: #ecfdf5;
  --pitch-dark: #059669;
  --pitch-deep: #065f46;
  --accent: #f59e0b;
  --accent-light: #fffbeb;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --win: #dcfce7;
  --win-text: #166534;
  --draw: #fef9c3;
  --draw-text: #854d0e;
  --loss-bg: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

[data-theme="dark"] {
  --pitch: #34d399;
  --pitch-light: #0d2818;
  --pitch-dark: #6ee7b7;
  --pitch-deep: #a7f3d0;
  --accent: #fbbf24;
  --accent-light: #1c1a0e;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #273548;
  --border: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #64748b;
  --danger: #f87171;
  --danger-bg: #1f1215;
  --win: #0d2818;
  --win-text: #6ee7b7;
  --draw: #1c1a0e;
  --draw-text: #fbbf24;
  --loss-bg: #1f1215;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.4);
}
[data-theme="dark"] .header { background: linear-gradient(135deg, #1e3a5f 0%, #1a3d6b 100%); }
[data-theme="dark"] .input, [data-theme="dark"] select.input { background: var(--bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .modal { background: var(--surface); }
[data-theme="dark"] .modal-header { border-color: var(--border); }
[data-theme="dark"] .data-table th { background: #1e3a5f; }
[data-theme="dark"] .cross-table th { background: #1e3a5f; }
[data-theme="dark"] .cross-table td.team-name { background: var(--surface); }
[data-theme="dark"] .cross-table td.self { background: var(--bg); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg) url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5L55 17.5V42.5L30 55L5 42.5V17.5Z' fill='none' stroke='%2394a3b820' stroke-width='.5'/%3E%3C/svg%3E") repeat;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, #1a56db 0%, #2563eb 50%, #3b82f6 100%);
  color: #fff;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff;
}
.header-logo span {
  font-weight: 800; font-size: 18px; letter-spacing: -0.5px;
}
.header-actions { display: flex; align-items: center; gap: 6px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius-xs); border: none;
  cursor: pointer; font-weight: 600; font-size: 13px;
  font-family: inherit;
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--pitch); color: #fff; }
.btn-primary:hover { background: var(--pitch-dark); }
.btn-ghost {
  background: var(--surface); color: var(--text-secondary);
  border: 1px solid var(--border); box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--pitch); color: var(--pitch); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d97706; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-header {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2);
  padding: 6px 14px; border-radius: var(--radius-xs); font-size: 12px;
  cursor: pointer; font-weight: 600; font-family: inherit;
  transition: all .2s;
}
.btn-header:hover { background: rgba(255,255,255,.22); }

/* ── Layout ── */
.container { max-width: 920px; margin: 0 auto; padding: 20px 16px; position: relative; }

@media (min-width: 1000px) {
  .container::before, .container::after {
    content: ''; position: fixed; top: 56px; bottom: 0; width: 50%;
    pointer-events: none; z-index: 0;
  }
  .container::before {
    left: 0;
    background: linear-gradient(90deg, var(--pitch) 0%, transparent 100%);
    opacity: .05;
  }
  .container::after {
    right: 0;
    background: linear-gradient(270deg, var(--pitch) 0%, transparent 100%);
    opacity: .05;
  }
}
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow); }
.card-accent { border-left: 4px solid var(--pitch); }

/* ── Forms ── */
.input, select.input {
  font-family: inherit; font-size: 14px; padding: 10px 14px;
  border-radius: var(--radius-xs); border: 1px solid var(--border);
  background: var(--surface); width: 100%; outline: none;
  transition: border-color .2s, box-shadow .2s;
  color: var(--text);
}
.input:focus { border-color: var(--pitch); box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
.input-score {
  width: 64px; text-align: center; font-size: 24px;
  font-weight: 800; padding: 8px 4px; border-radius: var(--radius-sm);
}
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: flex-end; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
}

/* ── Tabs ── */
.tabs {
  display: flex; gap: 2px; margin-bottom: 20px;
  background: var(--border); border-radius: var(--radius-sm);
  padding: 3px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 9px 16px; border: none; cursor: pointer; font-weight: 600; font-size: 13px;
  background: transparent; color: var(--muted);
  border-radius: var(--radius-xs); white-space: nowrap;
  font-family: inherit; transition: all .2s;
}
.tab.active {
  background: var(--surface); color: var(--pitch);
  box-shadow: var(--shadow-sm);
}
.tab:hover:not(.active) { color: var(--text-secondary); }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.badge-pitch { background: var(--pitch-light); color: var(--pitch-deep); }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-win { background: var(--win); color: var(--win-text); }
.badge-draw { background: var(--draw); color: var(--draw-text); }
.badge-loss { background: var(--loss-bg); color: var(--danger); }

/* ── Data Table ── */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th {
  padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700;
  color: #fff; text-transform: uppercase; letter-spacing: .6px;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table th.center, .data-table td.center { text-align: center; }
.data-table tr.highlight { background: var(--win); }
.data-table tr.highlight:hover { background: var(--win); }

/* ── Match card ── */
.match-card {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
  transition: all .2s ease; box-shadow: var(--shadow-sm);
}
.match-card:hover {
  border-color: var(--pitch); box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.match-teams {
  flex: 1; display: flex; align-items: center;
  justify-content: center; gap: 8px; text-align: center;
}
.match-team { font-weight: 700; flex: 1; font-size: 14px; }
.match-team:first-child { text-align: right; }
.match-team:last-child { text-align: left; }
.match-score {
  font-weight: 900; font-size: 22px; min-width: 60px;
  text-align: center; color: var(--text);
  background: var(--pitch-light); border-radius: var(--radius-xs);
  padding: 4px 8px;
}
.match-vs {
  color: var(--muted); min-width: 50px; text-align: center;
  font-weight: 500; font-size: 12px; text-transform: uppercase;
}
.date-header {
  font-size: 12px; font-weight: 700; color: var(--pitch);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 0 6px; border-bottom: 2px solid var(--pitch-light);
  margin-bottom: 8px; margin-top: 16px;
}

/* ── Leaderboard ── */
.lb-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: background .15s; cursor: pointer;
  border-radius: var(--radius-xs);
}
.lb-row:hover { background: var(--surface-hover); }
.lb-row.top { background: var(--accent-light); border-radius: var(--radius-sm); border: 1px solid var(--accent); margin-bottom: 4px; }
.lb-pos { width: 30px; font-weight: 900; color: var(--muted); font-size: 14px; }
.lb-pos.gold { color: var(--accent); font-size: 20px; }
.lb-info { flex: 1; }
.lb-name { font-weight: 700; font-size: 14px; }
.lb-team { font-size: 12px; color: var(--muted); margin-top: 1px; }
.lb-count {
  font-weight: 900; padding: 6px 14px; border-radius: 20px;
  background: var(--pitch-light); color: var(--pitch-deep);
  font-size: 15px;
}
.lb-count.gold { background: var(--accent); color: #fff; }

/* ── Cross table ── */
.cross-table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.cross-table th, .cross-table td {
  padding: 8px 10px; border: 1px solid var(--border);
  text-align: center; min-width: 55px;
}
.cross-table th {
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: #fff; font-size: 11px; white-space: nowrap; font-weight: 700;
}
.cross-table td.team-name {
  text-align: left; font-weight: 700; white-space: nowrap;
  background: var(--surface); position: sticky; left: 0;
}
.cross-table td.self { background: var(--bg); color: var(--muted); }
.cross-table td.cell-win { background: var(--win); color: var(--win-text); font-weight: 700; }
.cross-table td.cell-draw { background: var(--draw); color: var(--draw-text); font-weight: 700; }
.cross-table td.cell-loss { background: var(--loss-bg); color: var(--danger); font-weight: 700; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp .25s ease;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-close {
  background: var(--bg); border: none; font-size: 18px; cursor: pointer;
  color: var(--muted); width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Score block ── */
.score-block {
  background: linear-gradient(135deg, var(--pitch-light), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-bottom: 20px;
}
.score-team { text-align: center; }
.score-team-name { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.score-sep { font-size: 28px; font-weight: 300; color: var(--muted); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 28px;
  border-radius: 50px; font-size: 13px; font-weight: 600;
  z-index: 2000; box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}

/* ── Grid ── */
.group-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

/* ── Login ── */
.login-box { max-width: 380px; margin: 60px auto; }

/* ── Empty ── */
.empty {
  color: var(--muted); font-size: 14px; text-align: center;
  padding: 48px 20px; background: var(--surface);
  border-radius: var(--radius); border: 2px dashed var(--border);
}

/* ── Team logos ── */
.team-logo { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
.team-logo-lg { width: 72px; height: 72px; border-radius: 12px; object-fit: contain; }
.team-logo-placeholder {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--pitch-light); display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 14px; vertical-align: middle; margin-right: 8px;
}

/* ── Helpers ── */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-12 { margin-top: 12px; }
.hidden { display: none !important; }
.overflow-x { overflow-x: auto; }
.w-full { width: 100%; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .header { padding: 0 12px; height: 50px; }
  .header-logo span { font-size: 15px; }
  .container { padding: 12px 10px; }
  .card { padding: 14px; border-radius: var(--radius-sm); }
  .tab { padding: 7px 11px; font-size: 12px; }
  .match-team { font-size: 13px; }
  .match-score { font-size: 18px; min-width: 50px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 7px 8px; }
  .group-grid { grid-template-columns: 1fr; }
  .btn { padding: 7px 14px; }
  .lb-row { padding: 10px 12px; }
}

/* ── Form dots ── */
.form-dots { display: inline-flex; gap: 3px; align-items: center; }
.form-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.form-dot.W { background: #10b981; }
.form-dot.D { background: #f59e0b; }
.form-dot.L { background: #ef4444; }
[data-theme="dark"] .form-dot.W { background: #34d399; }
[data-theme="dark"] .form-dot.D { background: #fbbf24; }
[data-theme="dark"] .form-dot.L { background: #f87171; }

/* ── Match card v2 ── */
.match-card-v2 {
  display: flex; align-items: center; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
  transition: all .2s ease; box-shadow: var(--shadow-sm);
}
.match-card-v2:hover { border-color: var(--pitch); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.match-center { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 80px; }
.match-round-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.match-score-row { display: flex; align-items: center; gap: 10px; }
.match-team-v2 { font-weight: 700; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-team-v2.left { text-align: right; }
.match-team-v2.right { text-align: left; }
.match-score-v2 { font-weight: 900; font-size: 22px; background: var(--pitch-light); padding: 4px 12px; border-radius: var(--radius-xs); color: var(--text); min-width: 65px; text-align: center; }
.match-vs-v2 { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; min-width: 65px; text-align: center; }
.match-gk-label { font-size: 11px; color: var(--accent); font-weight: 600; }

/* ── Dashboard ── */
.dash-section { margin-bottom: 24px; }
.dash-title { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.dash-match { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; transition: all .15s; text-decoration: none; color: var(--text); }
.dash-match:hover { border-color: var(--pitch); box-shadow: var(--shadow); }
.dash-logo { width: 22px; height: 22px; border-radius: 4px; object-fit: contain; }
.dash-score { font-weight: 900; font-size: 16px; min-width: 45px; text-align: center; }
.dash-team { font-weight: 600; font-size: 13px; flex: 1; }
.dash-team.right { text-align: right; }
.dash-group-tag { font-size: 10px; color: var(--muted); font-weight: 600; }
.dash-top-scorer { display: flex; align-items: center; gap: 16px; padding: 16px; background: linear-gradient(135deg, var(--accent-light), var(--surface)); border: 1px solid var(--accent); border-radius: var(--radius); }
