/* ==========================================================================
   SportX - Dedicated Responsive & Mobile Experience Stylesheet
   Ensures seamless layering, athletic aesthetics, and flawless mobile UX
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Mobile Navigation & Status Bar (< 992px)
   -------------------------------------------------------------------------- */
.mobile-nav-toggle {
  display: none;
  background: var(--ink);
  border: 2px solid var(--ink);
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  z-index: 101;
  transform: skewX(var(--skew));
  transition: background 0.2s, transform 0.1s;
}
.mobile-nav-toggle .hamburger-bar {
  display: block;
  width: 20px;
  height: 2.5px;
  background: var(--accent);
  transition: transform 0.25s, opacity 0.25s;
  transform: skewX(calc(var(--skew) * -1));
}
.mobile-nav-toggle.active {
  background: var(--ink);
}
.mobile-nav-toggle.active .hamburger-bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
.mobile-nav-toggle.active .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.mobile-nav-toggle.active .hamburger-bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Mobile Nav Backdrop */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.mobile-nav-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Mobile Nav Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -340px;
  width: min(320px, 86vw);
  height: 100vh;
  height: 100dvh;
  background: var(--ink-2);
  border-left: 3px solid var(--accent);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.9);
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}
.mobile-nav-drawer.open {
  right: 0;
}
.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.5rem;
}
.mobile-drawer-brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mobile-drawer-close {
  background: transparent;
  color: var(--white);
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.5rem;
  border: none;
  transition: color 0.2s;
}
.mobile-drawer-close:hover {
  color: var(--accent);
}
.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: auto;
}
.mobile-drawer-links a {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: 1.4rem;
  text-transform: uppercase;
  color: var(--white);
  padding: 0.85rem 1rem;
  border-left: 4px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
  text-decoration: none;
  letter-spacing: 0.05em;
}
.mobile-drawer-links a:hover,
.mobile-drawer-links a.active {
  background: rgba(110, 198, 255, 0.12);
  border-left-color: var(--accent);
  color: var(--accent);
  transform: translateX(4px);
}
.mobile-drawer-footer {
  padding-top: 1.5rem;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.drawer-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   2. Match Center Scoreboard Component (match.html)
   -------------------------------------------------------------------------- */
.match-center-header {
  background: var(--ink-2);
  border-bottom: var(--border-md) solid rgba(255, 255, 255, 0.1);
  padding: 3.5rem 0 3rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.match-center-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 900px;
  height: 100%;
  background: radial-gradient(circle at 50% 25%, rgba(110, 198, 255, 0.09) 0%, transparent 70%);
  pointer-events: none;
}
.mc-meta {
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.mc-score-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
  max-width: 960px;
  margin: 1.5rem auto;
}
.mc-team {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--white);
  word-break: break-word;
}
.mc-team.home { text-align: right; }
.mc-team.away { text-align: left; }

