/* TouchlineAlpha — shared stylesheet for managers.html and clubs.html */

/* ── CSS custom properties ── */
/* Manager page overrides --brand to green; clubs page overrides to blue.
   Both pages inline a tiny :root block that sets the brand colour. */
:root {
  --brand: #00B37D;
  --brand-dark: #008F63;
  --brand-light: rgba(0,179,125,0.08);
  --slate-900: #0F172A;
  --slate-700: #334155;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-600: #475569;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50: #FAFAFA;
  --white: #FFFFFF;
  --up: #16A34A;
  --up-bg: rgba(22,163,74,0.09);
  --down: #DC2626;
  --down-bg: rgba(220,38,38,0.07);
  --amber: #D97706;
  --amber-bg: rgba(217,119,6,0.09);
  --gold: #F59E0B;
  --silver: #94A3B8;
  --bronze: #CD7C3A;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-nav: 0 1px 0 var(--slate-200);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--slate-50);
  color: var(--slate-900);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Navigation ── */
.dg-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  box-shadow: var(--shadow-nav);
  height: 52px;
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 32px;
}
.dg-logo {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  flex-shrink: 0;
}
.dg-logo-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--white); letter-spacing: -0.5px;
}
.dg-logo-word {
  font-size: 15px; font-weight: 700; color: var(--slate-900); letter-spacing: 0.5px;
}
.dg-nav-links {
  display: flex; gap: 4px; flex: 1;
}
.dg-nav-link {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--slate-500);
  text-decoration: none; cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border: none; background: none;
}
.dg-nav-link:hover { color: var(--slate-900); background: var(--slate-100); }
.dg-nav-link.active {
  color: var(--brand-dark); font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand);
  border-radius: var(--radius-sm);
}
.dg-nav-right {
  margin-left: auto;
  font-size: 12px; color: var(--slate-500); font-weight: 500;
  padding: 4px 10px; background: var(--slate-100); border-radius: var(--radius-sm);
}

/* ── Main layout ── */
.dg-main {
  max-width: 1480px; margin: 0 auto; padding: 28px 28px 48px;
}

/* ── Hero ── */
.dg-hero {
  margin-bottom: 24px;
  scroll-margin-top: 64px;
}
.dg-hero h1 {
  font-size: 22px; font-weight: 700; color: var(--slate-900); margin-bottom: 4px;
}
.dg-hero p {
  font-size: 13px; color: var(--slate-500); margin-bottom: 20px;
}
.dg-kpi-strip {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.dg-kpi {
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px 20px; min-width: 130px;
  border-top: 3px solid var(--brand);
}
.dg-kpi-value {
  font-size: 24px; font-weight: 700; color: var(--slate-900); line-height: 1.1;
}
.dg-kpi-label {
  font-size: 11px; font-weight: 600; color: var(--slate-500);
  text-transform: uppercase; letter-spacing: 0.6px; margin-top: 2px;
}

/* ── Guide panel ── */
.dg-guide {
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px 20px; margin-bottom: 16px;
  border-left: 3px solid var(--brand);
}
.dg-guide-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.dg-guide-title {
  font-size: 13px; font-weight: 600; color: var(--slate-700);
}
.dg-guide-toggle {
  font-size: 12px; color: var(--slate-500); background: none; border: none;
  cursor: pointer; padding: 2px 8px; border-radius: var(--radius-sm);
  font-family: inherit; transition: background 0.15s;
}
.dg-guide-toggle:hover { background: var(--slate-100); color: var(--slate-700); }
.dg-guide-body {
  font-size: 13px; color: var(--slate-700); line-height: 1.6;
}
.dg-guide-body p { margin-bottom: 8px; }
.dg-guide-body p:last-child { margin-bottom: 0; }
.dg-guide-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px; margin: 10px 0;
}
.dg-guide-item {
  background: var(--slate-50); border-radius: var(--radius-sm);
  padding: 8px 12px; border: 1px solid var(--slate-200);
}
.dg-guide-item strong { color: var(--slate-900); display: block; font-size: 12px; margin-bottom: 2px; }
.dg-guide-item span { font-size: 12px; color: var(--slate-500); line-height: 1.5; }
.dg-guide-tip { font-size: 12px; color: var(--slate-500); font-style: italic; }

