/* ==========================================================================
   DEV 1.2.67 — ZONE BG / MENU COMMUN
   Source de vérité commune pour les menus bas gauche tablette.
   Modules : CAISSE / HÔTESSE / STATISTIQUES / GESTION / ADMINISTRATION.
   ========================================================================== */

@media (orientation:landscape) and (min-width:900px) {

  /* Cadre BG commun */
  body.device-tablet .ttModuleFrame > .ttZoneBG {
    --tt-bg-menu-button-max-height:calc(var(--tt-tablet-top-height) - 10px);

    box-sizing:border-box !important;
    display:flex !important;
    flex-direction:column !important;
    min-width:0 !important;
    min-height:0 !important;
    overflow:hidden !important;

    padding-left:clamp(5px,.52vw,7px) !important;
    padding-right:clamp(5px,.52vw,7px) !important;

    background:var(--tt-mep-panel-bg) !important;
    background-color:var(--tt-mep-panel-bg) !important;
    background-image:none !important;
  }

  /* Titre de zone */
  body.device-tablet .ttModuleFrame > .ttZoneBG > .sectionTitle,
  body.device-tablet .ttModuleFrame > .ttZoneBG > .statisticsSidebarTitle {
    flex:0 0 auto !important;
    margin-bottom:clamp(10px,.9vw,13px) !important;
  }

  /* Conteneur des boutons */
  body.device-tablet .ttModuleFrame > .ttZoneBG > .modeGrid,
  body.device-tablet .ttModuleFrame > .ttZoneBG > .hostessSidebar,
  body.device-tablet .ttModuleFrame > .ttZoneBG > .workspaceSidebar,
  body.device-tablet .ttModuleFrame > .ttZoneBG > .statisticsSidebar {
    box-sizing:border-box !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;

    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;

    flex:1 1 auto !important;
    min-height:0 !important;
    max-height:100% !important;

    margin:0 !important;
    padding:0 !important;
    gap:7px !important;
    overflow:hidden !important;
  }

  /* Bouton BG commun */
  body.device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton {
    box-sizing:border-box !important;

    /* DEV 1.2.67 — centrage commun obligatoire du libellé.
       Neutralise les anciens text-align:left de HÔTESSE / STATISTIQUES
       sans modifier leurs styles téléphone. */
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    text-align:center !important;

    width:100% !important;
    min-width:100% !important;
    max-width:100% !important;

    height:auto !important;
    min-height:0 !important;
    max-height:var(--tt-bg-menu-button-max-height) !important;

    flex:1 1 0 !important;
    margin:0 !important;

    padding-left:8px !important;
    padding-right:8px !important;

    border-width:1px !important;
    border-style:solid !important;
    border-radius:calc(var(--tt-tablet-radius) - 5px) !important;

    transform:none !important;
    box-shadow:none !important;
    outline:none !important;
    filter:none !important;
    text-shadow:none !important;
  }

  /* Non sélectionné = palette ← MODULES */
  body.device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton:not(.active):not(.danger) {
    background:#eaf4f8 !important;
    border-color:#9ab6c3 !important;
    color:#17445c !important;
    opacity:1 !important;
  }

  body[data-theme="dark"].device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton:not(.active):not(.danger) {
    background:#29313a !important;
    border-color:#46515d !important;
    color:#e8eef4 !important;
    opacity:1 !important;
  }

  /* Sélectionné = rendu CAISSE validé
     DEV 1.2.67 : CSS_26 est l'unique autorité tablette.
     Aucun halo, aucune ombre externe/interne, aucun scale. */
  body.device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton.active:not(.danger) {
    background:#0f6f69 !important;
    color:#ffffff !important;
    border-color:#d8fffb !important;
    opacity:1 !important;

    box-shadow:none !important;
    outline:none !important;
    filter:none !important;
    text-shadow:none !important;
    transform:none !important;
  }

  body[data-theme="dark"].device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton.active:not(.danger) {
    background:#124d4a !important;
    color:#ecfffd !important;
    border-color:#aafff6 !important;
    opacity:1 !important;

    box-shadow:none !important;
    outline:none !important;
    filter:none !important;
    text-shadow:none !important;
    transform:none !important;
  }

  /* ADMIN : sémantique DANGER conservée */
  body.device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton.danger:not(.active) {
    background:#fff7f6 !important;
    border-color:#e8b1ac !important;
    color:#8d2018 !important;
    opacity:1 !important;
  }

  body.device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton.danger.active {
    background:#fee9e6 !important;
    border-color:#ffd4cf !important;
    color:#8d2018 !important;
    opacity:1 !important;

    box-shadow:none !important;
    outline:none !important;
    filter:none !important;
    text-shadow:none !important;
    transform:none !important;
  }

  body[data-theme="dark"].device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton.danger:not(.active) {
    background:#351b1c !important;
    border-color:#71383a !important;
    color:#ffaaaa !important;
    opacity:1 !important;
  }

  body[data-theme="dark"].device-tablet .ttModuleFrame > .ttZoneBG .ttLeftMenuButton.danger.active {
    background:#4a2325 !important;
    border-color:#ffb9b3 !important;
    color:#ffd0cc !important;
    opacity:1 !important;

    box-shadow:none !important;
    outline:none !important;
    filter:none !important;
    text-shadow:none !important;
    transform:none !important;
  }
}


