/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --border: #30363d;
  --accent: #f97316;
  --accent-dim: rgba(249,115,22,.15);
  --accent-hover: #ea6c10;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --green: #3fb950;
  --blue: #58a6ff;
  --red: #f85149;
  --yellow: #d29922;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-title { font-weight: 800; font-size: .95rem; color: var(--text); }
.logo-sub { font-size: .7rem; color: var(--text-muted); }

.sidebar-section { padding: 12px 8px 4px; }
.sidebar-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding: 4px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item svg { flex-shrink: 0; opacity: .8; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.nav-logout { color: var(--text-dim); margin-top: 4px; }
.nav-logout:hover { color: var(--red); background: rgba(248,81,73,.1); }

.btn-refresh {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(249,115,22,.3);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 6px;
}
.btn-refresh:hover { background: rgba(249,115,22,.25); }
.btn-refresh:disabled { opacity: .6; cursor: not-allowed; }

/* ── Topbar (mobile) ──────────────────────────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 90;
}
.menu-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}
.topbar-title { font-weight: 700; font-size: .9rem; }

/* ── Barra superiore (uguale su tutte le pagine, stile home) ──────────────── */
.sitebar {
  position: fixed; top: 0; left: 0; right: 0; height: 58px; z-index: 100;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(9,11,14,.82); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.sitebar-brand {
  display: flex; align-items: center; gap: 9px; color: var(--text);
  font-weight: 800; font-size: 1rem; letter-spacing: -.01em;
  padding: 6px 10px 6px 6px; border-radius: 9px; transition: background .15s;
}
.sitebar-brand:hover { background: var(--bg3); }
.sitebar-nav {
  display: flex; align-items: center; gap: 3px; padding: 5px; margin: 0 auto;
  border-radius: 100px; background: var(--bg2); border: 1px solid var(--border);
  box-shadow: 0 10px 34px -14px rgba(0,0,0,.7);
}
.sb-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .84rem; font-weight: 600; color: var(--text-muted);
  padding: 8px 15px; border-radius: 100px; white-space: nowrap;
  transition: color .15s, background .15s;
}
.sb-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sb-btn .fl { font-size: 1rem; line-height: 1; }
.sb-btn:hover { color: var(--text); background: var(--bg3); }
.sb-btn.active { color: var(--accent); background: var(--accent-dim); }
.sb-btn.out { color: var(--text-dim); }
.sb-btn.out:hover { color: var(--red); background: rgba(248,81,73,.1); }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  margin: 0 auto;
  padding: 84px 32px 48px;
  max-width: 1160px;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: 2px; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 2rem; font-weight: 800; margin-top: 4px; }
.stat-value.orange { color: var(--accent); }
.stat-value.blue   { color: var(--blue); }
.stat-value.green  { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title a { font-size: .8rem; font-weight: 500; }

/* ── News list ────────────────────────────────────────────────────────────── */
.news-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-title { font-size: .9rem; font-weight: 600; color: var(--text); }
.news-title:hover { color: var(--accent); }
.news-meta { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }
.news-source {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: .68rem;
  font-weight: 600;
  margin-right: 4px;
}
.news-tag {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: .68rem;
  font-weight: 600;
  margin-right: 2px;
}

/* ── Team / Player grid ───────────────────────────────────────────────────── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.entity-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .15s, transform .15s;
  cursor: pointer;
}
.entity-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.entity-card a { color: inherit; text-decoration: none; }
.entity-name { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.entity-meta { font-size: .78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  background: var(--bg3);
  border: 1px solid var(--border);
}
.badge-cat { background: var(--accent-dim); color: var(--accent); border-color: rgba(249,115,22,.3); }
.badge-pos { background: rgba(88,166,255,.12); color: var(--blue); border-color: rgba(88,166,255,.3); }
.badge-status-active { background: rgba(63,185,80,.12); color: var(--green); border-color: rgba(63,185,80,.3); }
.badge-status-injured { background: rgba(248,81,73,.12); color: var(--red); border-color: rgba(248,81,73,.3); }

/* ── Player detail ────────────────────────────────────────────────────────── */
.profile-header {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: var(--accent);
  flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-name { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.profile-detail { color: var(--text-muted); font-size: .875rem; margin-top: 4px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.profile-socials { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.social-link {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .78rem; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg3);
  transition: border-color .15s, color .15s;
}
.social-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }

/* ── Filters ──────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filter-input, .filter-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 12px;
  font-size: .85rem;
  font-family: inherit;
  transition: border-color .15s;
}
.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--accent);
}
.filter-input { min-width: 200px; }
.filter-select option { background: var(--bg3); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600;
  cursor: pointer; border: none; font-family: inherit;
  transition: background .15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-ghost {
  background: var(--bg2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
}
.form-row { margin-bottom: 18px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: .875rem;
  font-family: inherit;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-textarea { min-height: 90px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-wrapper {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; width: 100%;
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 360px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; font-size: 2.5rem; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: .8rem; margin-bottom: 28px; }
.login-error {
  background: rgba(248,81,73,.1);
  border: 1px solid rgba(248,81,73,.3);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 16px;
}

/* ── Section headers ──────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 1rem; font-weight: 700; }

/* ── Two-column layout ────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: border-color .15s, color .15s;
}
.page-btn:hover, .page-btn.active { border-color: var(--accent); color: var(--accent); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  z-index: 999; box-shadow: var(--shadow);
  animation: slideIn .25s ease;
}
.toast.hidden { display: none; }
.toast-ok { background: rgba(63,185,80,.15); border: 1px solid rgba(63,185,80,.4); color: var(--green); }
.toast-error { background: rgba(248,81,73,.15); border: 1px solid rgba(248,81,73,.4); color: var(--red); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }

/* ── Social embed ─────────────────────────────────────────────────────────── */
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.social-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; overflow: hidden;
}
.social-card iframe { max-width: 100% !important; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: .9rem; }
.empty-icon { font-size: 2.5rem; margin-bottom: 10px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 78px 14px 28px; }
  .sitebar { padding: 0 12px; gap: 10px; overflow-x: auto; }
  .sitebar-nav { margin: 0 0 0 auto; }
  .sb-btn { padding: 8px 12px; }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
