/**
 * CricOracle — Central Stylesheet
 * ALL layout, components, and utilities in one place.
 * Oracle Night design system.
 *
 * SECTIONS:
 *  1. Base / Reset
 *  2. Layout — Public Site
 *  3. Layout — Admin Panel
 *  4. Glass & Glow Effects
 *  5. Cricket Components (scorecard, balls, meter)
 *  6. Tab System
 *  7. Animations
 *  8. Utilities
 */


/* ============================================
   1. BASE / RESET
   ============================================ */

html {
  scroll-behavior: smooth;
}

body {
  background-color: #0d0d17;
  color: #e7e3f3;
  font-family: 'Manrope', sans-serif;
  margin: 0;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

button, a, nav {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

canvas {
  width: 100% !important;
  height: auto;
}


/* ============================================
   2. LAYOUT — PUBLIC SITE
   Sidebar: 16rem (256px) on lg+
   Content: max 64rem (1024px) centered
   ============================================ */

/* -- Sidebar (desktop only, hidden on mobile via Tailwind .hidden .lg:flex) -- */
.site-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 16rem;
  background: #12121e;
  display: flex;
  flex-direction: column;
  z-index: 50;
  border-right: 1px solid rgba(71, 71, 83, 0.1);
}

/* -- Main content area -- */
.site-main {
  background: #0d0d17;
  position: relative;
  min-height: 100vh;
  padding-bottom: 6rem; /* space for mobile bottom nav */
}

@media (min-width: 1024px) {
  .site-main {
    margin-left: 16rem; /* push right of sidebar */
    padding-bottom: 2rem;
  }
}

/* -- Mobile top header -- */
.site-header-mobile {
  background: #0d0d17;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

@media (min-width: 640px) {
  .site-header-mobile { padding: 1rem 1.5rem; }
}

@media (min-width: 1024px) {
  .site-header-mobile { display: none; }
}

/* -- Desktop top bar -- */
.site-header-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .site-header-desktop {
    display: flex;
    background: rgba(13, 13, 23, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(71, 71, 83, 0.1);
  }
}

/* -- Content wrapper (THE key layout rule) -- */
.site-content {
  max-width: 64rem; /* 1024px */
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .site-content { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .site-content { padding: 0 2rem; }
}

/* -- Bottom nav (mobile only) -- */
.site-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(18, 18, 30, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 5rem;
  padding: 0 1rem;
  z-index: 50;
  box-shadow: 0 -10px 40px -10px rgba(0, 255, 136, 0.08);
}

@media (min-width: 1024px) {
  .site-bottom-nav { display: none; }
}


/* ============================================
   3. LAYOUT — ADMIN PANEL
   Sidebar: 15rem (240px) on lg+
   Content: max 64rem (1024px) centered
   ============================================ */

.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 15rem;
  background: #12121e;
  display: flex;
  flex-direction: column;
  z-index: 50;
  border-right: 1px solid rgba(37, 36, 51, 0.5);
}

.admin-main {
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .admin-main {
    margin-left: 15rem;
  }
}

.admin-header-mobile {
  background: #0d0d17;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid #252433;
}

@media (min-width: 1024px) {
  .admin-header-mobile { display: none; }
}

.admin-header-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .admin-header-desktop {
    display: flex;
    background: rgba(13, 13, 23, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(37, 36, 51, 0.3);
  }
}

.admin-content {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

@media (min-width: 640px) {
  .admin-content { padding: 1.5rem 1.5rem 2rem; }
}

@media (min-width: 1024px) {
  .admin-content { padding: 1.5rem 2rem 2rem; }
}


/* ============================================
   4. GLASS & GLOW EFFECTS
   ============================================ */

.glass-card {
  background: rgba(37, 36, 51, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-elevated {
  background: rgba(37, 36, 51, 0.6);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(117, 116, 129, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.primary-glow {
  box-shadow: 0 0 20px -5px rgba(0, 255, 136, 0.3);
}

.ambient-glow {
  box-shadow: 0 0 40px -10px rgba(164, 255, 185, 0.1);
}

.glow-error {
  box-shadow: 0 0 20px -5px rgba(255, 113, 108, 0.3);
}

.glow-team {
  box-shadow: 0 0 20px -5px var(--team-color, rgba(0, 255, 136, 0.3));
}

@media (hover: hover) {
  .hover-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }
  .hover-card:hover {
    border-color: rgba(164, 255, 185, 0.15);
    box-shadow: 0 0 30px -10px rgba(0, 255, 136, 0.12);
  }
}


/* ============================================
   5. CRICKET COMPONENTS
   ============================================ */

/* -- Score display (tabular nums) -- */
.score-display {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* -- Scorecard tables -- */
.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.scorecard-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #757481;
  border-bottom: 1px solid rgba(71, 71, 83, 0.3);
  font-weight: 700;
}

.scorecard-table th.text-right,
.scorecard-table td.text-right {
  text-align: right;
}

.scorecard-table td {
  padding: 0.5rem 0.75rem;
  color: #e7e3f3;
  border-bottom: 1px solid rgba(71, 71, 83, 0.1);
}

.scorecard-table tr:last-child td {
  border-bottom: none;
}

.scorecard-table .on-strike td:first-child {
  position: relative;
}

.scorecard-table .on-strike td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #a4ffb9;
  border-radius: 2px;
}

.scorecard-table .dismissed td {
  color: #757481;
}

/* -- Ball indicators -- */
.ball-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ball-dot      { background: #252433; color: #757481; }
.ball-run      { background: #181825; color: #e7e3f3; border: 1px solid #474753; }
.ball-boundary { background: rgba(0,255,136,0.15); color: #a4ffb9; border: 1px solid rgba(0,255,136,0.3); }
.ball-six      { background: rgba(0,255,136,0.25); color: #00ff88; border: 1px solid rgba(0,255,136,0.5); box-shadow: 0 0 8px rgba(0,255,136,0.2); }
.ball-wicket   { background: rgba(255,113,108,0.2); color: #ff716c; border: 1px solid rgba(255,113,108,0.4); }
.ball-extra    { background: rgba(126,230,255,0.15); color: #7ee6ff; border: 1px solid rgba(126,230,255,0.3); }

/* -- Confidence meter SVG -- */
.confidence-meter .meter-arc {
  transition: stroke-dasharray 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -- Sticky score bar (mobile) -- */
.sticky-score-bar {
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sticky-score-bar.visible {
  transform: translateY(0);
}


/* ============================================
   6. TAB SYSTEM
   ============================================ */

.tab-btn {
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: #a4ffb9;
  border-color: #a4ffb9;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: tabFadeIn 0.2s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================
   7. ANIMATIONS
   ============================================ */

@media (prefers-reduced-motion: no-preference) {
  .site-main, .admin-main {
    animation: fadeIn 0.3s ease-out;
  }

  .reveal-section {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .reveal-section.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

.live-dot {
  animation: live-pulse 1.5s ease-in-out infinite;
}

.skeleton {
  background: linear-gradient(90deg, #181825 25%, #252433 50%, #181825 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ============================================
   8. UTILITIES
   ============================================ */

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .pb-safe { padding-bottom: env(safe-area-inset-bottom); }
}

/* Hide scrollbar */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Scroll snap for horizontal card lists */
.scroll-snap-x {
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.scroll-snap-x > * {
  scroll-snap-align: start;
}