/* ==========================================================================
   DEV 1.2.107 — ZONE BG TÉLÉPHONE = MENU DÉROULANT COMMUN
   Règle générale validée par Alain : sur téléphone, le BG n'affiche plus une
   pile de boutons. Les boutons historiques restent présents/actifs en DOM et
   sont conservés pour la tablette ; un select compact les pilote sur téléphone.
   ========================================================================== */
.ttPhoneBgSelect {
  display:none;
}

body.device-phone {
  --tt-phone-compact-card-pad:6px;
  --tt-phone-compact-control-height:40px;
  --tt-phone-compact-control-radius:11px;
  --tt-phone-compact-control-font:10.5px;
  --tt-phone-long-menu-bg:#0f141b;
  --tt-phone-long-menu-border:#3a4655;
}

@media (max-width:700px) {
  body.device-phone .ttModuleFrame > .ttZoneBG {
    box-sizing:border-box !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    margin:0 0 8px !important;
    padding:var(--tt-phone-compact-card-pad) !important;
    overflow:visible !important;
  }

  body.device-phone .ttModuleFrame > .ttZoneBG > .sectionTitle,
  body.device-phone .ttModuleFrame > .ttZoneBG > .statisticsSidebarTitle {
    margin:0 0 5px !important;
    padding:0 1px !important;
    font-size:11px !important;
    line-height:1.1 !important;
    letter-spacing:.55px !important;
  }

  /* Les boutons restent en DOM comme source d'action, mais ne prennent plus
     de place visuelle dans le BG téléphone. */
  body.device-phone .ttModuleFrame > .ttZoneBG > .modeGrid,
  body.device-phone .ttModuleFrame > .ttZoneBG > .hostessSidebar,
  body.device-phone .ttModuleFrame > .ttZoneBG > .workspaceSidebar,
  body.device-phone .ttModuleFrame > .ttZoneBG > .statisticsSidebar {
    display:none !important;
  }

  body.device-phone .ttModuleFrame > .ttZoneBG > .ttPhoneBgSelect {
    box-sizing:border-box !important;
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    height:var(--tt-phone-compact-control-height) !important;
    min-height:var(--tt-phone-compact-control-height) !important;
    max-height:var(--tt-phone-compact-control-height) !important;
    margin:0 !important;
    padding:0 28px 0 9px !important;
    border:1px solid #3a4654 !important;
    border-radius:var(--tt-phone-compact-control-radius) !important;
    background:#202833 !important;
    color:#edf2f7 !important;
    font-family:Arial,Helvetica,sans-serif !important;
    font-size:var(--tt-phone-compact-control-font) !important;
    font-weight:900 !important;
    line-height:38px !important;
    text-align:center !important;
    text-align-last:center !important;
    white-space:nowrap !important;
    appearance:auto !important;
  }

  body.device-phone .ttModuleFrame > .ttZoneBG > .ttPhoneBgSelect option {
    background:#202833 !important;
    color:#ffffff !important;
    font-family:Arial,Helvetica,sans-serif !important;
    font-size:10.5px !important;
    font-weight:700 !important;
  }

  /* Menus déroulants contenant beaucoup de texte : conserver le rendu compact
     déjà obtenu dans STATISTIQUES, mais avec fond sombre/noir et texte blanc.
     Cette palette s'applique aussi à HÔTESSE et au nouveau menu CAISSE. */
  body.device-phone .statisticsPhoneShowMenuPanel,
  body.device-phone.module-hostess .hostessPhoneShowMenuPanel,
  body.device-phone .caissePhoneShowMenuPanel {
    background:var(--tt-phone-long-menu-bg) !important;
    border-color:var(--tt-phone-long-menu-border) !important;
    color:#ffffff !important;
  }

  body.device-phone .statisticsPhoneShowOption,
  body.device-phone.module-hostess .hostessPhoneShowOption,
  body.device-phone .caissePhoneShowOption {
    color:#ffffff !important;
  }
}
