/* =========================
   MOBILE MENU (Drawer)
   ========================= */

/* Desktop: drawer/overlay cachés */
.mobile-drawer,
.mobile-menu-overlay { display: none; }

/* Desktop: bouton burger caché */
.menu-btn { display: none; }

@media (max-width: 768px) {
  :root{ --mustard: #f2c94c; }

  html, body { margin: 0; overflow-x: hidden; }

  /* Bouton visible uniquement mobile */
  .menu-btn{
    display: inline-flex;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    font-size: 22px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  /* Navbar top (mobile) */
  .navbar{
    position: sticky;
    top: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    background: #f2c94c;
    border-bottom: 1px solid rgba(0,0,0,.08);
  }

  /* Sur mobile: liens horizontaux cachés (dans le drawer) */
  .navbar .nav-links{ display: none !important; }

  /* Cache la sidebar admin desktop sur mobile */
  [data-admin-sidebar]{ display: none !important; }

  /* Drawer */
  .mobile-drawer{
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 86vw;
    max-width: 360px;
    background: #fff;
    z-index: 3200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: calc(14px + env(safe-area-inset-top)) 12px 14px;
    overflow-y: auto;
  }
  body.mobile-menu-open .mobile-drawer{
    transform: translateX(0);
  }

  /* Overlay */
  .mobile-menu-overlay{ display: none; }
  body.mobile-menu-open .mobile-menu-overlay{
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 3100;
  }

  body.mobile-menu-open { overflow: hidden; }

  .drawer-title{
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    color: #f2c94c;
    opacity: .65;
    margin: 6px 4px 10px;
    letter-spacing: .6px;
  }

  /* Enlever les points (puces) */
  .mobile-drawer ul,
  .mobile-drawer ol{
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .mobile-drawer li{ list-style: none !important; }

  .drawer-links{ display: block; }

  /* Style "carte" des liens */
  .drawer-links a,
  .drawer-links .side-link{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 12px;
    text-decoration: none;
    background: rgba(0,0,0,.03);
    border: 1px solid rgba(0,0,0,.08);
    margin-bottom: 8px;
    color: inherit;
  }

  /* Empêche le violet/bleu des liens visités */
  .mobile-drawer a:visited{ color: inherit !important; }

  /* Actif = texte noir + gras + indicateur moutarde (sans fond jaune) */
  .mobile-drawer a.active,
  .mobile-drawer .side-link.active{
    color: #111 !important;
    font-weight: 600 !important;
    border-color: var(--mustard) !important;
    box-shadow: inset 4px 0 0 var(--mustard) !important;
  }

  /* Si un ancien style mettait un trait via ::before */
  .mobile-drawer a.active::before,
  .mobile-drawer .side-link.active::before{
    content: none !important;
    display: none !important;
  }

  /* enlève le flash bleu au tap */
  .mobile-drawer a{ -webkit-tap-highlight-color: transparent; }
}


/* =========================
   TABLE: DÉTAILS CLIENTS
   (bouton Détails + fiche)
   ========================= */

/* Force l’affichage correct de la ligne détails */
tr.client-details { display: table-row; }
tr.client-details[hidden] { display: none !important; }

.client-details td{
  padding: 0 !important;
  border: 0 !important;
}

/* Bouton Détails */
.details-btn{
  border: 0;
  cursor: pointer;
}

/* Boîte détails */
.details-box{
  width: 100%;
  margin: 10px 0 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
  color: #111;
}

/* Item : label au-dessus, valeur en dessous */
.details-box .detail-item{
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.details-box .detail-item:last-child{ border-bottom: 0; }

.details-box .detail-label{
  display: block;
  font-size: 12px;
  font-weight: 800;
  opacity: .65;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}

.details-box .detail-value{
  display: block;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  max-width: 100%;
  color: inherit;
  opacity: 1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Au cas où un style global casse les spans */
.details-box span{
  position: static !important;
  float: none !important;
}


@media (max-width: 768px){

  /* Colonnes cachées sur mobile (clients) */
  .admin-table .col-tel,
  .admin-table .col-cree,
  .admin-table .col-avis,
  .admin-table .col-statut{
    display: none !important;
  }

  /* Actions: voir tous les boutons */
  .admin-table td.col-actions{
    white-space: normal !important;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .admin-table td.col-actions .inline-form{
    display: inline;
    margin: 0;
  }

  /* Taille texte boutons (actions) */
  .admin-table td.col-actions a,
  .admin-table td.col-actions button{
    font-size: 16px;
  }

  /* Bouton détails : texte lisible */
  .details-btn{
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
  }

  /* Bouton secondaire login (texte plus lisible) */
  .login-actions .login-btn.login-btn-secondary{
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.1;
  }

  /* Tables : scroll horizontal possible si besoin */
  .admin-table-wrap{
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}


/* =========================
   LOGS: barre swipe (en bas du tableau)
   ========================= */
@media (max-width: 768px){

  /* Le tableau des logs doit pouvoir défiler */
  #logTableWrap{
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y; /* on swipe sur la barre, pas sur le tableau */
  }

  /* Largeur mini pour déclencher le scroll */
  #logTableWrap .admin-table{
    min-width: 900px;
  }

  /* Barre de swipe */
  #logSwipeSlider{
    display: block !important;
    width: 100% !important;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.08);
    border: 1px solid rgba(0,0,0,.10);
    margin: 10px 0 6px;
    position: relative;
    overflow: hidden;
    touch-action: pan-x;
    clear: both;
    z-index: 2;
  }

  #logSwipeSlider .swipe-thumb{
    height: 100%;
    width: 44px; /* recalculé en JS */
    border-radius: 999px;
    background: rgba(0,0,0,.22); /* neutre */
    box-shadow: 0 6px 16px rgba(0,0,0,.10);
    position: absolute;
    left: 0;
    top: 0;
  }

  .swipe-hint{
    margin: 0 0 10px;
    font-size: 12px;
    color: rgba(0,0,0,.55);
  }

  @media (max-width: 768px){

  /* Le tableau doit pouvoir défiler horizontalement */
  #logTableWrap{
    overflow-x: hiden !important;
    -webkit-overflow-scrolling: touch;
  }
  #logTableWrap .admin-table{
    min-width: 900px; /* ajuste si besoin */
  }

  /* Slider natif (barre neutre, propre) */
  #logHRange.swipe-range{
    width: 100%;
    margin: 10px 0 6px;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.08);
    border: 1px solid rgba(0,0,0,.10);
  }

  #logHRange.swipe-range::-webkit-slider-thumb{
    -webkit-appearance: none;
    width: 46px;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.22);
    border: none;
  }

  #logHRange.swipe-range::-moz-range-thumb{
    width: 46px;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.22);
    border: none;
  }
}

}

@media (max-width: 768px){
  body{
    scrollbar-width: none; /* Firefox */
  }
  body::-webkit-scrollbar{
    display: none; /* Chrome/Safari */
  }
}
