/* mobile.css — v2025-05-01 — contraste option C, topbar icônes, un seul panel mobile
   SBM Configurateur
   ─────────────────────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════════════════════
   DESKTOP > 900px — panel original intact, mob-panel masqué
   ════════════════════════════════════════════════════════════════════ */
@media (min-width: 901px) {
  #mob-panel  { display: none !important; }
  #panel      { display: flex !important; }
  #ptoggle    { display: none !important; }
  #app        { flex-direction: row; }
  #panel {
    position: static; transform: none !important;
    width: var(--panel-w) !important; height: auto;
    border-left: 1px solid var(--border); box-shadow: none; overflow: hidden;
  }
  #studio-panel   { width: 260px; flex-direction: column; border-left: 1px solid var(--border); padding: 14px; }
  #studio-content { flex-direction: row !important; }
  #price-popup    { display: none !important; }

  /* Desktop : icônes masquées, boutons texte visibles */
  .tbtn-icon      { display: none !important; }
  #btn-studio-mob { display: none !important; }
  .tbtn-desktop   { display: inline-flex !important; }
  #btn-studio-desktop { display: inline-flex !important; }
}

/* ════════════════════════════════════════════════════════════════════
   MOBILE ≤ 900px — topbar une ligne, boutons icônes SVG
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* Topbar : une ligne fixe */
  #topbar {
    height: var(--topbar-h) !important;
    flex-wrap: nowrap;
    padding: 0 8px !important;
    gap: 4px !important;
    overflow: hidden;
  }

  .ttitle    { font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
  .zoom-ctrl { display: none; }

  /* Masquer les boutons texte desktop */
  .tbtn-desktop       { display: none !important; }
  #btn-studio-desktop { display: none !important; }

  /* Boutons icônes SVG */
  .tbtn-icon {
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--text2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: color .15s, border-color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
  }
  .tbtn-icon:active {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--text3);
  }

  /* Bouton Studio mob — texte très court, fond accent */
  #btn-studio-mob {
    display: flex !important;
    align-items: center;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--accent); color: #000;
    border: none; border-radius: 3px;
    padding: 0 8px; height: 32px;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  /* Valider : compact */
  #btn-validate {
    font-size: 10px !important;
    padding: 5px 10px !important;
    white-space: nowrap; flex-shrink: 0;
  }

  /* Topbar compacte (commun aux deux orientations) */
  #topbar     { padding: 0 8px !important; gap: 4px !important; }
  #topbar img { height: 22px; }
  .ttitle     { font-size: 13px; }
  .tbtn       { font-size: 10px; padding: 5px 8px; white-space: nowrap; }

  /* Panel desktop masqué sur mobile */
  #panel   { display: none !important; }
  #ptoggle { display: none !important; }

  :root {
    --topbar-h:    48px;
    --mob-panel-h: 42vh;
    --mob-panel-w: 260px;
  }

  /* ─── MOB-PANEL : le panel unique ─── */
  #mob-panel {
    position: fixed;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 60;
  }

  /* ─── BARRES DE TITRE ─── */
  .mob-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 0 12px;
    height: 38px;
    border-bottom: 1px solid #333333;
    flex-shrink: 0;
    background: #242424;
  }
  .mob-bar-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: #cccccc;
    flex: 1;
  }
  .mob-back-btn {
    background: none; border: none;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 13px; font-weight: 700; letter-spacing: .5px;
    color: var(--accent); cursor: pointer; padding: 0;
    flex-shrink: 0;
  }

  /* ─── VUE CFG ─── */
  #mob-view-cfg {
    display: flex; flex-direction: column;
    flex: 1; overflow-y: auto; overflow-x: hidden;
  }
  #mob-view-cfg::-webkit-scrollbar { width: 3px; }
  #mob-view-cfg::-webkit-scrollbar-thumb { background: var(--border2); }

  .mob-sec-tog {
    padding: 8px 12px;
    border-bottom: 1px solid #2a2a2a;
    display: flex; flex-direction: column; gap: 7px;
    flex-shrink: 0;
  }
  .mob-sec-tog .tog-label { color: #e0e0e0; }
  .mob-sec-tog .tog-label .tl-sub { color: #888888; }
  .mob-sec-tog .tv-label { color: #aaaaaa; }
  .mob-fond-row {
    padding: 7px 12px;
    border-bottom: 1px solid #2a2a2a;
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
  }
  .mob-fond-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: #aaaaaa; flex-shrink: 0;
  }
  #bg-swatches-m { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

  #pricesec-m {
    padding: 6px 12px 8px;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
  }
  #dlines-m {
    margin-bottom: 4px;
  }
  #dlines-m .dline { font-size: 10px; color: #aaaaaa; }
  #dlines-m .dline .dlp { color: #888888; }
  .mob-price-row {
    display: flex; align-items: baseline; gap: 6px;
    padding-top: 5px;
    border-top: 1px solid #2a2a2a;
  }
  .mob-price-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: #aaaaaa; flex: 1;
  }
  .mob-price-hint { font-size: 12px; color: var(--accent); opacity: .7; }

  /* ─── VUE OBJ ─── */
  #mob-view-obj {
    display: none;
    flex-direction: column;
    flex: 1; overflow: hidden;
    /* display:flex est mis par JS via onSel */
  }
  .mob-obj-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 0;
  }
  .mob-obj-scroll::-webkit-scrollbar { width: 3px; }
  .mob-obj-scroll::-webkit-scrollbar-thumb { background: var(--border2); }
}

