/* MINI LEAGUE ADD-ON CSS
   Load AFTER style.css.
   style.css = base/desktop
   mini-league.css = mini-site layouts + mobile overrides
*/

/* ===============================
   MINI SITE LAYOUTS
   =============================== */

.mini-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px auto;
}

.mini-nav a,
.admin-grid a,
.tournament-actions .button-link {
  text-align: center;
}

.league-hub-grid,
.admin-grid,
.division-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.league-card-table,
.draw-preview,
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.league-card-row,
.draw-match-card,
.entry-row {
  display: grid;
  grid-template-columns: 55px 1fr 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 18px;
}

.draw-match-card {
  grid-template-columns: 90px 1fr;
}

.entry-row {
  grid-template-columns: 64px 1fr 90px;
}

.entry-row img,
.player-mini-img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.12);
}

.admin-pin-box {
  max-width: 460px;
  margin: 0 auto;
}

.admin-only-badge,
.status-pill {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}

.tournament-actions,
.draw-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.admin-back-bar {
  margin-bottom: 20px;
}

.admin-back-bar .button-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ===============================
   MOBILE SIDE MENU
   =============================== */

.mobile-menu-toggle,
.mobile-side-logo {
  display: none;
}

/* DARK OVERLAY */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.25s ease;

  /* MUST BE BELOW NAV MENU */
  z-index: 9998;
}

.mobile-menu-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===============================
   MOBILE / PORTRAIT OPTIMISATION
   =============================== */

@media (max-width: 700px) {

  body {
    font-size: 13px;
    overflow-x: hidden;
  }

  body::before {
    background-size: 620px;
    opacity: 0.06;
    background-position: center center;
  }

  .navbar {
  position: sticky;
  top: 0;

  /* IMPORTANT */
  z-index: 10000;

  min-height: 54px;
  padding: 6px 10px;

  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

  .logo-link img,
  .logo {
    position: center center;
    width: 45px;
    height: 42px;
  }

  .nav-divider,
  .social-icons,
  .account-links {
    display: none !important;
  }

  .mobile-menu-toggle {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  line-height: 1;
  color: #f3e7d5;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 10px;

  /* ABOVE EVERYTHING */
  position: relative;
  z-index: 10002;
}

  .navbar .nav-links {
  position: fixed;
  top: 0;
  left: -280px;

  width: 260px;
  height: 100vh;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;

  padding: 20px;

  background: rgba(5, 5, 5, 0.97);

  border-right: 1px solid rgba(255,255,255,0.1);

  box-shadow: 15px 0 35px rgba(0,0,0,0.65);

  transition: left 0.25s ease;

  /* MOST IMPORTANT FIX */
  z-index: 10001;
}

  .navbar.mobile-open .nav-links {
    left: 0;
  }

  .mobile-side-logo {
    display: block;
    width: 110px;
    height: 110px;
    object-fit: contain;
    margin: 0 auto 20px;
  }

  .navbar .nav-links a {
    width: 100%;
    text-align: center;
    padding: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    font-size: 18px;
  }

  .dropdown-content {
    position: static;
    width: 100%;
    margin-top: 6px;
  }

  .page-header {
    padding: 12px 10px;
    margin-bottom: 10px;
  }

  .page-header h1 {
    font-size: 30px;
    line-height: 0.95;
  }

  .page-header p {
    font-size: 11px;
    margin-top: 4px;
  }

  .container {
    width: 80%;
    padding: 0 10px;
    margin: 12px auto;
  }

  .card {
    padding: 10px;
    margin-bottom: 14px;
    border-radius: 12px;
  }

  .card h2 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .button-link {
    font-size: 14px;
    padding: 8px 13px;
    border-radius: 999px;
  }

  .mini-nav,
  .main-nav {
    flex-direction: column;
    align-items: center;
  }

  .league-hub-grid,
  .admin-grid,
  .division-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .division-preview {
    padding: 10px;
    margin-bottom: 10px;
  }

  .division-preview h3 {
    font-size: 24px;
  }

  .league-card-row,
  .draw-match-card,
  .entry-row {
    grid-template-columns: 1fr;
    text-align: center;
  }


  .entry-row img,
  .player-mini-img {
    margin: 0 auto;
  }

  .leader-player-card {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px;
  }

  .leader-player-card img {
    width: 54px;
    height: 54px;
  }

  .leader-player-card h4 {
    font-size: 21px;
    margin: 0;
  }

  .leader-player-card p {
    font-size: 13px;
    margin: 0;
  }

  .leader-mini-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
  }

  .leader-mini-stats span {
    font-size: 12px;
    padding: 5px;
    text-align: center;
  }

  .coming-soon-card {
    padding: 24px 14px;
  }

  .coming-logo {
    width: 90px;
  }

  .coming-soon-card h1 {
    font-size: 48px;
  }

  .coming-tagline {
    font-size: 14px;
  }

  .coming-badge {
    font-size: 22px;
    padding: 8px 14px;
  }

  .coming-description {
    font-size: 14px;
    line-height: 1.5;
  }

  .coming-actions {
    gap: 8px;
  }

  .coming-actions .button-link {
    width: 100%;
    max-width: 260px;
  }

  .table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 6px 5px;
    font-size: 13px;
    white-space: nowrap;
  }

  #division-title {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .mini-league-logo {
    width: 85px;
    height: 85px;
  }
}

