/* ============================================================
MOBILE — SpycySite v2
Adapté à toutes les pages : collection, ouverture, admin, home
============================================================ */

@media (max-width: 768px) {
  /* ── Auth bar ─────────────────────────────────────────────── */
  #authBar {
    top: 8px;
    right: 8px;
  }
  .btn-twitch {
    padding: 8px 12px;
    font-size: 12px;
  }
  .glass-pill {
    padding: 3px 10px 3px 4px;
  }
  #userName {
    font-size: 12px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .avatar {
    width: 26px;
    height: 26px;
  }

  /* ── Navigation → barre basse fixe ───────────────────────── */
  /* Layout : [ Cartes | Ouvrir ]  [ 🌶️ ]  [ Proba | Admin ] */
  .col-left {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: 60px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px !important;
    border-right: none;
    border-top: 1px solid var(--glass-border);
    z-index: 200;
    background: rgba(12, 8, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: visible;
    gap: 0;
  }

  /* Logo au centre via order CSS */
  .nav-home {
    order: 2;
    width: 48px;
    height: 48px;
    min-width: 48px;
    flex-shrink: 0;
    margin: 0;
    border-radius: 50%;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-home img,
  .nav-home span {
    width: 28px;
    height: 28px;
  }

  /* Groupe Cartes → à gauche du logo */
  .nav-group:nth-of-type(1) {
    order: 1;
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  /* Groupe Admin → à droite du logo */
  .nav-group:nth-of-type(2) {
    order: 3;
    flex: 1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end; /* Colle les boutons vers le logo */
    padding-left: 4px;
    gap: 0;
  }

  /* Cache les séparateurs et labels de groupe */
  .nav-divider {
    display: none;
  }
  .nav-group-label {
    display: none;
  }
  .nav-text {
    display: none;
  } /* Icônes uniquement sur mobile */

  /* Chaque bouton nav : carré centré */
  .nav-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 12px;
    border-color: transparent;
    position: relative;
  }

  .nav-btn.active {
    background: var(--pink-glass);
    border-color: transparent;
  }

  .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
  }

  .nav-icon svg {
    width: 22px;
    height: 22px;
  }

  /* Badge de packs positionné sur le bouton */
  .pack-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    padding: 0 3px;
  }

  /* Groupe admin en ligne dans la barre */
  #adminNavGroup {
    display: none !important;
    flex-direction: row;
    align-items: center;
  }

  /* ── Contenu principal ────────────────────────────────────── */
  /* Padding bas pour ne pas être caché par la nav */
  .col-right {
    height: auto;
    min-height: 100vh;
    padding-bottom: 80px;
  }

  .mainScreenContainer {
    padding: 12px 12px;
  }

  /* ── En-têtes de page ─────────────────────────────────────── */
  .page-header {
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-title {
    font-size: 20px;
  }
  .page-subtitle {
    font-size: 12px;
  }

  /* ── Page d'accueil ───────────────────────────────────────── */
  .home-hero {
    padding: 40px 0 20px;
  }
  .home-hero h1 {
    font-size: 26px;
  }
  .home-hero .sub {
    font-size: 14px;
  }

  /* Stream : player + chat empilés verticalement */
  .stream-section {
    flex-direction: column;
    gap: 8px;
  }

  .stream-video-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .stream-chat-wrapper {
    width: 100%;
    height: 220px;
    display: none;
  }

  /* Cards info */
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .info-card {
    padding: 16px 12px;
  }
  .info-card .ico {
    font-size: 28px;
  }
  .info-card h3 {
    font-size: 13px;
  }

  /* Réseaux sociaux */
  .reseaux {
    gap: 10px;
  }
  .rsn-btn {
    width: 40px;
    height: 40px;
  }

  /* ── Collection ───────────────────────────────────────────── */
  /* Grille de slots : 2 colonnes sur mobile */
  .cards-grid-slots {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Les slots ont des textes légèrement plus petits */
  .slot-info {
    padding: 6px 8px 2px;
  }
  .card-name {
    font-size: 11px;
  }
  .card-scoville {
    font-size: 10px;
  }

  /* Les 4 boutons de couleur restent visibles */
  .slot-ver-btns {
    padding: 4px 8px 8px;
    gap: 4px;
  }
  .ver-btn {
    width: 14px;
    height: 14px;
  }

  /* Modal : plein écran en bas sur mobile */
  /* .card-modal-overlay {
    align-items: flex-end;
  }
  
  .card-modal-inner {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 20px 20px 32px;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
  }
  
  .modal-visual {
    width: 120px;
    flex-shrink: 0;
    border-radius: 10px;
  }
  
  .modal-info {
    flex: 1;
  }
  .modal-name {
    font-size: 16px;
  }
  .modal-scoville {
    font-size: 13px;
  }
  .modal-desc {
    font-size: 12px;
  } */

  /* ── Ouverture de packs ───────────────────────────────────── */
  .pack-stage {
    gap: 12px;
    padding: 12px 0 16px;
    min-height: auto;
    height: auto;
    justify-content: flex-start; /* Part du haut, évite le centrage qui coupe */
  }

  /* Le pack cliquable moins haut */
  .pack-big {
    height: 320px;
  }

  /* La pile de cartes s'adapte à l'écran */
  .card-stack-wrapper {
    /* 100dvh = hauteur réelle de l'écran sans la barre navigateur */
    /* - 60px nav basse, - 80px infos carte, - 50px compteur, - 30px padding */
    height: calc(100dvh - 220px);
    max-height: 420px; /* Plafond sur grands écrans */
    min-height: 200px; /* Plancher sur très petits */
  }

  /* Compteur de cartes restantes */
  .stack-counter {
    font-size: 13px;
  }

  /* Miniatures révélées plus petites */
  .revealed-row {
    gap: 6px;
    max-width: 100%;
    padding: 0 8px;
  }
  .revealed-mini .mini-info {
    padding: 4px 5px;
    font-size: 9px;
  }
  .revealed-mini .mini-name {
    font-size: 9px;
  }
  .revealed-mini .mini-ver {
    font-size: 9px;
  }

  /* ── Probabilités ─────────────────────────────────────────── */
  .proba-table th {
    padding: 10px 10px;
    font-size: 10px;
  }
  .proba-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  .proba-bar-bg {
    width: 80px;
  }

  /* ── Admin Stats ──────────────────────────────────────────── */
  /* Les 3 blocs de stats en colonne sur mobile */
  #statsContent > div:first-child {
    grid-template-columns: 1fr !important;
  }

  .stat-block {
    padding: 18px 16px;
  }
  .stat-block-value {
    font-size: 18px;
  }

  /* ── Admin Collection ─────────────────────────────────────── */
  /* L'input de recherche prend toute la largeur */
  #adminSearchInput {
    font-size: 16px;
  } /* 16px évite le zoom auto sur iOS */

  /* Les suggestions chips passent en grille */
  #adminSuggestions {
    gap: 6px;
  }

  .suggestion-chip {
    font-size: 12px;
    padding: 6px 12px;
  }

  /* ── Boutons génériques ───────────────────────────────────── */
  .btn-pink {
    padding: 10px 20px;
    font-size: 13px;
  }
  .btn-outline {
    padding: 9px 16px;
    font-size: 12px;
  }

  .pack-click-label {
    position: absolute;
    bottom: 16vh !important;
  }

  .pack-number-left {
    bottom: 12vh !important;
  }

  .card-modal-inner {
    width: 350px;
  }
}

