/* Pack groups: size bar, on/off switch, and phone layout for the group / photo / suggestion windows. */

/* ---------- Size bar at the top of Edit Product ---------- */
.pack-bar{padding:10px 18px 12px; background:#f4f9f1; border-bottom:1px solid #dbe7d3;}
.pack-bar[hidden]{display:none;}
.pack-bar .pb-title{font-weight:700; font-size:.9rem; margin-bottom:8px; color:#173d2c;}
.pack-bar .pb-sub{font-weight:400; color:#6b7a70; font-size:.78rem;}
.pack-bar .pb-sizes{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px;}
.pack-bar .pb-size{display:flex; flex-direction:column; align-items:center; min-width:72px; padding:7px 14px; border:1.5px solid #cfdcc6; border-radius:12px; background:#fff; cursor:pointer; font:inherit; line-height:1.2;}
.pack-bar .pb-size b{font-size:.92rem;}
.pack-bar .pb-size small{color:#6b7a70; font-size:.74rem;}
.pack-bar .pb-size.is-active{border-color:#1f7a4d; background:#1f7a4d; color:#fff;}
.pack-bar .pb-size.is-active small{color:#d8f0e2;}
.pack-bar .pb-actions{display:flex; gap:8px; flex-wrap:wrap;}
.pack-bar .pb-act{border:1px solid #cfdcc6; background:#fff; border-radius:999px; padding:6px 12px; font:inherit; font-size:.8rem; cursor:pointer;}
.pack-bar .pb-act:active{background:#e8f2e1;}

/* ---------- On/off switch for "several pack sizes" ---------- */
.pk-switch-row{display:flex; gap:12px; align-items:center; font-weight:600; cursor:pointer; padding:6px 0;}
input.pk-switch{-webkit-appearance:none; appearance:none; flex:0 0 auto; width:48px; height:28px; margin:0; border-radius:999px; background:#c9cfc6; position:relative; cursor:pointer; transition:background .18s; border:0; outline:none;}
input.pk-switch::after{content:""; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .18s;}
input.pk-switch:checked{background:#1f7a4d;}
input.pk-switch:checked::after{transform:translateX(20px);}
input.pk-switch:focus-visible{box-shadow:0 0 0 3px rgba(31,122,77,.35);}

/* ---------- Phone layout (<= 640px) ---------- */
@media (max-width:640px){
  /* size bar: one scrolling row of big buttons */
  .pack-bar{padding:10px 12px;}
  .pack-bar .pb-sizes{flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; margin:0 -12px 8px; padding:0 12px 4px; scrollbar-width:none;}
  .pack-bar .pb-sizes::-webkit-scrollbar{display:none;}
  .pack-bar .pb-size{flex:0 0 auto; min-width:84px; min-height:52px;}
  .pack-bar .pb-actions{display:grid; grid-template-columns:1fr 1fr; gap:8px;}
  .pack-bar .pb-act{min-height:44px; border-radius:12px; padding:8px 6px; font-size:.78rem;}

  /* group / photos / suggested-groups windows become bottom sheets */
  #groupProductsOverlay, #photosOverlay, #suggestGroupsOverlay{padding:0; align-items:flex-end;}
  #groupProductsOverlay .modal, #photosOverlay .modal, #suggestGroupsOverlay .modal{
    width:100%; max-width:none; max-height:92vh; max-height:92dvh; border-radius:20px 20px 0 0;
    display:flex; flex-direction:column; overflow:hidden; animation:pgSheet .22s ease;
  }
  @keyframes pgSheet{from{transform:translateY(40px); opacity:.6;} to{transform:none; opacity:1;}}
  #groupProductsOverlay .modal-body, #photosOverlay .modal-body, #suggestGroupsOverlay .modal-body{
    flex:1 1 auto; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:14px 14px 18px;
  }
  #groupProductsOverlay .modal-footer, #photosOverlay .modal-footer, #suggestGroupsOverlay .modal-footer{
    position:static; flex:0 0 auto; display:flex; flex-wrap:wrap; gap:8px; padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px));
    border-top:1px solid #e6dcc2; background:#fff;
  }
  #groupProductsOverlay .modal-footer .btn, #photosOverlay .modal-footer .btn, #suggestGroupsOverlay .modal-footer .btn{flex:1 1 40%; min-height:46px; margin:0 !important; justify-content:center;}
  #groupProductsOverlay .modal-footer #groupUngroup, #suggestGroupsOverlay .modal-footer #suggestGroupsAll{flex:1 1 100%; order:-1;}

  /* 16px inputs so iOS does not zoom; bigger tap targets */
  #groupProductsOverlay input, #groupProductsOverlay select, #photosOverlay input, #modalOverlay .pack-bar button{font-size:16px;}
  #groupProductsOverlay input, #groupProductsOverlay select{min-height:44px;}
  .grp-row{padding:10px; gap:8px;}
  .grp-row .grp-thumb{width:48px; height:48px;}
  .grp-row input.grp-label, .grp-row input.grp-pq{min-height:44px; font-size:16px; flex:1 1 90px; width:auto !important;}
  .grp-row .grp-mv button, .grp-row .grp-rm{min-width:44px; min-height:44px; font-size:.95rem;}
  .grp-row .grp-mv{flex-direction:row; gap:6px;}
  .grp-sug{padding:12px;}
  .grp-sug .btn{width:100%; min-height:46px;}
  .photos-grid{grid-template-columns:repeat(3,1fr); gap:8px;}
  .photos-grid .ph button{min-width:36px; min-height:32px;}
  #photosAddLabel{display:block !important; text-align:center; min-height:46px; line-height:46px; padding:0 12px;}

  /* the switch row is a comfortable tap target */
  .pk-switch-row{padding:10px 0; font-size:.92rem;}

  /* product form on a phone: inputs never trigger zoom, tier rows stack */
  #modalOverlay .modal-body input, #modalOverlay .modal-body select, #modalOverlay .modal-body textarea{font-size:16px;}
  .tier-row{grid-template-columns:1fr 1fr; gap:8px;}
  .tier-row input{min-height:44px;}
  .tier-quick{display:flex; flex-wrap:wrap; gap:6px;}
  .tier-quick button{min-height:40px; padding:6px 12px;}
}

/* storefront-side size buttons are in product-page / index css; keep them tappable on phones */
@media (max-width:640px){
  .pack-pill, .pack-btn, .pack-chip, .pd-pack{min-height:40px; min-width:64px; padding:8px 14px;}
}