.remaining-summary-card {
  text-align: center;
}

.remaining-summary-card h3 {
  font-size: 28px;
  margin: 10px 0;
}

.remaining-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.remaining-mini-stats span,
.remaining-opponent-row {
  padding: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.08);
}

.remaining-opponent-row {
  margin: 8px auto;
  max-width: 260px;
}

@media (max-width: 700px) {
  .remaining-mini-stats {
    grid-template-columns: 1fr;
  }

  .remaining-summary-card h3 {
    font-size: 24px;
  }
}

/* ===============================
   MOBILE COMPACT FIXTURES / RESULTS
   Works with both ID and class selectors.
   =============================== */

@media (max-width: 700px) {

  #results-table,
  .results-table,
  #fixtures-table,
  .fixtures-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  #results-table th,
  #results-table td,
  .results-table th,
  .results-table td,
  #fixtures-table th,
  #fixtures-table td,
  .fixtures-table th,
  .fixtures-table td {
    padding: 4px 2px;
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* RESULTS TABLE: Player 1 | Score | V | Score | Player 2 */
  #results-table th:nth-child(1),
  #results-table td:nth-child(1),
  .results-table th:nth-child(1),
  .results-table td:nth-child(1),
  #results-table th:nth-child(5),
  #results-table td:nth-child(5),
  .results-table th:nth-child(5),
  .results-table td:nth-child(5) {
    width: 34%;
    max-width: 34%;
    font-size: 10.5px;
  }

  #results-table th:nth-child(2),
  #results-table td:nth-child(2),
  .results-table th:nth-child(2),
  .results-table td:nth-child(2),
  #results-table th:nth-child(4),
  #results-table td:nth-child(4),
  .results-table th:nth-child(4),
  .results-table td:nth-child(4) {
    width: 8%;
    max-width: 8%;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
  }

  #results-table th:nth-child(3),
  #results-table td:nth-child(3),
  .results-table th:nth-child(3),
  .results-table td:nth-child(3) {
    width: 5%;
    max-width: 5%;
    text-align: center;
    font-size: 10px;
    padding-left: 0;
    padding-right: 0;
  }

  /* FIXTURES TABLE: Player 1 | V | Player 2 | Status */
  #fixtures-table th:nth-child(1),
  #fixtures-table td:nth-child(1),
  .fixtures-table th:nth-child(1),
  .fixtures-table td:nth-child(1),
  #fixtures-table th:nth-child(3),
  #fixtures-table td:nth-child(3),
  .fixtures-table th:nth-child(3),
  .fixtures-table td:nth-child(3) {
    width: 39%;
    max-width: 39%;
    font-size: 10.5px;
  }

  #fixtures-table th:nth-child(2),
  #fixtures-table td:nth-child(2),
  .fixtures-table th:nth-child(2),
  .fixtures-table td:nth-child(2) {
    width: 6%;
    max-width: 6%;
    text-align: center;
    font-size: 10px;
    padding-left: 0;
    padding-right: 0;
  }

  #fixtures-table th:nth-child(4),
  #fixtures-table td:nth-child(4),
  .fixtures-table th:nth-child(4),
  .fixtures-table td:nth-child(4) {
    width: 16%;
    max-width: 16%;
    font-size: 9.5px;
    text-align: center;
  }

  /* Main league table can still scroll because it has too many columns */
  #division-table,
  .division-table {
    min-width: 600px;
  }
}

#division-table th:nth-child(2),
#division-table td:nth-child(2) {
  text-align: left;
  padding-left: 10px;
  min-width: none;
  max-width: fit-content;
}
#division-table th:nth-child(1),
#division-table td:nth-child(1) {
  text-align: center;
  padding-left: 0px;
  min-width: none;
  max-width: fit-content;
}
/* =========================
   COMPACT MOBILE MODE
========================= */

