/* Ganvada Premier League (gplt20.com) - Clean Light Cricketing UI & Optional Dark Mode */

:root {
  --bg: #f4f7f5;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #ecfdf5;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #334155;
  --navy: #0f172a;
  --emerald: #059669;
  --emerald-bright: #10b981;
  --emerald-glow: rgba(5, 150, 105, 0.16);
  --gold: #d97706;
  --gold-bright: #f59e0b;
  --gold-glow: rgba(217, 119, 6, 0.16);
  --crimson: #dc2626;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.07);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --font-display: 'Barlow Condensed', system-ui, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #070b19;
  --bg-elevated: #0d1428;
  --surface: rgba(15, 23, 42, 0.88);
  --surface-solid: #111a31;
  --surface-soft: rgba(255, 255, 255, 0.03);
  --surface-hover: #172342;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #cbd5e1;
  --emerald: #10b981;
  --gold: #f59e0b;
  --crimson: #ef4444;
  --shadow-sm: 0 4px 16px rgba(2, 6, 23, 0.35);
  --shadow-lg: 0 20px 50px rgba(2, 6, 23, 0.55);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 75% 45% at 10% -5%, rgba(16, 185, 129, 0.08), transparent 60%),
    radial-gradient(ellipse 65% 40% at 90% 0%, rgba(245, 158, 11, 0.07), transparent 55%);
}

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

img {
  max-width: 100%;
  display: block;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Top Score Strip */
.ticker-bar {
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}

.ticker-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 7px 0;
  scrollbar-width: none;
}

.ticker-track::-webkit-scrollbar {
  display: none;
}

.ticker-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ticker-chip:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

/* Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .site-header {
  background: rgba(7, 11, 25, 0.88);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 10px var(--emerald-glow));
}

.brand-crest {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #059669, #10b981 65%, #f59e0b);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: #ffffff;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--emerald-glow);
}

.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.32rem;
  letter-spacing: 0.03em;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-text span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.87rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface-hover);
  color: var(--emerald);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.season-select {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--emerald);
  color: var(--emerald);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--emerald);
  color: #ffffff;
  box-shadow: 0 6px 18px var(--emerald-glow);
}

.btn-primary:hover {
  background: #047857;
}

.btn-gold {
  background: #f59e0b;
  color: #1c1202;
  box-shadow: 0 6px 18px var(--gold-glow);
}

.btn-gold:hover {
  background: #d97706;
  color: #ffffff;
}

.btn-outline {
  background: var(--surface-solid);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--emerald);
  color: var(--emerald);
}

.btn-danger {
  background: var(--crimson);
  color: #ffffff;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-live {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.35);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dc2626;
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.badge-emerald {
  background: rgba(5, 150, 105, 0.1);
  color: var(--emerald);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-gold {
  background: rgba(217, 119, 6, 0.12);
  color: var(--gold);
  border: 1px solid rgba(217, 119, 6, 0.28);
}

.badge-muted {
  background: var(--surface-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Sections & Cards */
.section {
  padding: 36px 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-kicker {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--emerald);
  margin-bottom: 3px;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.8vw, 2.15rem);
  font-weight: 800;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  line-height: 1.05;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  border-color: rgba(5, 150, 105, 0.45);
  box-shadow: var(--shadow-lg);
}

/* Hero */
.hero {
  padding: 32px 0 20px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 32px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-top: 4px solid var(--emerald);
  box-shadow: var(--shadow-lg);
}

.hero-title {
  margin: 12px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.hero-title .accent {
  color: var(--emerald);
}

.hero-sub {
  margin: 0 0 20px;
  color: var(--text-soft);
  font-size: 0.96rem;
  max-width: 56ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.metric-box strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--emerald);
  line-height: 1.05;
}