.mc-score-box {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  background: var(--ink);
  border: 3px solid var(--white);
  box-shadow: 6px 6px 0 var(--accent);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  color: var(--white);
  transform: skewX(var(--skew));
}
.mc-score-box > * {
  transform: skewX(calc(var(--skew) * -1));
}
.mc-score-num {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  min-width: 48px;
  text-align: center;
  color: var(--white);
}
.mc-divider {
  font-size: 2rem;
  color: var(--accent);
}
.mc-timer {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: 2.25rem;
  color: var(--accent);
  margin-top: 1.5rem;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   3. Tablet & Mid-Width Breakpoints (max-width: 992px)
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  /* Navigation */
  .sb-nav {
    display: none !important;
  }
  .mobile-nav-toggle {
    display: flex !important;
  }
  .sb-right .btn-icon {
    display: none !important;
  }
  .sb-right .live-clock {
    font-size: 0.85rem;
    padding-right: 0.5rem;
  }

  /* Grid Layouts */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .layout-split {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

/* --------------------------------------------------------------------------
   4. Mobile Phone Breakpoint (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Global Layout & Overflow Protection */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }
  body {
    background-size: 32px 32px;
  }
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .section {
    padding: 44px 0 !important;
  }

  /* Ambient Accents on Mobile */
  .ghost-numeral {
    font-size: 130px !important;
    top: 40px !important;
    left: -10px !important;
    opacity: 0.025 !important;
    pointer-events: none;
    user-select: none;
  }
  .slant-panel {
    width: 100% !important;
    height: 180px !important;
    clip-path: polygon(90% 0, 100% 0, 100% 100%, 75% 100%) !important;
    opacity: 0.45;
  }

  /* Typography */
  h1 {
    font-size: clamp(2rem, 7.5vw, 2.75rem) !important;
    line-height: 0.95 !important;
    word-break: break-word;
  }
  h2 {
    font-size: clamp(1.75rem, 6.5vw, 2.25rem) !important;
    line-height: 0.95 !important;
    word-break: break-word;
  }
  h3 {
    font-size: 1.5rem !important;
  }
  .subtitle {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
    line-height: 1.4 !important;
  }

  /* Buttons on Mobile */
  .btn {
    min-height: 44px !important;
    padding: 0 1.25rem !important;
    font-size: 1.1rem !important;
    box-shadow: 4px 4px 0 var(--ink) !important;
  }
  .btn-accent,
  .btn-paper-solid {
    min-height: 44px !important;
    padding: 0 1.25rem !important;
    font-size: 1.15rem !important;
  }

  /* Hero Section */
  .hero-section {
    padding: 2rem 0 3rem 0 !important;
  }
  .hero-content {
    margin-bottom: 2rem !important;
  }
  .hero-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }
  .hero-actions .btn {
    width: 100% !important;
    text-align: center;
  }

  /* Section Headers */
  .section-header-comp {
    margin-bottom: 1.5rem !important;
  }
  .sh-row {
    gap: 0.75rem !important;
    flex-wrap: wrap;
    align-items: center;
  }
  .sh-title {
    font-size: clamp(28px, 7vw, 42px) !important;
    white-space: normal !important;
    line-height: 1 !important;
  }
  .sh-rule {
    display: none !important;
  }
  .sh-link {
    margin-left: auto;
  }

  /* Split Card (Login & Register) */
  .split-card {
    flex-direction: column !important;
    margin-top: 1.5rem !important;
    margin-bottom: 2rem !important;
    box-shadow: 6px 6px 0 var(--accent) !important;
    border-width: 2px !important;
  }
  .split-card-left,
  .split-card-right {
    padding: 1.5rem !important;
  }
  .split-card-left h1 {
    font-size: clamp(2rem, 8vw, 2.5rem) !important;
  }
  .lane-label .numeral {
    font-size: 2.75rem !important;
  }

  /* Featured Tournament & Hero Split Card */
  .hero-split-card {
    flex-direction: column !important;
    box-shadow: 6px 6px 0 var(--accent) !important;
    border-width: 2px !important;
  }
  .hero-split-left,
  .hero-split-right {
    padding: 1.25rem !important;
  }
  .hsc-title {
    font-size: 1.85rem !important;
    margin: 1rem 0 !important;
  }
  .hsc-team-row {
    font-size: 1.35rem !important;
    margin-bottom: 0.75rem !important;
  }
  .hsc-score {
    font-size: 2.75rem !important;
  }
  .hsc-meta {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.75rem;
  }
  .hsc-val {
    font-size: 1.4rem !important;
  }

  /* Live Rail Cards */
  .card-live {
    padding: 1.25rem !important;
    box-shadow: 5px 5px 0 var(--accent) !important;
    border-width: 2px !important;
  }
  .card-live-team-row {
    font-size: 1.25rem !important;
  }

  /* Fixture Rows: Transform into Athletic Mobile Cards */
  .fixture-row {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto auto !important;
    gap: 0.4rem 0.75rem !important;
    padding: 1rem 1rem !important;
    background: var(--ink-2) !important;
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    border-left: 5px solid var(--accent) !important;
    margin-bottom: 0.75rem !important;
    border-radius: 0 !important;
    text-decoration: none;
    box-sizing: border-box;
  }
  .f-time {
    grid-column: 1 !important;
    grid-row: 1 !important;
    text-align: left !important;
    font-size: 0.85rem !important;
    color: var(--accent) !important;
    font-weight: 700;
  }
  .f-action {
    grid-column: 2 !important;
    grid-row: 1 !important;
    text-align: right !important;
  }
  .f-team.home {
    grid-column: 1 !important;
    grid-row: 2 !important;
    text-align: left !important;
    padding: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 700;
  }
  .f-vs-score {
    grid-column: 2 !important;
    grid-row: 2 / span 2 !important;
    align-self: center !important;
    min-width: 72px !important;
    font-size: 1.25rem !important;
    padding: 0.35rem 0.6rem !important;
    border-width: 2px !important;
    text-align: center;
  }
  .f-team.away {
    grid-column: 1 !important;
    grid-row: 3 !important;
    text-align: left !important;
    padding: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 700;
  }

  /* Tournaments & Teams Grids */
  #events-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
  #teams-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)) !important;
    gap: 1.25rem !important;
  }
  .team-card {
    padding: 1.25rem !important;
    box-shadow: 5px 5px 0 var(--accent) !important;
    border-width: 2px !important;
  }
  .team-badge {
    width: 60px !important;
    height: 60px !important;
    font-size: 2.25rem !important;
    margin-bottom: 1rem !important;
  }
  .team-name {
    font-size: 1.4rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Match Center Scoreboard Mobile */
  .match-center-header {
    padding: 2.25rem 0 2rem 0 !important;
  }
  .mc-score-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
    text-align: center;
  }
  .mc-team.home,
  .mc-team.away {
    text-align: center !important;
    font-size: 1.75rem !important;
    padding: 0 1rem;
  }
  .mc-score-box {
    padding: 0.5rem 1.25rem !important;
    margin: 0 auto;
    box-shadow: 4px 4px 0 var(--accent) !important;
  }
  .mc-score-num {
    font-size: 2.75rem !important;
  }
  .mc-timer {
    font-size: 1.75rem !important;
    margin-top: 1.25rem !important;
  }

  /* Match Tabs */
  .mc-tabs {
    gap: 1rem !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 1.5rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .mc-tab {
    font-size: 1.1rem !important;
    padding: 0.4rem 0 !important;
    white-space: nowrap !important;
  }

  /* Match Timeline Mobile Ergonomics */
  .timeline-container {
    padding: 1rem 0 !important;
    max-width: 100% !important;
  }
  .timeline-track {
    left: 20px !important;
    transform: none !important;
  }
  .timeline-badge {
    left: 20px !important;
    transform: none !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 0.75rem !important;
  }
  .timeline-event {
    align-items: flex-start !important;
    margin-bottom: 1.5rem !important;
  }
  .timeline-event.home-side,
  .timeline-event.away-side,
  .timeline-event.center-side {
    flex-direction: row !important;
    justify-content: flex-start !important;
  }
  .timeline-event .timeline-card {
    width: auto !important;
    flex: 1 !important;
    margin-left: 54px !important;
    margin-right: 0 !important;
    text-align: left !important;
    padding: 0.85rem 1rem !important;
  }

  /* Match Stats Mobile Ergonomics */
  .stats-container {
    padding: 1.25rem 1rem !important;
  }
  .stat-header {
    font-size: 0.95rem !important;
  }
  .stat-val {
    font-size: 1.1rem !important;
  }

  /* Tournament Brackets */
  #bracket-view {
    padding: 1rem 0.75rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-width: 2px !important;
  }
  .bracket-container {
    min-width: 680px !important;
    gap: 30px !important;
    padding: 1rem 0.5rem !important;
  }
  .bracket-round {
    min-width: 160px !important;
  }
  .bracket-title {
    font-size: 1.2rem !important;
    margin-bottom: 1rem !important;
  }
  .bracket-match {
    padding: 0.75rem !important;
    margin-bottom: 1.25rem !important;
  }
  .bracket-match .team {
    padding: 8px 10px !important;
    font-size: 0.95rem !important;
  }

  /* Admin Dashboard & Operator Deck Mobile */
  .card h2 {
    font-size: 2.75rem !important;
  }
  #page-title {
    font-size: 2rem !important;
  }
  .nav-item {
    padding: 0 1rem !important;
    font-size: 0.95rem !important;
    min-height: 40px !important;
    white-space: nowrap !important;
  }
  .operator-deck {
    padding: 1rem !important;
    box-shadow: 4px 4px 0 var(--accent) !important;
  }
  .operator-deck-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  .operator-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }
  .operator-actions button {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
    min-height: 44px !important;
    padding: 6px 10px !important;
  }
  #admin-match-quick-links {
    width: 100% !important;
    justify-content: space-between !important;
    margin-top: 0.5rem !important;
  }
  #admin-match-quick-links button,
  #admin-match-quick-links a {
    flex: 1 !important;
    justify-content: center !important;
    text-align: center !important;
  }
  #admin-event-minute {
    width: 75px !important;
  }
  #admin-event-type,
  #admin-event-team {
    flex: 1 !important;
    min-width: 120px !important;
  }
  #admin-event-desc {
    width: 100% !important;
    min-width: 100% !important;
  }
  #admin-btn-add-event {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }
  #admin-end-match-modal > div {
    padding: 1.25rem !important;
    width: 94% !important;
  }
  #ctrl-home-score,
  #ctrl-away-score {
    font-size: 3rem !important;
  }
  #ctrl-timer {
    font-size: 2.25rem !important;
  }

  /* Footer */
  .footer {
    padding: 2.5rem 0 1.5rem 0 !important;
    margin-top: 2.5rem !important;
  }
  .footer-content {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .footer-links {
    gap: 0.75rem !important;
  }
}