@media (max-width: 700px) {

  body {
    font-size: 12px;
  }

  .container {
    padding: 8px;
    gap: 10px;
  }

  .page-header {
    padding: 10px 8px;
    margin-bottom: 10px;
  }

  .page-header h1 {
    font-size: 34px;
    line-height: 0.9;
    margin-bottom: 4px;
  }

  .page-header p {
    font-size: 11px;
    line-height: 1.2;
  }

  .card {
    padding: 10px;
    border-radius: 14px;
    margin-bottom: 10px;
  }

  .card h2 {
    font-size: 22px;
    margin-bottom: 10px;
    letter-spacing: 1px;
  }

  .division-preview,
  .entry-row,
  .league-card-row,
  .draw-match-card,
  .remaining-opponent-row {
    padding: 8px;
    border-radius: 10px;
    min-height: unset;
  }

  .division-preview h3,
  .entry-row h3 {
    font-size: 18px;
    margin-bottom: 4px;
  }

  .division-preview p,
  .entry-row p,
  .card p,
  li {
    font-size: 11px;
    line-height: 1.3;
  }

  .league-hub-grid,
  .division-grid,
  .admin-grid {
    gap: 10px;
  }

  .entries-list,
  .draw-preview {
    gap: 8px;
  }

  .button-link {
    padding: 8px 12px;
    font-size: 13px;
    min-height: unset;
  }

  .form-row {
    margin-bottom: 10px;
  }

  .form-row label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  input,
  select {
    height: 38px;
    padding: 6px 10px;
    font-size: 13px;
  }

  .remaining-mini-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .remaining-mini-stats span {
    padding: 6px;
    font-size: 10px;
  }

  .remaining-summary-card h3 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .mini-nav {
    gap: 6px;
    margin: 10px 0;
  }

  .mini-nav a {
    font-size: 11px;
    padding: 6px 10px;
  }

  .navbar {
    min-height: 58px;
    padding: 0 10px;
  }

  .logo {
    height: 38px;
    width: auto;
  }

  .mobile-menu-toggle {
    font-size: 28px;
  }

  table {
    font-size: 10px;
  }

  th,
  td {
    padding: 4px 2px;
  }

  #division-table td:nth-child(2) {
    max-width: 82px;
    min-width: 82px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 700px) {
  .league-hub-grid {
    gap: 8px;
  }

  .division-preview {
    margin: 6px 0;
    padding: 8px;
  }

  .division-preview h3 {
    margin: 0 0 4px;
  }

  .division-preview p {
    margin: 0;
  }
}

@media (max-width: 700px) {

  .mini-nav {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    width: 100%;
  }

  .mini-nav a,
  .mini-nav .button-link {
    width: 100%;
    min-width: 0;
    padding: 7px 4px;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
  }

  .league-hub-grid,
  .division-grid,
  .rules-grid,
  .rule-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    text-size-adjust: 80%;
  }

  .division-preview {
    padding: 8px 5px;
    margin: 0;
    text-align: center;
  }

  .division-preview h3 {
    font-size: 15px;
    margin: 0 0 4px;
  }

  .division-preview p {
    font-size: 10px;
    margin: 0;
    line-height: 1.25;
  }
}

html {
  scroll-padding-top: 90px;
}

/* LEAGUE HUB COMPACT LAYOUT */

#league-hub.league-hub-grid {
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 14px;

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.league-preview-card {
  padding: 16px;
  margin: 0;
}

.league-preview-card h2 {
  font-size: 26px;
  padding: 8px;
  margin-bottom: 12px;
}

.league-preview-card .division-preview {
  padding: 14px;
  margin: 0;
}

.league-preview-card .division-preview h3 {
  font-size: 26px;
  margin-bottom: 10px;
}

.leader-label {
  font-size: 13px;
  margin-bottom: 8px;
}

.leader-player-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.leader-player-card img {
  width: 82px;
  height: 82px;
}

.leader-player-card h4 {
  font-size: 28px;
  line-height: 1;
  margin: 0 0 6px;
}

.leader-player-card p {
  font-size: 13px;
  margin: 0 0 6px;
}

.leader-mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.leader-mini-stats span {
  font-size: 12px;
  padding: 5px;
}

/* MOBILE HUB */
@media (max-width: 700px) {
  #league-hub.league-hub-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 10px;
  }

  .league-preview-card {
    padding: 12px;
  }

  .league-preview-card h2 {
    font-size: 23px;
    margin-bottom: 10px;
  }

  .league-preview-card .division-preview {
    padding: 10px;
  }

  .league-preview-card .division-preview h3 {
    font-size: 22px;
  }

  .leader-player-card {
    grid-template-columns: 62px 1fr;
    gap: 10px;
    padding: 9px;
  }

  .leader-player-card img {
    width: 58px;
    height: 58px;
  }

  .leader-player-card h4 {
    font-size: 22px;
  }

  .leader-mini-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .leader-mini-stats span {
    font-size: 10px;
    padding: 4px;
  }
}
@media (max-width: 700px) {
  .navbar {
    justify-content: flex-start;
  }

  .mobile-menu-toggle {
    order: 1;
    margin-right: auto;
    margin-left: 12px;
  }

  .logo-link {
    order: 2;
    margin-left: auto;
    margin-right: 12px;
  }
}
