/* assets/css/ddp-prefs.css
   Clean, modern & theme-proof (scoped to .ddp-pref-scope)
   - Desktop: centered modal
   - Mobile: app-like bottom sheet
   - Rows: card style + clear ✓ selected
   - Search: no injected “Q/icon”
   - iOS: prevents auto-zoom on inputs by keeping 16px
*/

.ddp-pref-scope{
  /* Palette */
  --ink:#1f242b;
  --ink-2:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --line-strong:#d1d5db;
  --bg:#ffffff;
  --bg-soft:#f9fafb;
  --overlay:rgba(15,23,42,.50);
  --radius:16px;
  --shadow:0 18px 40px rgba(15,23,42,.18), 0 2px 6px rgba(15,23,42,.06);
  --z:2147483640;
  --rowh:50px;

  /* Progress */
  --succ-1:#16a34a;
  --succ-2:#22c55e;
  --warn-1:#f59e0b;
  --warn-2:#facc15;
  --track:#e5e7eb;

  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color:var(--ink);
  isolation:isolate;

  -webkit-text-size-adjust:100%;
  text-rendering:optimizeLegibility;
}
.ddp-pref-no-scroll{overflow:hidden!important}

/* Root on top of everything */
#ddp-pref-root.ddp-pref-scope{
  position:relative;
  z-index:2147483646!important;
}

/* ---------------- iOS zoom guard ---------------- */
@supports (-webkit-touch-callout: none) {
  .ddp-pref-scope input,
  .ddp-pref-scope select,
  .ddp-pref-scope textarea{
    font-size:16px !important;
  }
}

/* ---------------- Overlay + Modal ---------------- */
.ddp-pref-scope .ddp-pref-overlay{
  position:fixed;
  inset:0;
  background:var(--overlay)!important;
  -webkit-backdrop-filter:blur(4px) saturate(120%);
  backdrop-filter:blur(4px) saturate(120%);
  z-index:2147483647!important;
}
.ddp-pref-scope .ddp-pref-overlay[hidden]{display:none!important}

.ddp-pref-scope .ddp-pref-modal{
  position:fixed;
  left:50%;
  top:clamp(14px, 7vh, 64px);
  transform:translateX(-50%);
  width:min(96vw,760px);
  max-height:88vh;

  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;

  background:var(--bg)!important;
  color:var(--ink)!important;
  border:1px solid var(--line)!important;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px 18px 14px;
  z-index:2147483647!important;

  /* app-like layout inside */
  display:flex;
  flex-direction:column;
}
.ddp-pref-scope .ddp-pref-modal[hidden]{display:none!important}

.ddp-pref-scope .ddp-head,
.ddp-pref-scope .ddp-tabs,
.ddp-pref-scope .ddp-actions{ flex:0 0 auto; }
.ddp-pref-scope .ddp-panels{ flex:1 1 auto; min-height:0; }

@media (prefers-reduced-motion:no-preference){
  .ddp-pref-scope .ddp-pref-modal{
    animation:ddp-enter .16s ease-out;
  }
  @keyframes ddp-enter{
    from{transform:translate(-50%,-6px) scale(.985);opacity:0}
    to{transform:translate(-50%,0) scale(1);opacity:1}
  }
}

/* Kill theme focus ring on modal/title */
.ddp-pref-scope .ddp-pref-modal:focus,
.ddp-pref-scope .ddp-title:focus,
.ddp-pref-scope [tabindex="-1"]:focus{
  outline:none!important;
  box-shadow:none!important;
}

/* ---------------- Header ---------------- */
.ddp-pref-scope .ddp-head{
  margin:0 0 6px;
  text-align:center;
}
.ddp-pref-scope .ddp-title{
  font-size:26px;
  line-height:1.2;
  font-weight:900;
  letter-spacing:-.015em;
  color:var(--ink)!important;
  margin:0 0 4px;
}
.ddp-pref-scope .ddp-subtitle{
  margin:0;
  font-size:13px;
  color:var(--muted)!important;
}

