/* =============================================================
   CREDIT TO DU BOIS — LADDER PREDICTOR STYLESHEET
   Edit variables in :root to retheme.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* -----------------------------------------------------------
   COLOUR VARIABLES
   ----------------------------------------------------------- */
:root {
  --bg:            #FFFEE7;
  --surface:       #ffffff;
  --surface2:      #f5f4d8;
  --border:        #dddcb8;
  --border-dark:   #b8b6a0;

  --header-bg:     #205D86;
  --header-text:   #ffffff;

  --accent-blue:   #205D86;
  --accent-red:    #AD281C;
  --accent-light:  #e8f3fa;

  --text:          #000000;
  --muted:         #555544;

  --home:          #205D86;
  --away:          #AD281C;

  --sep-top6:      #205D86;
  --sep-top10:     #AD281C;

  --rank-1:        #AD281C;
  --rank-2:        #666666;
  --rank-3:        #b87333;
}

/* -----------------------------------------------------------
   RESET & BASE
   ----------------------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* -----------------------------------------------------------
   HEADER
   ----------------------------------------------------------- */
header {
  background: var(--header-bg);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.header-logo    { height: 44px; width: auto; display: block; flex-shrink: 0; }
.header-divider { width: 1px; height: 36px; background: rgba(255,255,255,0.3); flex-shrink: 0; }
.header-title   { font-size: 22px; font-weight: 800; color: var(--header-text); flex: 1; }

/* Header action buttons */
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.action-btn {
  background: rgba(255,255,255,0.15);
  color: var(--header-text);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 6px 13px;
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.action-btn:hover { background: rgba(255,255,255,0.28); }
.action-btn.danger { border-color: rgba(255,120,100,0.5); }
.action-btn.danger:hover { background: rgba(173,40,28,0.4); }

/* -----------------------------------------------------------
   ERROR BANNER
   ----------------------------------------------------------- */
.error-banner {
  display: none;
  background: #fff3cd;
  border-bottom: 2px solid var(--accent-red);
  color: #7a4400;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 20px;
  text-align: center;
  flex-shrink: 0;
}
.error-banner.visible { display: block; }

/* -----------------------------------------------------------
   MAIN LAYOUT
   ----------------------------------------------------------- */
.main { display: flex; flex: 1; overflow: hidden; }

/* -----------------------------------------------------------
   PANEL SHARED
   ----------------------------------------------------------- */
.panel-header {
  background: var(--surface2);
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border-dark);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header .dot {
  width: 7px; height: 7px;
  background: var(--accent-blue);
  border-radius: 50%;
  flex-shrink: 0;
}

/* -----------------------------------------------------------
   FIXTURES PANEL
   ----------------------------------------------------------- */
.fixtures-panel {
  width: 55%;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--border-dark);
  overflow: hidden;
}

.fixtures-scroll { flex: 1; overflow-y: auto; }
.fixtures-scroll::-webkit-scrollbar { width: 5px; }
.fixtures-scroll::-webkit-scrollbar-track { background: var(--bg); }
.fixtures-scroll::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }

.round-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface2);
  border-bottom: 1px solid var(--border-dark);
  border-top: 2px solid var(--border);
  padding: 8px 20px;
  font-size: 14px; font-weight: 800;
  color: var(--accent-blue);
  display: flex; align-items: center; gap: 10px;
}
.round-header::before {
  content: '';
  width: 4px; height: 16px;
  background: var(--accent-blue);
  border-radius: 2px;
  flex-shrink: 0;
}

.fixture-card {
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  background: var(--surface);
  transition: background 0.12s;
}
.fixture-card:hover { background: var(--accent-light); }