/* ── Empty state ── */
.dg-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 200px; padding: 32px; text-align: center; gap: 8px;
}
.dg-empty-icon { font-size: 30px; opacity: 0.3; line-height: 1; }
.dg-empty-text { font-size: 13px; font-weight: 500; color: var(--slate-500); }
.dg-empty-sub { font-size: 12px; color: var(--slate-400); }

/* ── Filter bar ── */
.dg-filters {
  display: flex; gap: 6px; flex-wrap: nowrap; align-items: center;
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 10px 14px; margin-bottom: 16px;
  overflow-x: auto;
}
.dg-filters select,
.dg-filters input[type="text"],
.dg-filters input[type="number"] {
  height: 30px; padding: 0 10px;
  border: 1px solid var(--slate-200); border-radius: 20px;
  font-size: 12px; font-family: inherit; color: var(--slate-900);
  background: var(--slate-50);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none; -webkit-appearance: none;
}
.dg-filters select { padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748B'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; min-width: 120px; }
.dg-filters select:focus,
.dg-filters input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,179,125,0.12);
}
.dg-filter-sep { width: 1px; height: 24px; background: var(--slate-200); margin: 0 4px; }
/* Toggle switch */
.dg-toggle-wrap {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  user-select: none;
}
.dg-toggle-wrap span {
  font-size: 12px; color: var(--slate-700); font-weight: 500;
}
.dg-toggle {
  position: relative; width: 34px; height: 18px;
}
.dg-toggle input { opacity: 0; width: 0; height: 0; }
.dg-toggle-track {
  position: absolute; inset: 0; background: var(--slate-300);
  border-radius: 9px; transition: background 0.2s;
}
.dg-toggle-track::after {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 2px; top: 2px;
  background: var(--white); border-radius: 50%;
  transition: transform 0.2s;
}
.dg-toggle input:checked + .dg-toggle-track { background: var(--brand); }
.dg-toggle input:checked + .dg-toggle-track::after { transform: translateX(16px); }
.dg-btn-ghost {
  height: 34px; padding: 0 14px;
  border: 1px solid var(--slate-200); border-radius: 20px;
  background: var(--white); cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--slate-700);
  transition: background 0.15s, border-color 0.15s;
}
.dg-btn-ghost:hover { background: var(--slate-100); border-color: var(--slate-300); }
.dg-btn-primary {
  height: 34px; padding: 0 16px;
  border: none; border-radius: 20px;
  background: var(--brand); cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--white); font-weight: 600;
  transition: background 0.15s;
}
.dg-btn-primary:hover { background: var(--brand-dark); }

/* ── Table card ── */
.dg-table-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}

/* DataTables overrides */
div.dataTables_wrapper {
  padding: 0;
}
div.dataTables_wrapper .dataTables_length,
div.dataTables_wrapper .dataTables_info {
  font-size: 12px; color: var(--slate-500); padding: 12px 16px;
}
div.dataTables_wrapper .dataTables_filter { display: none; }
div.dataTables_wrapper .dataTables_paginate {
  padding: 10px 16px;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button {
  font-size: 12px; padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200) !important;
  background: var(--white) !important; color: var(--slate-700) !important;
  margin: 0 2px;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--brand) !important; color: var(--white) !important;
  border-color: var(--brand) !important;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--white) !important; color: var(--slate-900) !important;
  border-color: var(--slate-300) !important;
}
.dt-buttons {
  padding: 10px 16px; border-bottom: 1px solid var(--slate-100);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.dt-buttons .dt-button {
  font-size: 12px; padding: 4px 10px; font-family: inherit;
  border: 1px solid var(--slate-200) !important; border-radius: var(--radius-sm);
  background: var(--white) !important; color: var(--slate-700) !important;
  box-shadow: none !important;
}
.dt-buttons .dt-button:hover { background: var(--slate-50) !important; }
.dg-toolbar-sep { width: 1px; height: 18px; background: var(--slate-200); margin: 0 4px; flex-shrink: 0; }
.dg-col-toggle-label {
  font-size: 11px; font-weight: 600; color: var(--slate-500);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.dg-col-btn {
  padding: 3px 10px; border-radius: 12px; font-size: 12px; font-family: inherit;
  border: 1px solid var(--slate-200); background: var(--white);
  cursor: pointer; color: var(--slate-700); transition: all 0.15s;
}
.dg-col-btn.active {
  background: var(--brand); border-color: var(--brand); color: var(--white);
}
table.dataTable {
  font-size: 13px; width: 100% !important;
  border-collapse: collapse;
}
table.dataTable thead th {
  background: var(--slate-900); color: var(--white);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 10px 10px;
  white-space: nowrap; border-bottom: none;
}
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
  opacity: 0.6;
}
table.dataTable tbody td {
  padding: 8px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-900);
}
table.dataTable tbody tr:last-child td { border-bottom: none; }