/* ---------------- Tabs ---------------- */
.ddp-pref-scope .ddp-tabs{
  display:flex;
  justify-content:center;
  gap:10px;
  border-bottom:1px solid var(--line)!important;
  padding:8px 0 10px;
  margin:8px 0 10px;
}
.ddp-pref-scope .ddp-tab{
  appearance:none;
  background:transparent!important;
  border:none!important;
  box-shadow:none!important;
  outline:none!important;

  padding:8px 12px;
  cursor:pointer;

  font-weight:900;
  font-size:14px;
  color:var(--ink)!important;

  position:relative;
  border-radius:999px;

  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.ddp-pref-scope .ddp-tab:hover{
  background:var(--bg-soft)!important;
}
.ddp-pref-scope .ddp-tab.is-active{
  background:#eef6ff!important;
  border:1px solid #cfe6ff!important;
}
.ddp-pref-scope .ddp-tab.is-active::after{
  content:"";
  position:absolute;
  left:14px; right:14px; bottom:-10px;
  height:2px;
  background:var(--ink)!important;
  border-radius:2px;
}

/* Kill theme button styling on tabs */
.ddp-pref-scope .ddp-tabs .ddp-tab{
  border:0!important;
  box-shadow:none!important;
  background-image:none!important;
}
.ddp-pref-scope .ddp-tabs .ddp-tab::before{content:none!important}
.ddp-pref-scope .ddp-tabs .ddp-tab[class*="button"],
.ddp-pref-scope .ddp-tabs .ddp-tab[class*="btn"]{
  border:0!important;
  box-shadow:none!important;
  background:none!important;
}

/* ---------------- Panels ---------------- */
.ddp-pref-scope .ddp-panels{position:relative}
.ddp-pref-scope .ddp-panel.is-hidden{display:none!important}
.ddp-pref-scope .ddp-panel::after{
  content:"";
  position:sticky;
  bottom:-1px;
  height:22px;
  margin-top:-22px;
  display:block;
  background:linear-gradient(to bottom, rgba(255,255,255,0) 0%, var(--bg) 85%);
  pointer-events:none;
}

/* ---------------- List (max 4 rows visible) ---------------- */
.ddp-pref-scope .ddp-list{
  list-style:none;
  margin:0;
  padding:0;

  max-height:calc(var(--rowh)*4 + 18px);
  overflow:auto;

  scrollbar-gutter:stable;
  scrollbar-width:none!important;
  -ms-overflow-style:none;
}
.ddp-pref-scope .ddp-list::-webkit-scrollbar{
  width:0!important;
  height:0!important;
}

/* ---------------- Items (card rows) ---------------- */
.ddp-pref-scope .ddp-item{
  position:relative;
  padding:8px 0;
  border:0!important;
}
.ddp-pref-scope .ddp-item:first-child{
  padding-top:6px;
}
.ddp-pref-scope .ddp-item:last-child{
  padding-bottom:6px;
}

/* ---------------- Row layout (card) ---------------- */
.ddp-pref-scope .ddp-item .ddp-row{
  display:flex;
  align-items:center;
  gap:10px;
  position:relative;

  padding:12px 44px 12px 14px; /* right space for ✓ bubble */
  min-height:var(--rowh);

  border:1px solid var(--line)!important;
  border-radius:14px;
  background:var(--bg)!important;

  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;

  transition:transform .05s ease, border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.ddp-pref-scope .ddp-item .ddp-row:hover{
  background:var(--bg-soft)!important;
  border-color:var(--line-strong)!important;
}
.ddp-pref-scope .ddp-item .ddp-row:active{ transform:scale(.99); }

.ddp-pref-scope .ddp-item .ddp-name{
  font-weight:900;
  font-size:15px;
  color:var(--ink)!important;
}
.ddp-pref-scope .ddp-item .ddp-meta{
  margin-left:auto;
  font-size:12.5px;
  color:var(--muted)!important;
  white-space:nowrap;
}
.ddp-pref-scope .ddp-item .ddp-meta strong{
  font-weight:900;
  color:var(--ink-2)!important;
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  background:var(--bg-soft)!important;
  border:1px solid var(--line)!important;
}

/* ---------------- Radios (hidden input + strong selected) ---------------- */
.ddp-pref-scope .ddp-item input[type="radio"]{
  position:absolute;
  left:-9999px;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}

/* Selected row */
.ddp-pref-scope .ddp-item input[type="radio"]:checked + .ddp-row{
  border-color:var(--ink)!important;
  background:#eef6ff!important;
  box-shadow:0 8px 18px rgba(15,23,42,.10);
}
.ddp-pref-scope .ddp-item input[type="radio"]:checked + .ddp-row::after{
  content:"✓";
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  width:26px;
  height:26px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--ink)!important;
  color:#fff!important;
  font-weight:900;
  font-size:14px;
}

/* Focus */
.ddp-pref-scope .ddp-item input[type="radio"]:focus-visible + .ddp-row{
  outline:2px solid var(--ink)!important;
  outline-offset:2px;
}

/* ---------------- Pickup open/closed badge ---------------- */
.ddp-pref-scope .ddp-badge{
  border:1px solid var(--ink)!important;
  border-radius:999px;
  padding:2px 8px;
  font-size:10.5px;
  font-weight:900;
  margin-right:6px;
  line-height:1.1;
}
.ddp-pref-scope .ddp-badge.ok{
  background:var(--ink)!important;
  color:#fff!important;
}
.ddp-pref-scope .ddp-badge.no{
  background:#fff!important;
  color:var(--ink)!important;
}

/* ---------------- SEARCH (clean, no stray Q/icon) ---------------- */
.ddp-pref-scope .ddp-search-row{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:10px 0 12px;
}
.ddp-pref-scope .ddp-search-label{
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--muted)!important;
}

