/* =========================================================
   COCOANUT DASHBOARD · QR Code Dashboard (site 1 menu editor). Builds on dash.css. Phone first.
   ========================================================= */
.q-body .d-input { font-size: 16px; }                 /* 16px: phones do not zoom in when a field is tapped */
.q-lock { overflow: hidden; }
.q-main { display: grid; gap: 14px; padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
.q-ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ar { font-family: "Tajawal", var(--ui); }
.q-loading { margin: 0; padding: 60px 0; text-align: center; color: var(--muted); }
.q-error { display: grid; gap: 10px; justify-items: start; }
.q-error h3 { font-size: 24px; }
.q-error p { margin: 0; color: var(--bad); }

/* ---------- save bar ---------- */
.q-bar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px)); background: rgba(255,255,255,.97);
  border-top: 1px solid var(--mist); box-shadow: 0 -10px 28px rgba(0,41,40,.10); }
.q-state { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.q-state > div { min-width: 0; }
.q-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 4px rgba(30,122,76,.14); transition: background .2s, box-shadow .2s; }
.q-bar[data-state="dirty"] .q-dot { background: #D3841A; box-shadow: 0 0 0 4px rgba(211,132,26,.2); }
.q-bar[data-state="saving"] .q-dot { background: var(--gilt); animation: qPulse 1s ease-in-out infinite; }
.q-state b { display: block; font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.q-state small { display: block; font-size: 13px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-save { flex: none; min-height: 50px; padding: 0 22px; font-size: 15.5px; box-shadow: 0 6px 16px rgba(181,122,34,.28); }
.q-save:disabled { box-shadow: none; opacity: .5; }
.q-body .d-toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); width: max-content; max-width: calc(100vw - 32px); text-align: center; border-radius: 18px; }
@keyframes qPulse { 50% { box-shadow: 0 0 0 7px rgba(212,164,69,.25); } }

/* ---------- search ---------- */
.q-search { position: relative; }
.q-search > .q-ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.q-search .d-input { min-height: 50px; padding: 0 50px 0 46px; border-radius: 999px; }
.q-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.q-search-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; }
.q-search-x:hover { background: #F1EDE4; color: var(--ink); }

/* ---------- layout: phone = list, then one section; wide = both side by side ---------- */
.q-layout { display: grid; gap: 14px; min-width: 0; }
@media (max-width: 899px) {
  .q-layout[data-view="list"] .q-panel { display: none; }
  .q-layout[data-view="section"] .q-list { display: none; }
}

/* the sections list */
.q-list { background: #fff; border: 1px solid var(--mist); border-radius: var(--r); padding: 6px 8px 10px; min-width: 0; }
.q-group ul, .q-items { list-style: none; margin: 0; padding: 0; }
.q-group-h { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px; font-family: var(--ui); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-3); }
.q-group-h span { letter-spacing: 0; color: var(--muted); font-weight: 500; }
.q-group-h::after { content: ""; flex: 1; height: 1px; background: var(--mist); }
.q-sec { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px 8px 12px; border: 0; border-radius: 14px; background: transparent; text-align: start; color: var(--text); transition: background .15s; }
.q-sec:hover { background: #F6F3EC; }
.q-sec.on { background: var(--ink); color: #fff; }
.q-sec-t { flex: 1; min-width: 0; }
.q-sec-t b { display: block; font-size: 16px; font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.q-sec-t .ar { display: block; text-align: left; font-size: 14px; color: var(--muted); line-height: 1.35; }
.q-sec.on .ar { color: rgba(255,255,255,.72); }
.q-count { flex: none; min-width: 32px; height: 28px; padding: 0 8px; border-radius: 999px; background: #EEF3F2; color: var(--ink); font-size: 13.5px; font-weight: 600; display: grid; place-items: center; }
.q-sec.on .q-count { background: rgba(255,255,255,.16); color: #fff; }
.q-sec > .q-ic { color: var(--muted); }
.q-sec.on > .q-ic { color: var(--gold-1); }
.q-sec .d-chip { flex: none; min-height: 26px; }
.q-addsec { width: 100%; margin-top: 10px; border-style: dashed; }

/* the open section */
.q-panel { display: grid; gap: 14px; min-width: 0; align-content: start; }
.q-backlist { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 10px; border: 1px solid var(--mist); border-radius: 999px; background: #fff; color: var(--ink); font-weight: 500; }
.q-head { display: grid; gap: 0; }
.q-head-top { display: flex; align-items: flex-start; gap: 12px; }
.q-head-t { flex: 1; min-width: 0; }
.q-head-t small { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-3); }
.q-head-t h2 { font-size: 32px; margin-top: 2px; overflow-wrap: anywhere; }
.q-head-t .ar { display: block; text-align: left; font-size: 17px; color: var(--muted); margin-top: 2px; }
.q-head.off .q-head-t h2 { color: var(--muted); }
.q-more { margin-top: 14px; border-top: 1px solid var(--mist); }
.q-more summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 50px; cursor: pointer; font-weight: 500; color: var(--ink); list-style: none; }
.q-more summary::-webkit-details-marker { display: none; }
.q-more summary::after { content: ""; width: 9px; height: 9px; margin-right: 6px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.q-more[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.q-more[open] summary { margin-bottom: 4px; }
.q-grid { display: grid; gap: 12px; }
.q-order { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.q-order .q-del { grid-column: 1 / -1; }
.q-del { color: var(--bad); border-color: #EFCFCA; }
.q-del:hover { background: #FDF3F2; }

/* items */
.q-items-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 4px 2px 0; }
.q-items-h h3 { font-size: 26px; }
.q-items-h h3 span { font-family: var(--ui); font-size: 15px; font-weight: 500; color: var(--muted); }
.q-items { display: grid; gap: 8px; }
.q-item { display: flex; align-items: center; gap: 6px; padding: 8px; background: #fff; border: 1px solid var(--mist); border-radius: 16px; min-width: 0; }
.q-item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; text-align: start; color: inherit; border-radius: 12px; }
.q-thumb { width: 60px; height: 60px; flex: none; border-radius: 12px; object-fit: cover; background: #EEE8DC; transition: opacity .2s, filter .2s; }
.q-item-t { min-width: 0; display: grid; gap: 2px; }
.q-item-t b { font-size: 15.5px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-item-sub { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; }
.q-price { flex: none; font-weight: 600; color: var(--gold-3); white-space: nowrap; }
.q-badge { flex: none; padding: 1px 8px; border-radius: 999px; background: #FBF1D9; color: #7A5413; font-size: 12.5px; font-weight: 600; }
.q-item-sub .ar { min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item-sec { font-size: 13px; color: var(--muted); }
.q-item.off { background: #FAF8F3; border-style: dashed; }
.q-item.off .q-thumb { opacity: .45; filter: grayscale(1); }
.q-item.off .q-item-t b { color: var(--muted); }
.q-sw { flex: none; flex-direction: column; gap: 4px; width: 56px; padding: 4px 0; font-size: 12.5px; }
.q-sw em { font-style: normal; font-weight: 600; color: var(--ink); }
.q-sw input:not(:checked) ~ em { color: var(--muted); }
.q-edit { flex: none; width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--mist); border-radius: 50%; background: #fff; color: var(--ink); font-weight: 500; }
.q-edit span { display: none; }
.q-edit:hover, .q-backlist:hover { border-color: var(--ink); }
.q-flash { animation: qFlash 1.4s var(--ease); }
@keyframes qFlash { 0% { box-shadow: 0 0 0 3px var(--gilt); } 100% { box-shadow: 0 0 0 3px rgba(212,164,69,0); } }
@media (min-width: 600px) {
  .q-edit { width: auto; padding: 0 16px; border-radius: 999px; }
  .q-edit span { display: inline; }
  .q-grid { grid-template-columns: 1fr 1fr; }
  .q-order { display: flex; flex-wrap: wrap; }
  .q-order .q-del { margin-left: auto; }
}

/* start over */
.q-reset { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
.q-reset h3 { font-size: 24px; }
.q-reset p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
@media (max-width: 599px) { .q-reset .d-btn { width: 100%; } }

/* ---------- the item editor ---------- */
.q-sheet-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,20,19,.5); opacity: 0; transition: opacity .2s; }
.q-sheet-wrap.in { opacity: 1; }
.q-sheet { width: 100%; max-width: 680px; max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column; background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(0,20,19,.25); transform: translateY(30px); transition: transform .3s var(--ease); outline: none; }
.q-sheet-wrap.in .q-sheet { transform: none; }
.q-sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 20px; border-bottom: 1px solid var(--mist); }
.q-sheet-head h2 { flex: 1; font-size: 28px; }
.q-x { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: #F1EDE4; color: var(--ink); }
.q-x .q-ic { width: 20px; height: 20px; }
.q-sheet-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 18px 20px 22px; display: grid; gap: 16px; align-content: start; }
.q-sheet-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--mist); background: #fff; border-radius: 0 0 22px 22px; }
.q-sheet-foot .d-btn { flex: 1; min-height: 50px; font-size: 15.5px; }
.q-err { flex-basis: 100%; margin: 0; padding: 10px 14px; border-radius: 12px; background: #FBE7E5; color: var(--bad); font-weight: 500; font-size: 14.5px; }
.d-input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(179,38,30,.12); }
@media (min-width: 700px) {
  .q-sheet-wrap { align-items: center; padding: 24px; }
  .q-sheet { border-radius: 22px; max-height: calc(100vh - 48px); transform: translateY(14px) scale(.98); }
  .q-sheet-foot { justify-content: flex-end; }
  .q-sheet-foot .d-btn { flex: none; min-width: 150px; }
}

.q-photo-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; align-items: center; }
.q-photo { position: relative; width: 116px; height: 116px; border-radius: 18px; overflow: hidden; background: #EEE8DC; }
.q-photo img { width: 100%; height: 100%; object-fit: cover; }
.q-busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; background: rgba(0,41,40,.6); color: #fff; font-size: 13.5px; font-weight: 600; }
.q-busy i { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: qSpin .8s linear infinite; }
@keyframes qSpin { to { transform: rotate(360deg); } }
.q-photo-act { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.q-photo-act small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.q-file { position: relative; cursor: pointer; }
.q-file:focus-within { outline: 2px solid var(--gilt); outline-offset: 2px; }
.q-vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; opacity: 0; }

.q-fs { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.q-fs legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.q-hint { margin: -4px 0 2px; font-size: 13.5px; color: var(--muted); }
.q-fs > .d-btn { justify-self: start; }
.q-seg { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--mist); border-radius: 999px; background: #fff; }
.q-seg label { flex: 1; position: relative; }
.q-seg input { position: absolute; opacity: 0; pointer-events: none; }
.q-seg span { display: grid; place-items: center; min-height: 42px; border-radius: 999px; font-weight: 500; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.q-seg input:checked + span { background: var(--ink); color: #fff; }
.q-seg input:focus-visible + span { outline: 2px solid var(--gilt); outline-offset: 1px; }
.q-sw-row { min-height: 44px; font-size: 15px; font-weight: 500; color: var(--ink); }

.q-opts { display: grid; gap: 10px; }
.q-opts:empty { display: none; }
.q-opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--mist); border-radius: 14px; background: #FBFAF6; }
.q-opt .o-en, .q-opt .o-ar { grid-column: 1 / -1; }
.q-opt-x { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #EFCFCA; border-radius: 50%; background: #fff; color: var(--bad); }
.q-del-item { justify-self: start; margin-top: 6px; }
@media (min-width: 700px) {
  .q-opt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px auto; }
  .q-opt .o-en, .q-opt .o-ar { grid-column: auto; }
}

/* the "new section" box */
.q-form h2 { font-size: 28px; }
.q-form .q-err { flex-basis: auto; }

/* ---------- wide screens ---------- */
@media (min-width: 900px) {
  .q-main { padding-bottom: 60px; }
  .q-bar { position: sticky; top: 72px; left: auto; right: auto; bottom: auto; padding: 12px 12px 12px 20px; border: 1px solid var(--mist); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,41,40,.07); }
  .q-bar::before { content: ""; position: absolute; left: -2px; right: -2px; top: -11px; height: 11px; background: var(--page); }
  .q-body .d-toast { bottom: 24px; }
  .q-search { max-width: 560px; }
  .q-layout { grid-template-columns: 310px minmax(0, 1fr); align-items: start; gap: 20px; }
  .q-list { position: sticky; top: 162px; max-height: calc(100vh - 178px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .q-backlist { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .q-sheet, .q-sheet-wrap, .q-thumb, .q-dot, .q-sec { transition: none !important; }
  .q-flash, .q-bar[data-state="saving"] .q-dot { animation: none !important; }
  .q-busy i { animation-duration: 2.4s !important; }
}