/* Locked fixture — actual result recorded */
.fixture-locked {
  background: var(--surface2);
}
.fixture-locked:hover { background: var(--surface2); }
.fixture-locked .slider-track {
  opacity: 0.45;
}
.fixture-locked input[type=range] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Lock badge shown in venue line */
.lock-badge {
  margin-left: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--accent-light);
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  padding: 1px 7px;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.fixture-venue {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.fixture-teams {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 9px;
}

.fixture-team {
  display: flex; align-items: center; gap: 7px;
  flex: 1;
}
.fixture-team.home { flex-direction: row-reverse; }

.fixture-team-logo { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }

.team-name { font-weight: 700; font-size: 15px; }
.home-name { color: var(--home); text-align: right; }
.away-name { color: var(--away); }

.fixture-mid {
  flex-shrink: 0;
  min-width: 110px;
  text-align: center;
}
.pred-label {
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
}

.slider-row {
  display: flex; align-items: center; gap: 10px;
}
.pct-label { font-weight: 700; font-size: 13px; min-width: 36px; }
.pct-label.home { color: var(--home); text-align: right; }
.pct-label.away { color: var(--away); text-align: left; }

.slider-wrap {
  flex: 1;
  position: relative;
  height: 22px;
  display: flex; align-items: center;
}

.slider-track {
  position: absolute;
  width: 100%; height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--home) 0%, #FFFEE7 50%, var(--away) 100%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.slider-track::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 14px;
  background: rgba(0,0,0,0.25);
  border-radius: 1px;
}

input[type=range] {
  position: relative; z-index: 2;
  width: 100%;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: #ffffff;
  border-radius: 50%;
  border: 2px solid #555;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.1s;
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]::-webkit-slider-runnable-track { background: transparent; }

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 1; gap: 14px; padding: 40px;
  text-align: center; color: var(--muted);
}
.empty-state .icon { font-size: 44px; opacity: 0.35; }
.empty-state h3 { font-size: 18px; font-weight: 800; color: var(--text); opacity: 0.45; }
.empty-state p  { font-size: 14px; max-width: 280px; line-height: 1.6; }
.empty-state code { font-family: monospace; background: var(--surface2); padding: 1px 5px; border-radius: 3px; }

/* -----------------------------------------------------------
   LADDER PANEL
   ----------------------------------------------------------- */
.ladder-panel {
  width: 45%;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.ladder-scroll { flex: 1; overflow-y: auto; }
.ladder-scroll::-webkit-scrollbar { width: 5px; }
.ladder-scroll::-webkit-scrollbar-track { background: var(--bg); }
.ladder-scroll::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }

.ladder-table { width: 100%; border-collapse: collapse; }
.ladder-table thead { position: sticky; top: 0; z-index: 5; background: var(--surface2); }
.ladder-table th {
  font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px; text-align: left;
  border-bottom: 2px solid var(--border-dark);
}
.ladder-table th.center { text-align: center; }

.ladder-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  animation: fadeSlide 0.25s ease both;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateX(6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ladder-table tbody tr:hover { background: var(--accent-light); }
.ladder-table td { padding: 9px 14px; font-size: 15px; }

.sep-row td         { padding: 0; height: 3px; background: var(--sep-top6); border: none; }
.sep-row.sep-10 td  { background: var(--sep-top10); }

/* Rank number and team name colouring by position */
.rank-cell { font-size: 18px; font-weight: 800; color: var(--muted); width: 36px; text-align: center; }

.rank-top6        { color: var(--accent-blue); }   /* ranks 1–6:  blue */
.rank-mid         { color: var(--accent-red);  }   /* ranks 7–10: red  */

.ladder-team-cell { display: flex; align-items: center; gap: 9px; }
.ladder-team-logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }

/* team-cell inherits rank class colour via the shared class on the <span> */
.team-cell { font-weight: 700; font-size: 15px; color: var(--text); }
.team-cell.rank-top6 { color: var(--accent-blue); }
.team-cell.rank-mid  { color: var(--accent-red);  }

.stat-cell  { font-weight: 600; font-size: 15px; text-align: center; color: var(--muted); }
.pts-cell   { font-weight: 800; font-size: 17px; text-align: center; color: var(--accent-red); }

.wins-bar-wrap { display: flex; align-items: center; gap: 8px; }
.wins-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.wins-bar-fill { height: 100%; background: var(--accent-blue); border-radius: 2px; transition: width 0.3s ease; }

.no-data-row td { text-align: center; padding: 40px; color: var(--muted); font-size: 15px; }
