/* static/css/site.css - CricBlink Final Production CSS */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

html {
    scroll-behavior: smooth;
}

:root {
  /* Brand Palette */
  --primary: #6366f1; /* Indigo-500 */
  --primary-dark: #4f46e5; /* Indigo-600 */
  --accent: #ec4899; /* Pink-500 */
  --live-color: #ef4444; /* Red-500 */

  /* Light Theme Variables */
  --bg-body: #f3f4f6;
  --bg-surface: #ffffff;
  --bg-header: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --score-color: #111827;
  --nav-active-bg: rgba(99, 102, 241, 0.1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-body: #0f172a; /* Slate-900 */
  --bg-surface: #1e293b; /* Slate-800 */
  --bg-header: #1e293b; /* Slate-800 */
  --text-main: #f8fafc; /* Slate-50 */
  --text-muted: #94a3b8; /* Slate-400 */
  --border: #334155; /* Slate-700 */
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --score-color: #ffffff;
  --nav-active-bg: rgba(99, 102, 241, 0.2);
}

/* --- 1. RESET & BASE --- */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}
a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}
img {
  max-width: 100%;
  display: block;
}
button {
  font-family: inherit;
}

/* --- 2. HEADER --- */
.site-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  font-weight: 600;
}
.nav-links a {
  color: var(--text-muted);
  position: relative;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

.theme-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Mobile Header Tweaks */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  } /* Hide nav links on small mobile, keep logo & theme btn */
  .header-left {
    gap: 10px;
  }
}

/* --- 3. LAYOUT & GRID --- */
.container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 20px;
}

/* Main Layout: Content + Sidebar */
.main-grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 24px;
  margin-top: 20px;
}
@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  } /* Stack on tablet/mobile */
  .right-col {
    display: none;
  } /* Optional: Hide sidebar on mobile to focus on content */
}

/* Section Titles */
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
  border-left: 4px solid var(--primary);
  padding-left: 12px;
}

/* --- 4. MATCH LIST & CARDS (Home) --- */
.match-card {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s;
}
.match-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.league-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}
.score-val {
  font-family: monospace;
  color: var(--score-color);
  font-weight: 800;
}
.overs-val {
  font-size: 0.85em;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

.status-line {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--live-color);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- 5. HERO STRIP (Horizontal Scroll) --- */
.hero-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
  margin-bottom: 20px;
}
.hero-strip::-webkit-scrollbar {
  display: none;
}

.mini-card {
  min-width: 260px;
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--live-color);
}

/* --- 6. MATCH DETAIL PAGE --- */
.match-header-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.big-score {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 15px 0;
  line-height: 1.4;
  font-family: monospace;
}
.link-clean {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}
.link-clean:hover {
  color: var(--primary);
}

/* Tabs */
.match-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.match-nav a {
  flex: 1;
  text-align: center;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.match-nav a:hover {
  background: var(--bg-body);
  color: var(--text-main);
}
.match-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--nav-active-bg);
}

/* Data Tables (Scorecard & Stats) */
.score-section {
  background: var(--bg-surface);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.score-header {
  background: var(--bg-body);
  padding: 12px 15px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.sc-table,
.career-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.sc-table th,
.career-table th {
  background: var(--bg-body);
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}
.sc-table th:first-child,
.career-table th:first-child {
  text-align: left;
}

.sc-table td,
.career-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  color: var(--text-main);
}
.sc-table td:first-child,
.career-table td:first-child {
  text-align: left;
  font-weight: 600;
}

/* Mobile Table Scroll */
.score-section {
  overflow-x: auto;
}
.sc-table {
  min-width: 600px;
} /* Prevent squishing on phone */

/* Highlight Current Batsman */
.batsman-active {
  background-color: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--primary);
}
.dismissal {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- 7. PROFILES (Player & Team) --- */
.profile-card {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  padding: 32px;
  background: var(--bg-surface);
  border-radius: 16px;
  margin-bottom: 24px;
}
.profile-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-body);
  box-shadow: var(--shadow);
}
.player-name {
  margin: 0 0 8px 0;
  font-size: 1.8rem;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.player-meta {
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.role-grid {
  display: flex;
  gap: 24px;
}
.role-tag small {
  display: block;
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.role-tag div {
  font-weight: 600;
  font-size: 1rem;
  text-transform: capitalize;
}

/* Squad Grid */
.squad-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(180px, 1fr)
  ); /* Smaller min-width for better responsiveness */
  gap: 16px;
  padding: 16px;
}
.player-card {
  display: flex;
  flex-direction: column; /* Stack image and text vertically */
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: 0.2s;
  color: var(--text-main);
  height: 100%; /* Ensure equal height cards */
}
.player-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.player-img {
  width: 80px;
  height: 80px; /* Fixed size for consistency */
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background-color: var(--bg-body);
}
.player-info div:first-child {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.player-info div:last-child {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- 8. UTILITIES & ADS --- */
.sidebar-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-radius: 12px;
  border: 1px dashed var(--border);
  font-size: 1.1rem;
}
.info-row {
  display: flex;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.info-label {
  width: 130px;
  color: var(--text-muted);
  font-weight: 500;
}
.info-val {
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}

/* Ad Placeholders */
.ad-slot span {
  display: block;
  font-family: monospace;
  letter-spacing: 1px;
}

/* --- 9. COMMENTARY TIMELINE --- */
.comm-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.comm-item:last-child {
  border-bottom: none;
}

.comm-ball {
  min-width: 45px;
  height: 45px;
  background: var(--bg-body);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 2px solid var(--border);
}
.comm-ball.wicket {
  border-color: var(--live-color);
  color: var(--live-color);
  background: rgba(239, 68, 68, 0.1);
}
.comm-ball.four {
  border-color: #3b82f6;
  color: #3b82f6;
}
.comm-ball.six {
  border-color: var(--primary);
  color: var(--primary);
}

.comm-body {
  flex: 1;
}
.comm-header {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.comm-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.comm-runs {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  min-width: 40px;
  text-align: right;
}