/* Rank medals */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 10px; font-weight: 700; margin-right: 6px;
  flex-shrink: 0; vertical-align: middle;
}
.rank-gold { background: var(--gold); color: var(--white); }
.rank-silver { background: var(--silver); color: var(--white); }
.rank-bronze { background: var(--bronze); color: var(--white); }
.rank-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  font-size: 11px; color: var(--slate-500); margin-right: 6px;
  vertical-align: middle;
}
.mgr-name {
  font-weight: 500; cursor: pointer; color: var(--slate-900);
  transition: color 0.12s;
}
.mgr-name:hover { color: var(--brand-dark); text-decoration: underline; }
.club-name {
  font-weight: 500; cursor: pointer; color: var(--slate-900);
  transition: color 0.12s;
}
.club-name:hover { color: var(--brand-dark); text-decoration: underline; }

/* ELO colour coding */
.elo-bg-high { background: rgba(46,125,50,0.12) !important; }
.elo-bg-low  { background: rgba(198,40,40,0.10) !important; }

/* League badges */
.league-badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Component bars */
.comp-cell {
  display: flex; align-items: center; gap: 6px; min-width: 90px;
}
.comp-bar-track {
  position: relative; width: 50px; height: 6px;
  background: var(--slate-200); border-radius: 3px; overflow: hidden;
  flex-shrink: 0;
}
.comp-bar-fill {
  position: absolute; top: 0; height: 100%; border-radius: 3px;
}
.comp-val {
  font-size: 12px; font-variant-numeric: tabular-nums; min-width: 36px;
}

/* Expand toggle */
td.dt-control {
  cursor: pointer; position: relative; padding-left: 24px !important; width: 18px;
}
td.dt-control::before {
  content: '\25B6'; position: absolute; left: 7px; top: 50%;
  transform: translateY(-50%); font-size: 9px; color: var(--slate-500);
  transition: transform 0.15s;
}
tr.shown td.dt-control::before {
  content: '\25B6'; transform: translateY(-50%) rotate(90deg);
}

/* Child row */
.stint-detail { padding: 12px 16px 16px 32px; background: var(--slate-50); overflow-x: auto; }
.stint-detail-inner { overflow-x: auto; }
.stint-detail table {
  border-collapse: collapse; font-size: 12px;
  width: auto; min-width: 640px;
}
.stint-detail th {
  background: var(--slate-700); color: var(--white);
  padding: 6px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap;
}
.stint-detail td {
  padding: 5px 12px; border-bottom: 1px solid var(--slate-200); white-space: nowrap;
}
.stint-detail tr:last-child td { border-bottom: none; }
.stint-detail tr:nth-child(even) td { background: rgba(241,245,249,0.5); }
.mgr-scroll {
  max-width: 220px; overflow-x: auto; white-space: nowrap;
  scrollbar-width: none; -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
  mask-image: linear-gradient(to right, black 80%, transparent 100%);
}
.mgr-scroll::-webkit-scrollbar { display: none; }
.season-badge {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 11px; font-weight: 600; background: var(--slate-200); color: var(--slate-700);
}
.elo-change-pos { color: var(--up); font-weight: 600; }
.elo-change-neg { color: var(--down); font-weight: 600; }

