/* ============================================================
   FAA — Mobile Responsive CSS
   À inclure dans toutes les pages APRÈS style.css
   <link rel="stylesheet" href="mobile.css">
   ============================================================ */

/* ══════════════════════════════════
   HAMBURGER BUTTON (injecté par JS)
══════════════════════════════════ */
.faa-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: transparent;
  z-index: 300;
  margin-left: auto;
  flex-shrink: 0;
}
.faa-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--grey, #b0b0a0);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s, background 0.2s;
  transform-origin: center;
}
.faa-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--green-bright, #2ecc40); }
.faa-hamburger.open span:nth-child(2) { opacity: 0; }
.faa-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--green-bright, #2ecc40); }

/* ══════════════════════════════════
   MOBILE NAV OVERLAY
══════════════════════════════════ */
.faa-mobile-nav {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: rgba(4, 10, 4, 0.98);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  padding: 88px 32px 40px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: opacity 0.3s, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.faa-mobile-nav.open {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

/* ── Bouton retour ── */
.faa-mobile-back {
  position: absolute;
  top: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(46,204,64,0.08);
  border: 1px solid rgba(46,204,64,0.2);
  border-radius: 100px;
  padding: 7px 16px 7px 12px;
  color: var(--green-bright, #2ecc40);
  font-family: 'Barlow', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}
.faa-mobile-back:hover { background: rgba(46,204,64,0.15); }
.faa-mobile-back-arrow {
  font-size: 1rem;
  line-height: 1;
  color: var(--green-bright, #2ecc40);
}

.faa-mobile-nav a,
.faa-mobile-nav .mob-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 3px;
  color: var(--grey, #b0b0a0);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}
.faa-mobile-nav a:hover,
.faa-mobile-nav .mob-trigger:hover { color: var(--green-bright, #2ecc40); }
.faa-mobile-nav a:first-of-type,
.faa-mobile-nav .mob-trigger:first-of-type { border-top: 1px solid rgba(255,255,255,0.06); }

.faa-mobile-nav .mob-arrow {
  font-size: 1rem;
  color: rgba(46,204,64,0.4);
  transition: transform 0.2s;
}
.faa-mobile-nav .mob-trigger.open .mob-arrow { transform: rotate(90deg); color: var(--green-bright, #2ecc40); }

/* Sous-menu mobile */
.faa-mobile-submenu {
  display: none;
  flex-direction: column;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.faa-mobile-submenu.open { display: flex; }
.faa-mobile-submenu a {
  padding: 11px 0 11px 20px;
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: none;
  color: var(--grey, #b0b0a0);
}
.faa-mobile-submenu a:first-child { border-top: none; }
.faa-mobile-submenu .div-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  color: rgba(46,204,64,0.5);
  min-width: 20px;
  display: inline-block;
}

/* Mobile nav switchers row */
.faa-mobile-nav .mob-switchers {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.faa-mobile-nav .mob-switchers .faa-theme-btn,
.faa-mobile-nav .mob-switchers .faa-lang-btn {
  transform: scale(1.1);
}

/* ══════════════════════════════════
   GLOBAL HEADER MOBILE
══════════════════════════════════ */
@media (max-width: 900px) {
  header {
    padding: 14px 20px !important;
    gap: 12px;
  }

  /* Hide desktop nav + switchers */
  header nav { display: none !important; }
  #faa-switchers { display: none !important; }

  /* Show hamburger */
  .faa-hamburger { display: flex; }
}

/* ══════════════════════════════════
   INDEX PAGE
══════════════════════════════════ */
@media (max-width: 900px) {
  .hero {
    padding: 100px 20px 60px !important;
  }
  .hero h1 {
    font-size: clamp(3rem, 14vw, 5.5rem) !important;
  }
  .hero-sub {
    font-size: 0.95rem !important;
    padding: 0 8px;
  }
  .hero-stats {
    gap: 20px !important;
    flex-wrap: wrap;
    justify-content: center;
    /* ✅ VISIBLE sur index — NE PAS mettre display:none ici */
  }
  .stat-num { font-size: 2rem !important; }

  .divisions-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .division-card { padding: 20px 16px !important; }

  .teams-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px;
  }

  section {
    padding: 48px 20px !important;
  }
  .section-title {
    font-size: 2rem !important;
    margin-bottom: 28px !important;
  }
  .resultats-grid {
    grid-template-columns: 1fr !important;
  }
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }
  select.section-select { width: 100%; }
}

@media (max-width: 480px) {
  .divisions-grid { grid-template-columns: 1fr !important; }
  .teams-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ══════════════════════════════════
   CLASSEMENT PAGE
══════════════════════════════════ */
@media (max-width: 900px) {
  .page-hero {
    padding: 100px 20px 24px !important;
  }
  .page-title {
    font-size: clamp(2.5rem, 10vw, 4rem) !important;
  }
  .filters, .selectors {
    padding: 12px 16px !important;
    gap: 8px;
  }
  .selectors {
    flex-direction: column;
    align-items: flex-start;
  }
  .selectors .sel-label { display: none; }
  .selectors select.styled-select { width: 100%; }

  .table-wrap, .legend {
    padding: 0 16px 48px !important;
  }

  /* Masquer colonnes non essentielles sur mobile */
  table thead th:nth-child(4),
  table thead th:nth-child(5),
  table thead th:nth-child(6),
  table thead th:nth-child(7),
  table thead th:nth-child(8),
  table tbody td:nth-child(4),
  table tbody td:nth-child(5),
  table tbody td:nth-child(6),
  table tbody td:nth-child(7),
  table tbody td:nth-child(8) {
    display: none;
  }

  td, th { padding: 10px 8px !important; font-size: 0.78rem !important; }
  .team-nom { font-size: 0.78rem !important; }
  .team-mini-logo { width: 26px !important; height: 26px !important; }
  .team-cell { gap: 8px !important; }
  .pts { font-size: 1.1rem !important; }
  .form-dot { width: 8px !important; height: 8px !important; }
  .legend { flex-wrap: wrap; gap: 12px !important; }
}

/* ══════════════════════════════════
   RÉSULTATS PAGE
══════════════════════════════════ */
@media (max-width: 900px) {
  .content {
    padding: 0 16px 48px !important;
  }
  .team-side-name { font-size: 0.78rem !important; }
  .score-nums { font-size: 1.4rem !important; }
  .mini-logo { width: 28px !important; height: 28px !important; }
  .journee-header { flex-wrap: wrap; gap: 6px; }
  .journee-num { font-size: 1.2rem !important; }
}

/* ══════════════════════════════════
   DIVISION PAGE
   ✅ match-card TOUJOURS horizontal
   ✅ hero-stats cachées UNIQUEMENT sur cette page
══════════════════════════════════ */
@media (max-width: 900px) {
  .page-hero {
    padding: 100px 20px 24px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px;
  }
  /* ✅ Ciblé sur .page-hero uniquement — ne cache PAS .hero-stats de l'index */
  .page-hero .hero-stats { display: none !important; }

  .page-tabs {
    padding: 0 16px !important;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .page-tabs::-webkit-scrollbar { display: none; }
  .page-tab { padding: 10px 16px !important; font-size: 0.75rem !important; }
  .section-content { padding: 20px 16px 48px !important; }
  .teams-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 10px;
  }
  .team-card { padding: 16px 8px !important; }
  .team-crest { width: 56px !important; height: 56px !important; }
  .team-name { font-size: 0.7rem !important; }
  .group-tabs { gap: 6px !important; }
  .group-tab { padding: 6px 14px !important; font-size: 0.72rem !important; }

  /* Classement dans division */
  .classement-wrap { overflow-x: auto; }
  .groupe-selector {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 0;
  }
  .groupe-selector select.styled-select { width: 100%; }
}

/* ══════════════════════════════════
   ÉQUIPE PAGE
   ⚠️  match-card vertical UNIQUEMENT
   sur la page équipe (pas division)
══════════════════════════════════ */
@media (max-width: 900px) {
  .team-hero {
    flex-direction: column !important;
    padding: 100px 20px 32px !important;
    gap: 20px !important;
  }
  .team-logo-big { width: 100px !important; height: 100px !important; }
  .team-name-title { font-size: clamp(1.8rem, 8vw, 3rem) !important; }
  .team-meta { gap: 12px !important; }
  .team-stats-row {
    gap: 8px !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 8px;
  }
  .team-stat-box { min-width: 60px !important; padding: 10px 12px !important; flex-shrink: 0; }
  .team-stat-val { font-size: 1.4rem !important; }

  .content { padding: 0 16px 48px !important; }

  .tabs-bar {
    width: 100% !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
  }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 8px 14px !important; font-size: 0.72rem !important; white-space: nowrap; }

  .players-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .player-card { padding: 12px !important; }

  .matches-list { gap: 8px !important; }
  .matches-list .match-card {
    flex-direction: row !important;
    padding: 10px 12px !important;
  }

  /* H2H */
  .h2h-bilan {
    grid-template-columns: 1fr !important;
    gap: 16px;
    text-align: center;
  }
  .h2h-scores { justify-content: center; }

  /* Forme chart */
  .chart-header { flex-direction: column !important; align-items: flex-start !important; }
  .forme-mini-stats { gap: 8px !important; }
  .fms-box { padding: 10px 12px !important; min-width: 70px; }

  /* Comparateur */
  .cmp-bar { flex-direction: column !important; align-items: flex-start !important; }
  .cmp-sel { width: 100% !important; max-width: 100% !important; }
}

/* ══════════════════════════════════
   LIGUE PAGE (toutes les équipes)
══════════════════════════════════ */
@media (max-width: 900px) {
  .page-hero { padding: 100px 16px 20px !important; }
  .quick-stats {
    padding: 0 16px 16px !important;
    gap: 8px;
  }
  .qs-card { padding: 10px 16px !important; }
  .qs-num { font-size: 1.5rem !important; }

  .filters-wrap { padding: 0 16px 20px !important; }
  .selects-row {
    flex-direction: column !important;
    gap: 10px;
  }
  .fgroup { width: 100%; }
  select.fsel { width: 100% !important; min-width: unset !important; }
  .btn-reset { width: 100%; }

  .teams-section { padding: 0 16px 48px !important; }
  .teams-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 10px;
  }
  .team-card { padding: 16px 10px !important; gap: 10px !important; }
  .team-crest { width: 56px !important; height: 56px !important; }
  .team-name { font-size: 0.7rem !important; }
}

/* ══════════════════════════════════
   AJOUTER ÉQUIPE
══════════════════════════════════ */
@media (max-width: 900px) {
  .page-wrap { padding: 100px 16px 48px !important; }
  .form-container { max-width: 100% !important; }
  .field-row { grid-template-columns: 1fr !important; }
  .page-title { font-size: 2.5rem !important; }
  .page-sub { margin-bottom: 28px !important; }
}

/* ══════════════════════════════════
   LOGIN PAGE
══════════════════════════════════ */
@media (max-width: 900px) {
  .page-wrap { padding: 100px 16px 48px !important; }
  .login-box { padding: 32px 24px !important; }
}

/* ══════════════════════════════════
   BUTEURS PAGE
══════════════════════════════════ */
@media (max-width: 900px) {
  .type-tabs, .selectors { padding: 0 16px 16px !important; }
  .type-tab { padding: 7px 14px !important; font-size: 0.72rem !important; }
  .podium {
    padding: 0 16px 24px !important;
    gap: 10px;
    justify-content: center;
  }
  .podium-card {
    min-width: 110px !important;
    padding: 16px 12px !important;
  }
  .podium-rank { font-size: 2rem !important; }
  .podium-logo { width: 48px !important; height: 48px !important; }
  .podium-name { font-size: 0.9rem !important; }
  .podium-stat { font-size: 1.6rem !important; }

  .table-wrap { padding: 0 16px 48px !important; }

  /* Masquer colonnes secondaires */
  #buteurs-table thead th:nth-child(3),
  #buteurs-table thead th:nth-child(4),
  #buteurs-table tbody td:nth-child(3),
  #buteurs-table tbody td:nth-child(4) { display: none; }

  .player-equipe { font-size: 0.65rem !important; }
}

/* ══════════════════════════════════
   ADMIN PAGE
══════════════════════════════════ */
@media (max-width: 900px) {
  .admin-wrap { flex-direction: column !important; }
  .sidebar { display: none !important; }
  .main-content { padding: 20px 16px !important; }
  .stats-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .stat-card-val { font-size: 2rem !important; }
  .pending-card {
    grid-template-columns: auto 1fr !important;
    gap: 12px;
  }
  .pending-actions {
    grid-column: 1/-1;
    justify-content: flex-end;
  }
  .match-score-row {
    gap: 6px !important;
  }
  .match-team-name { font-size: 0.78rem !important; }
  .sim-controls {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px;
  }
  .sim-controls select,
  .sim-controls input { width: 100%; }
}

/* ══════════════════════════════════
   GLOBAL SMALL FIXES
   ✅ PAS de flex-direction:column sur .match-card ici
══════════════════════════════════ */
@media (max-width: 480px) {
  .score-nums { font-size: 1.2rem !important; letter-spacing: 2px !important; }
  .team-side-name { font-size: 0.72rem !important; }
  .mini-logo { width: 24px !important; height: 24px !important; }
}

/* ══════════════════════════════════
   LIGHT THEME MOBILE NAV
══════════════════════════════════ */
[data-theme="light"] .faa-mobile-nav {
  background: rgba(240,245,240,0.98);
}
[data-theme="light"] .faa-mobile-nav a,
[data-theme="light"] .faa-mobile-nav .mob-trigger {
  color: #4a5a4a;
  border-bottom-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .faa-mobile-nav a:hover,
[data-theme="light"] .faa-mobile-nav .mob-trigger:hover { color: #1a8c28; }
[data-theme="light"] .faa-mobile-submenu a { color: #4a5a4a; }
[data-theme="light"] .faa-mobile-nav .mob-switchers { border-top-color: rgba(0,0,0,0.08); }
[data-theme="light"] .faa-hamburger span { background: #4a5a4a; }
[data-theme="light"] .faa-hamburger.open span { background: #1a8c28; }
[data-theme="light"] .faa-mobile-back {
  background: rgba(26,140,40,0.08);
  border-color: rgba(26,140,40,0.2);
  color: #1a8c28;
}

/* RTL support mobile */
[dir="rtl"] .faa-mobile-nav { transform: translateX(-100%); }
[dir="rtl"] .faa-mobile-nav.open { transform: translateX(0); }
[dir="rtl"] .faa-mobile-submenu a { padding-right: 20px; padding-left: 0; }
[dir="rtl"] .faa-mobile-back { left: auto; right: 24px; }