/* --------------------------------------------------------------------------
   5. Ultra-Small Screens (max-width: 380px)
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .split-card-left,
  .split-card-right,
  .hero-split-left,
  .hero-split-right,
  .team-card,
  .card-live {
    padding: 1rem !important;
  }
  .f-vs-score {
    min-width: 60px !important;
    font-size: 1.1rem !important;
    padding: 0.25rem 0.4rem !important;
  }
  .f-team.home,
  .f-team.away {
    font-size: 1rem !important;
  }
}

/* Hero Scoreboard Responsive */
@media (max-width: 640px) {
  .hero-scoreboard {
    box-shadow: 8px 8px 0 var(--accent) !important;
  }
  .hsb-header {
    padding: 0.75rem 1rem !important;
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }
  .hsb-arena {
    padding: 1.1rem 0.85rem !important;
    gap: 0.5rem !important;
  }
  .hsb-crest {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.6rem !important;
  }
  .hsb-team-name {
    font-size: 1.15rem !important;
  }
  .hsb-team-code {
    font-size: 0.75rem !important;
  }
  .hsb-score-board {
    padding: 0.3rem 0.7rem !important;
  }
  .hsb-score-num {
    font-size: 2.25rem !important;
    min-width: 28px !important;
  }
  .hsb-score-sep {
    font-size: 1.5rem !important;
  }
  .hsb-footer {
    padding: 0.75rem 1rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }
  .hsb-venue {
    justify-content: center !important;
    font-size: 0.8rem !important;
  }
  .hsb-btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 380px) {
  .hsb-arena {
    padding: 1rem 0.4rem !important;
    gap: 0.35rem !important;
  }
  .hsb-crest {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.3rem !important;
  }
  .hsb-team-name {
    font-size: 0.95rem !important;
  }
  .hsb-score-num {
    font-size: 1.85rem !important;
    min-width: 22px !important;
  }
  .hsb-rail {
    max-width: 80px !important;
  }
}