/* ── Timeline section ── */
.dg-chart-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 24px; margin-top: 20px;
  scroll-margin-top: 64px;
}
.dg-section-title {
  font-size: 16px; font-weight: 700; color: var(--slate-900); margin-bottom: 4px;
}
.dg-section-sub {
  font-size: 12px; color: var(--slate-500); margin-bottom: 16px;
}
.dg-chart-controls {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;
}
.dg-chart-search-wrap { position: relative; }
.dg-chart-controls input[type="text"] {
  height: 34px; padding: 0 12px;
  border: 1px solid var(--slate-200); border-radius: 20px;
  font-size: 13px; font-family: inherit; color: var(--slate-900);
  background: var(--slate-50); outline: none; min-width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dg-chart-controls input[type="text"]:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,179,125,0.12);
}
.dg-chart-controls input[type="date"] {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--slate-200); border-radius: 20px;
  font-size: 13px; font-family: inherit; color: var(--slate-900);
  background: var(--slate-50); outline: none;
  transition: border-color 0.15s;
}
.dg-chart-controls input[type="date"]:focus {
  border-color: var(--brand);
}
.dg-chart-sep { width: 1px; height: 22px; background: var(--slate-200); margin: 0 4px; }
.autocomplete-list {
  position: absolute; z-index: 1000; background: var(--white);
  border: 1px solid var(--slate-200); border-top: none;
  max-height: 200px; overflow-y: auto; width: 230px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  top: 100%;
}
.autocomplete-list div {
  padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--slate-900);
}
.autocomplete-list div:hover { background: var(--brand-light); }
.dg-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.manager-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500; color: var(--white);
  cursor: pointer; transition: opacity 0.15s;
}
.manager-chip .remove {
  cursor: pointer; opacity: 0.8; font-weight: 700; font-size: 13px; line-height: 1;
}
.manager-chip .remove:hover { opacity: 1; }
.club-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500; color: var(--white);
  cursor: pointer; transition: opacity 0.15s;
}
.club-chip .remove {
  cursor: pointer; opacity: 0.8; font-weight: 700; font-size: 13px; line-height: 1;
}
.club-chip .remove:hover { opacity: 1; }

/* ── Club Manager History summary table ── */
.club-summary { margin-top: 8px; }
.club-summary-title { font-size: 13px; font-weight: 600; color: var(--slate-700); margin-bottom: 8px; }
.club-summary-inner { overflow-x: auto; }
.club-summary table { border-collapse: collapse; font-size: 12px; width: auto; min-width: 500px; }
.club-summary th {
  background: var(--slate-700); color: var(--white);
  padding: 6px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap;
}
.club-summary td { padding: 5px 12px; border-bottom: 1px solid var(--slate-200); white-space: nowrap; }
.club-summary tr:last-child td { border-bottom: none; }
.club-summary tr:nth-child(even) td { background: rgba(241,245,249,0.5); }

/* ── Footer ── */
.dg-footer {
  text-align: center; margin-top: 40px;
  font-size: 12px; color: var(--slate-500);
  padding: 16px 28px;
}
.dg-footer strong { color: var(--slate-700); }

/* Remove DataTables alternating row stripes */
#managerTable tbody tr.odd,
#managerTable tbody tr.even { background-color: #ffffff; }
#clubTable tbody tr.odd,
#clubTable tbody tr.even { background-color: #ffffff; }

/* Column header info icon + tooltip */
.dg-col-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.5); color: rgba(255,255,255,0.6);
  font-size: 9px; font-weight: 600; font-style: normal; font-family: inherit;
  margin-left: 4px; cursor: help; vertical-align: middle; flex-shrink: 0; user-select: none;
  line-height: 1; position: relative; top: -1px;
}
.dg-col-tip:hover { border-color: rgba(255,255,255,0.9); color: rgba(255,255,255,0.9); }
.dg-info-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--slate-400); color: var(--slate-400);
  font-size: 9px; font-weight: 600; font-style: normal; font-family: inherit;
  margin-left: 2px; cursor: help; vertical-align: middle; flex-shrink: 0; user-select: none;
  line-height: 1; position: relative; top: -1px;
}
.dg-info-tip:hover { border-color: var(--slate-600); color: var(--slate-600); }
.dg-header-tipbox {
  position: absolute; background: var(--slate-900); color: #fff;
  font-size: 11px; line-height: 1.45; padding: 6px 10px; border-radius: 5px;
  max-width: 230px; z-index: 9999; display: none; pointer-events: none;
}

/* ── Loading overlay ── */
.dg-loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: var(--slate-500); font-size: 14px; gap: 10px;
}
.dg-loading::before {
  content: '';
  width: 20px; height: 20px;
  border: 2px solid var(--slate-200);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