/* ════════════════════════════════════════════════════════════════════
   PORTRAIT — panel en bas, canvas occupe le reste
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) and (orientation: portrait) {

  #app { flex-direction: column; }

  /* Canvas : toute la hauteur moins le panel */
  #cw {
    height: calc(100% - var(--mob-panel-h));
    flex: none;
    min-height: 0;
  }

  /* Panel mobile : fixe en bas */
  #mob-panel {
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%;
    height: var(--mob-panel-h);
    border-top: 2px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,.45);
  }

  /* Barre titre portrait : plus compacte */
  .mob-bar { height: 34px; }
}

/* ════════════════════════════════════════════════════════════════════
   LANDSCAPE — panel à droite, canvas occupe le reste
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) and (orientation: landscape) {

  :root { --topbar-h: 44px; }

  #app { flex-direction: row; }

  /* Canvas : toute la largeur moins le panel */
  #cw {
    flex: 1 1 0;
    min-width: 0;
  }

  /* Panel mobile : fixe à droite */
  #mob-panel {
    top: var(--topbar-h); right: 0; bottom: 0; left: auto;
    width: var(--mob-panel-w);
    height: auto;
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0,0,0,.45);
    flex-shrink: 0;
  }
}

/* ════════════════════════════════════════════════════════════════════
   PETITS TÉLÉPHONES < 480px portrait
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) and (orientation: portrait) {
  :root { --mob-panel-h: 44vh; }
  .ttitle { display: none; }
  .tsep   { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   STUDIO PHOTO
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) and (orientation: portrait) {
  #studio-content { flex-direction: column !important; }
  #studio-canvas-wrap { flex: 1 1 0 !important; min-height: 0; width: 100% !important; }
  #studio-panel {
    width: 100% !important;
    border-left: none !important; border-top: 1px solid var(--border) !important;
    flex-direction: column !important; flex-wrap: nowrap !important;
    padding: 8px 10px !important; gap: 0 !important;
    overflow-y: auto; flex-shrink: 0;
    /* Hauteur auto limitée pour ne pas écraser le canvas */
    max-height: 44vh;
  }

  /* Liste objets : pleine largeur */
  #studio-group-ui {
    width: 100%;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px; margin-bottom: 8px;
  }

  /* Bouton image + symétrie : côte à côte sur une ligne */
  #studio-load-flip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
  }
  #studio-load-area  { width: 100%; }
  #studio-flip-btns  { width: 100%; }
  #studio-flip-btns .pst { display: none; }
  #studio-flip-btns > div { gap: 6px; }
  #studio-flip-btns button { flex: 1; }

  /* Contrôles masqués sur mobile portrait : actions au doigt uniquement */
  #studio-ctrl-pos,
  #studio-ctrl-zoom,
  #studio-ctrl-rot { display: none; }
}

@media (max-width: 900px) and (orientation: landscape) {
  #studio-content { flex-direction: row !important; }
  #studio-panel   { width: 220px !important; padding: 10px !important; flex-shrink: 0; }
  /* En landscape le layout vertical desktop fonctionne bien */
  #studio-load-flip { display: flex; flex-direction: column; gap: 8px; }
}

/* ════════════════════════════════════════════════════════════════════
   POPUP PRIX
   ════════════════════════════════════════════════════════════════════ */
#price-popup {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); z-index: 400;
  align-items: flex-end; justify-content: center;
}
#price-popup.open { display: flex; }
#price-popup-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 10px 10px 0 0;
  width: 100%; max-width: 480px; padding: 16px 16px 28px;
}
#price-popup-bar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
#price-popup-bar span {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text3);
}
#price-popup-bar button {
  background: none; border: 1px solid var(--border2); color: var(--text2);
  border-radius: 3px; padding: 3px 9px; font-size: 12px; cursor: pointer;
}