/* Samsung Galaxy S21 et écrans similaires (360px de large) */
@media (max-width: 420px) {
  .pack-stage {
    min-height: auto;
    height: calc(100dvh - 60px); /* hauteur réelle moins la nav */
    justify-content: flex-start;
    padding-top: 12px;
    overflow-y: auto;
  }

  /* Carte plus petite pour laisser de la place au compteur + miniatures */
  .card-stack-wrapper {
    height: min(52vh, 300px);
  }

  .pack-big {
    height: calc(100dvh - 160px);
    max-height: 460px;
  }
}

/* ── Très petits écrans (iPhone SE, etc.) ─────────────────── */
@media (max-width: 390px) {
  .home-hero h1 {
    font-size: 22px;
  }

  /* 2 colonnes serrées */
  .cards-grid-slots {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .ver-btn {
    width: 12px;
    height: 12px;
  }

  /* Pack plus petit */
  .pack-big {
    height: 260px;
  }

  .card-stack-wrapper {
    height: min(38vh, 280px);
  }

  /* Modal en colonne sur très petit écran */
  .card-modal-inner {
    width: 350px;
  }
  /*
  .modal-visual {
    width: 100px;
  } */

  /* Nav encore plus compacte */
  .nav-btn {
    padding: 4px 6px;
  }
  .nav-text {
    display: none;
  } /* Cache les textes sur très petit écran */

  /* Miniatures révélées — taille adaptée mobile */
  .revealed-row {
    gap: 8px;
    max-width: 100%;
    padding: 0 8px;
    justify-content: center;
  }

  /* Pendant la révélation : 5 cartes côte à côte */
  .revealed-mini {
    width: min(17vw, 90px) !important; /* Override le min(10vw) du JS */
  }

  /* Quand tout est révélé : 2-3 cartes plus grandes par ligne */
  .revealed-row[style*="14px"] .revealed-mini {
    width: min(40vw, 160px) !important; /* Override le min(18vw) du JS */
  }

  .revealed-mini .mini-info {
    padding: 4px 5px;
    font-size: 9px;
  }
  .revealed-mini .mini-name {
    font-size: 9px;
  }
  .revealed-mini .mini-ver {
    font-size: 9px;
  }

  .pack-click-label {
    position: absolute;
    bottom: 16vh !important;
  }

  .pack-number-left {
    bottom: 12vh !important;
  }
}