.ddp-pref-scope .ddp-search-input-wrap{
  position:relative!important;
  border-radius:999px;
  border:1px solid var(--line)!important;
  background:#f9fafb!important;
  overflow:hidden;
}

/* kill theme pseudo/icons on wrap + input */
.ddp-pref-scope .ddp-search-input-wrap::before,
.ddp-pref-scope .ddp-search-input-wrap::after,
.ddp-pref-scope .ddp-search-input::before,
.ddp-pref-scope .ddp-search-input::after{
  content:none!important;
}

.ddp-pref-scope .ddp-search-input{
  width:100%;
  border:0!important;
  background:transparent!important;
  background-image:none!important;
  box-shadow:none!important;

  padding:10px 14px;
  font-size:16px; /* iOS zoom-safe */
  line-height:1.25;
  color:var(--ink)!important;

  outline:none!important;
  appearance:none;
  -webkit-appearance:none;
}
.ddp-pref-scope .ddp-search-input::placeholder{
  color:#94a3b8;
}
.ddp-pref-scope .ddp-search-input:focus{
  background:#fff!important;
}

/* remove iOS search decorations */
.ddp-pref-scope .ddp-search-input::-webkit-search-decoration,
.ddp-pref-scope .ddp-search-input::-webkit-search-cancel-button,
.ddp-pref-scope .ddp-search-input::-webkit-search-results-button,
.ddp-pref-scope .ddp-search-input::-webkit-search-results-decoration{
  display:none!important;
}

/* If your theme injects icons via classes */
.ddp-pref-scope .ddp-search-icon{ display:none!important; }