.metric-box span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Match Spotlight */
.match-spotlight {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  padding: 26px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-top: 4px solid var(--gold-bright);
  box-shadow: var(--shadow-lg);
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.team-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.team-crest {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffffff;
  flex-shrink: 0;
}

.score-big {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.overs-tag {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.gpl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.gpl-table th {
  text-align: left;
  padding: 10px 11px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.gpl-table td {
  padding: 11px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.gpl-table tbody tr:hover {
  background: var(--surface-soft);
}

.gpl-table th.num,
.gpl-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Tabs & Filters */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.tab-btn.active,
.tab-btn:hover {
  background: var(--emerald);
  color: #ffffff;
  border-color: var(--emerald);
}

/* Bracket */
.bracket-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  overflow-x: auto;
}

.bracket-col h4 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--emerald);
}

.bracket-match {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.bracket-match.winner-highlight {
  border-color: rgba(217, 119, 6, 0.5);
  background: rgba(245, 158, 11, 0.06);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
}

.input,
select.input,
textarea.input {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}

/* Alerts & Toast */
.alert {
  padding: 12px 15px;
  border-radius: 11px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
  font-size: 0.88rem;
}

.alert-success {
  background: rgba(5, 150, 105, 0.09);
  border-color: rgba(5, 150, 105, 0.28);
  color: #065f46;
}

[data-theme="dark"] .alert-success {
  color: #a7f3d0;
}

.alert-error {
  background: rgba(220, 38, 38, 0.09);
  border-color: rgba(220, 38, 38, 0.3);
  color: #991b1b;
}

[data-theme="dark"] .alert-error {
  color: #fecaca;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 80px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 11px;
  background: #0f172a;
  border: 1px solid var(--emerald);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Social Pills & Responsive Helpers */
.social-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.social-pill:hover {
  transform: translateY(-1px);
  border-color: var(--emerald);
  color: var(--emerald);
  background: var(--surface-hover);
}

.social-pill.yt:hover { border-color: #dc2626; color: #dc2626; background: rgba(220, 38, 38, 0.06); }
.social-pill.fb:hover { border-color: #2563eb; color: #2563eb; background: rgba(37, 99, 235, 0.06); }
.social-pill.wa:hover { border-color: #16a34a; color: #16a34a; background: rgba(22, 163, 74, 0.06); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-bar .input {
  width: 230px;
  padding: 8px 12px;
}

.squad-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr 0.7fr;
  gap: 8px;
}

.scoring-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.wicket-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

/* Footer & Mobile Nav */
.site-footer {
  margin-top: 48px;
  padding: 40px 0 88px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 26px;
}

.mobile-bottom-nav {
  display: none;
}

.mobile-menu-btn {
  display: none;
}

@media (max-width: 1060px) {
  .hero-grid,
  .grid-4,
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nav-links {
    display: none;
  }
  .nav-links.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    z-index: 65;
    background: var(--bg-elevated);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open .nav-link {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    text-align: center;
  }
  .mobile-menu-btn {
    display: grid;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 0 14px;
  }
  .section {
    padding: 26px 0;
  }
  .hero {
    padding: 20px 0 14px;
  }
  .hero-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid,
  .footer-grid,
  .bracket-grid {
    grid-template-columns: 1fr;
  }
  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-panel,
  .match-spotlight,
  .card {
    padding: 18px;
  }
  .brand-text span,
  .nav-desktop-cta {
    display: none;
  }
  .brand-text strong {
    font-size: 1.04rem;
  }
  .season-select {
    max-width: 126px;
    padding: 6px 8px;
    font-size: 0.78rem;
  }
  .nav-actions {
    gap: 6px;
  }
  .team-row {
    flex-wrap: wrap;
    padding: 11px 12px;
  }
  .team-id {
    min-width: 0;
    flex: 1 1 auto;
  }
  .score-big {
    font-size: 1.3rem;
  }
  .filter-bar {
    width: 100%;
  }
  .filter-bar .input,
  .filter-bar .season-select,
  .filter-bar .btn {
    width: 100%;
    max-width: none;
  }
  .squad-row {
    grid-template-columns: 1fr 1fr;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
  }
  .squad-row input:first-child {
    grid-column: 1 / -1;
  }
  .wicket-grid {
    grid-template-columns: 1fr;
  }
  .scoring-pad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .tab-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .hero-cta .btn {
    width: 100%;
  }
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 7px 4px;
  }
  [data-theme="dark"] .mobile-bottom-nav {
    background: rgba(7, 11, 25, 0.95);
  }
  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px;
  }
  .mobile-bottom-nav a.active {
    color: var(--emerald);
  }
}
