:root {
  --bg: #0c0c0e;
  --panel: #151518;
  --panel-2: #1c1c20;
  --border: #2a2a30;
  --text: #e8e8ec;
  --muted: #8d8d97;
  --red: #e0353b;
  --red-hover: #f0474d;
  --red-soft: rgba(224, 53, 59, 0.12);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.12);
  --radius: 10px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* --- Yerleşim --- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-mark {
  width: 12px; height: 12px;
  border-radius: 3px;
  background: var(--red);
  box-shadow: 0 0 14px rgba(224, 53, 59, 0.6);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active {
  background: var(--red-soft);
  color: var(--text);
  border-left-color: var(--red);
}
.nav-link.active .icon { color: var(--red); }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; }

.me { display: flex; align-items: center; gap: 10px; padding: 4px 10px 12px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 600;
  color: var(--red);
}
.me-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }

.logout:hover { color: var(--red); background: var(--red-soft); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 48px;
  max-width: 1200px;
  min-width: 0;
}

.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }

/* --- Bileşenler --- */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 16px; font-weight: 600; margin-top: 10px; }
.stat.accent { border-top: 2px solid var(--red); }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  border: 1px solid;
}
.alert-success { background: var(--green-soft); border-color: rgba(62, 207, 142, 0.35); color: var(--green); }
.alert-error { background: var(--red-soft); border-color: rgba(224, 53, 59, 0.4); color: #ff8a8e; }

/* Formlar */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-grid .field { margin-bottom: 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }

input[type=text], input[type=password], select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
textarea { min-height: 90px; resize: vertical; }

.actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-ghost { background: var(--panel-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #3a3a42; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: transparent; border-color: rgba(224, 53, 59, 0.4); color: #ff8a8e; }
.btn-danger:hover { background: var(--red-soft); }

/* Tablo */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
td.row-actions { text-align: right; }
td.row-actions form { display: inline; }
.muted { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge-superadmin { background: var(--red-soft); border-color: rgba(224, 53, 59, 0.4); color: #ff8a8e; }
.badge-admin { color: var(--text); }

.empty { padding: 28px 8px; text-align: center; }

/* --- Canlı durum --- */

.pulse {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 6px;
  vertical-align: middle;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 53, 59, 0.6); opacity: 1; }
  50% { box-shadow: 0 0 0 5px rgba(224, 53, 59, 0); opacity: .7; }
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.status-in { color: #ff8a8e; border-color: rgba(224, 53, 59, 0.45); background: var(--red-soft); }
.status-post { color: var(--text); }

.logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; display: inline-block; }

/* --- Ana sayfa maç kartları --- */

.matches-section { margin-bottom: 28px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.live-note { font-size: 12px; font-weight: 500; color: var(--muted); }

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.match-grid > .empty {
  grid-column: 1 / -1;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.match-card {
  position: relative;
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s, transform .15s;
}
.match-card:hover { border-color: #3a3a42; transform: translateY(-1px); }
.match-card.is-live { border-top: 2px solid var(--red); }
.mc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-right: 22px; }
.mc-league { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .8px; }
.mc-team { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.mc-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-score { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mc-remove {
  position: absolute;
  top: 10px; right: 10px;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.mc-remove:hover { background: var(--red-soft); color: var(--red); }

/* --- Pencere (modal) --- */

.modal {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  border-radius: 12px;
}
.modal::backdrop { background: rgba(0, 0, 0, 0.7); }
.modal[open] { display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 4px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 20px 0; }
.modal-filters .field { margin-bottom: 12px; }
.modal .alert { margin: 0 20px 16px; }
input[type=date] { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; padding: 9px 12px; color-scheme: dark; }

.pick-list { overflow-y: auto; padding: 0 20px; flex: 1; min-height: 120px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pick { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.pick:last-child { border-bottom: 0; }
.pick-teams { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pick-teams > div { display: flex; align-items: center; gap: 8px; }
.pick-teams .logo { width: 20px; height: 20px; }
.pick-teams span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-teams b { font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

.link-form { padding: 14px 20px 18px; }
.link-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; }

/* --- Maç detayı --- */

.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 14px; }
.back-link:hover { color: var(--text); }

.scoreboard { padding: 22px 24px; border-top: 2px solid var(--red); }
.sb-league { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .8px; margin-bottom: 8px; }
.sb-main { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.sb-team { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.sb-team .logo { width: 56px; height: 56px; }
.sb-name { font-weight: 600; }
.sb-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sb-score { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; white-space: nowrap; }
.sb-score span { color: var(--muted); margin: 0 10px; font-weight: 400; }

.lines { width: auto; margin: 18px auto 0; font-variant-numeric: tabular-nums; }
.lines th, .lines td { padding: 6px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.lines td:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.lines tbody tr:hover { background: none; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--red); }

/* Olay akışı (zaman çizelgesi) */
.tl-legend, .st-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .6px;
  text-transform: uppercase;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.timeline { position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}
.tl-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(42, 42, 48, 0.5);
}
.tl-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tl-side.left { justify-content: flex-end; text-align: right; }
.tl-body { display: flex; flex-direction: column; min-width: 0; }
.tl-body strong { font-size: 12.5px; font-weight: 600; letter-spacing: .3px; }
.tl-body small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.tl-clock { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 34px; }
.tl-side.left .tl-clock { text-align: right; }
.tl-dot {
  justify-self: center;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: var(--panel);
  z-index: 1;
}
.tl-score .tl-dot { border-color: var(--red); background: var(--red); }
.tl-foul .tl-dot { border-color: #e6a23c; }
.tl-miss .tl-body strong { color: var(--muted); }
.tl-badge {
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tl-badge.home { background: var(--red); color: #fff; }
.tl-badge.away { background: var(--text); color: var(--bg); }
.tl-divider { position: relative; text-align: center; padding: 14px 0; }
.tl-divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
}
.tl-row.is-new { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: rgba(224, 53, 59, 0.22); } to { background: transparent; } }

/* Takım istatistikleri */
.st-row { padding: 10px 0; border-bottom: 1px solid rgba(42, 42, 48, 0.5); }
.st-row:last-child { border-bottom: 0; }
.st-values { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.st-values span { color: var(--muted); font-size: 13px; }
.st-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.st-bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; display: flex; }
.st-bar.home { justify-content: flex-end; }
.st-bar i { display: block; height: 100%; border-radius: 3px; }
.st-bar.home i { background: var(--red); }
.st-bar.away i { background: var(--text); }

/* Oyuncu tabloları */
.pl-team { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 4px 0 10px; }
.pl-team .logo { width: 24px; height: 24px; }
.pl-table + * { margin-top: 0; }
.table-wrap + .pl-team { margin-top: 24px; }
.pl-table th, .pl-table td { padding: 8px 10px; text-align: center; font-variant-numeric: tabular-nums; }
.pl-table th:first-child, .pl-table td:first-child { text-align: left; }
.pl-table tr.dnp td:first-child { color: var(--muted); }
.starter { font-size: 10px; font-weight: 700; color: var(--red); margin-left: 4px; }

/* --- Giriş sayfası --- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(224, 53, 59, 0.10), transparent 70%),
    var(--bg);
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  border-radius: 12px;
  padding: 32px 28px;
}
.login-box .brand { border: 0; padding: 0 0 6px; margin: 0; justify-content: center; }
.login-box p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.login-box .btn { width: 100%; margin-top: 6px; }

/* --- Mobil --- */

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
  }
  .brand { padding-bottom: 12px; margin-bottom: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-link { width: auto; padding: 8px 10px; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; }
  .me { padding: 0; }
  .main { margin-left: 0; padding: 24px 16px 40px; }
  .sb-team .logo { width: 40px; height: 40px; }
  .sb-name { font-size: 13px; }
  .sb-score { font-size: 28px; }
  .sb-score span { margin: 0 6px; }
  .scoreboard { padding: 18px 14px; }
  .tl-row { grid-template-columns: 1fr 16px 1fr; }
  .tl-side { gap: 6px; }
  .tl-clock { min-width: 28px; }
  .modal-filters { grid-template-columns: 1fr; gap: 0; }
}