/* ---------------- Actions ---------------- */
.ddp-pref-scope .ddp-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:12px;
}
.ddp-pref-scope .ddp-btn{
  appearance:none!important;
  border-radius:12px;
  padding:10px 16px;
  font-weight:900;
  cursor:pointer;

  border:1px solid var(--ink)!important;
  background:var(--ink)!important;
  color:#fff!important;

  transition:transform .06s ease, background-color .12s ease, border-color .12s ease, opacity .12s ease;
  font-size:13px;

  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.ddp-pref-scope .ddp-btn:hover{
  transform:translateY(-1px);
  background:var(--ink-2)!important;
  border-color:var(--ink-2)!important;
}
.ddp-pref-scope .ddp-btn.ghost{
  background:#fff!important;
  color:var(--ink)!important;
  border-color:var(--line-strong)!important;
}
.ddp-pref-scope .ddp-btn.ghost:hover{
  border-color:var(--ink)!important;
}
.ddp-pref-scope .ddp-btn[disabled],
.ddp-pref-scope .ddp-btn[aria-disabled="true"]{
  opacity:.45;
  cursor:not-allowed;
  transform:none!important;
}

/* ---------------- FAB (FINAL — professional, responsive, no overlap) ---------------- */

.ddp-pref-scope{
  /* reserve space for right cart FAB (adaptive across phones) */
  --ddp-cart-fab-space: clamp(96px, 22vw, 140px);
  --ddp-fab-edge: 12px;
}

/* Base FAB */
.ddp-pref-scope .ddp-pref-fab{
  position:fixed;
  left:16px;
  bottom:16px;

  display:inline-flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;

  padding:10px 12px 12px;
  border-radius:14px;

  background:var(--bg)!important;
  color:var(--ink)!important;
  border:1px solid var(--line)!important;
  box-shadow:0 12px 24px rgba(15,23,42,.14), 0 1px 3px rgba(15,23,42,.06);

  cursor:pointer;
  z-index:var(--z)!important;

  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;

  /* desktop defaults */
  min-width:220px;
  max-width:min(92vw,360px);

  text-align:left !important;
}

.ddp-pref-scope .ddp-pref-fab:hover{
  background:#fff!important;
  border-color:var(--line-strong)!important;
}
.ddp-pref-scope .ddp-pref-fab:focus-visible{
  outline:2px solid var(--ink)!important;
  outline-offset:2px;
}

/* FAB content */
.ddp-pref-scope .ddp-fab-card .ddp-fab-line{
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  gap:10px;
  width:100%;
  flex-wrap:nowrap;  /* keep Change on right */
  padding-bottom:4px;
}

.ddp-pref-scope .ddp-fab-card .ddp-fab-mode{
  font-weight:950;
  font-size:14px;
  flex:1 1 auto;
  min-width:0;
  text-align:left !important;

  /* allow neat 2-line wrap (no ugly cropping) */
  white-space:normal;
  overflow:hidden;

  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

.ddp-pref-scope .ddp-fab-card .ddp-fab-edit{
  margin-left:auto;
  flex:0 0 auto;

  font-size:11px;
  font-weight:900;
  color:var(--ink)!important;
  border:1px solid var(--line-strong)!important;
  background:#fff!important;
  padding:3px 8px;
  border-radius:999px;
  line-height:1;
  align-self:flex-start;
}
.ddp-pref-scope .ddp-fab-card .ddp-fab-edit:hover{
  border-color:var(--ink)!important;
}

/* Subline: allow 2 lines */
.ddp-pref-scope .ddp-fab-sub{
  font-size:11.5px;
  color:var(--muted)!important;
  line-height:1.25;
  margin-bottom:6px;

  text-align:left !important;
  white-space:normal;
  overflow:hidden;

  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

/* Progress bar */
.ddp-pref-scope .ddp-fab-progress{
  position:relative;
  width:100%;
  height:8px;
  background:var(--track)!important;
  border-radius:999px;
  overflow:hidden;
}
.ddp-pref-scope .ddp-fab-progress[hidden]{display:none!important}
.ddp-pref-scope .ddp-fab-bar{
  position:absolute;
  inset:0 auto 0 0;
  width:0%;
  border-radius:999px;
  transition:width .28s ease;
}

/* Shimmer while loading */
.ddp-pref-scope .ddp-fab-progress.is-loading .ddp-fab-bar{
  background-image:linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.35) 50%, rgba(255,255,255,.35) 75%, transparent 75%, transparent);
  background-size:16px 16px;
  animation:ddp-bar-stripes .8s linear infinite;
}
@keyframes ddp-bar-stripes{
  from{background-position:0 0}
  to{background-position:16px 0}
}

/* Pending = amber; Complete = green */
.ddp-pref-scope .ddp-fab-progress.is-pending .ddp-fab-bar{
  background:linear-gradient(90deg,var(--warn-1) 0%,var(--warn-2) 100%)!important;
}
.ddp-pref-scope .ddp-fab-progress.is-complete .ddp-fab-bar{
  background:linear-gradient(90deg,var(--succ-1) 0%,var(--succ-2) 100%)!important;
}
.ddp-pref-scope .ddp-fab-progress-text{
  font-size:11.5px;
  margin-top:7px;
  color:var(--muted)!important;
  display:inline-block;
  text-align:left !important;
}

/* ---------------- Mobile sizing: wide & professional but never overlaps cart FAB ---------------- */
@media (max-width: 900px){
  .ddp-pref-scope .ddp-pref-fab{
    left: max(var(--ddp-fab-edge), env(safe-area-inset-left, 0px)) !important;
    min-width:0 !important;

    /* cap so it will not go under the cart FAB */
    max-width: calc(
      100vw
      - max(var(--ddp-fab-edge), env(safe-area-inset-left, 0px))
      - max(var(--ddp-fab-edge), env(safe-area-inset-right, 0px))
      - var(--ddp-cart-fab-space)
    ) !important;

    /* preferred nice width, but respects max-width above */
    width: min(
      clamp(260px, 72vw, 380px),
      calc(
        100vw
        - max(var(--ddp-fab-edge), env(safe-area-inset-left, 0px))
        - max(var(--ddp-fab-edge), env(safe-area-inset-right, 0px))
        - var(--ddp-cart-fab-space)
      )
    ) !important;

    overflow: visible !important;
  }
}

/* Extra small phones */
@media (max-width: 380px){
  .ddp-pref-scope{
    --ddp-cart-fab-space: clamp(92px, 24vw, 130px);
  }
  .ddp-pref-scope .ddp-pref-fab{
    padding:10px 10px 12px;
  }
}

/* ---------------- Generic focus ---------------- */
.ddp-pref-scope .ddp-tab:focus-visible,
.ddp-pref-scope .ddp-btn:focus-visible{
  outline:2px solid var(--ink)!important;
  outline-offset:2px;
}

/* ---------------- Mobile tweaks ---------------- */
@media (max-width:768px){
  .ddp-pref-scope .ddp-pref-modal{
    width:min(96vw,720px);
    padding:16px;
    margin-bottom:env(safe-area-inset-bottom);
  }
}

@media (max-width:640px){
  /* Bottom-sheet modal (mobile only) */
  .ddp-pref-scope .ddp-pref-modal{
    left:0;
    right:0;
    bottom:0;
    top:auto;
    transform:none;

    width:100vw;
    max-height:92vh;

    border-radius:22px 22px 0 0;
    padding:16px 14px calc(14px + env(safe-area-inset-bottom));

    border-left:0!important;
    border-right:0!important;
    border-bottom:0!important;
  }

  .ddp-pref-scope .ddp-title{font-size:22px}
  .ddp-pref-scope .ddp-subtitle{font-size:12px}

  /* Tabs sticky like app */
  .ddp-pref-scope .ddp-tabs{
    position:sticky;
    top:0;
    z-index:3;
    background:var(--bg)!important;
    padding-top:6px;
  }

  /* Row: compact + meta wraps */
  .ddp-pref-scope .ddp-item .ddp-row{
    align-items:flex-start;
    flex-wrap:wrap;
    padding:12px 44px 12px 12px;
    min-height:auto;
  }
  .ddp-pref-scope .ddp-item .ddp-name{font-size:14px}
  .ddp-pref-scope .ddp-item .ddp-meta{
    margin-left:0;
    flex-basis:100%;
    white-space:normal;
    margin-top:4px;
    font-size:11px;
    line-height:1.35;
    text-align:left;
  }

  /* Buttons: full width on mobile (NOT sticky bottom) */
  .ddp-pref-scope .ddp-actions{
    justify-content:stretch;
    gap:10px;
  }
  .ddp-pref-scope .ddp-actions .ddp-btn{
    width:100%;
    text-align:center;
  }
}

@media (max-width:640px) and (prefers-reduced-motion:no-preference){
  .ddp-pref-scope .ddp-pref-modal{ animation:ddp-sheet .18s ease-out; }
  @keyframes ddp-sheet{
    from{transform:translateY(18px);opacity:0}
    to{transform:translateY(0);opacity:1}
  }
}

@media (max-width:380px){
  .ddp-pref-scope .ddp-title{font-size:21px}
}