/* ============================================================
   Bloom Room — Orders portal (orders.bloomroom.studio)
   Self-contained styles. Reuses the .sup-* component class names from the
   admin Botanikoh tab so the catalog/order render logic can be shared.
   System font stack (no webfont download) — this is an internal tool.
   ============================================================ */
:root {
  --accent: #9e2614;
  --taupe: #b79e8c;
  --text: #1a1a1a;
  --bg: #faf8f6;
  --card: #fff;
  --line: rgba(0, 0, 0, .1);
  --body-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --heading-family: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body-family);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--heading-family); font-weight: 600; }
a { color: var(--accent); }

/* ---- Layout ---- */
.ord-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1.25rem; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.ord-brand { display: flex; align-items: center; gap: .6rem; font-family: var(--heading-family); font-size: 1.05rem; font-weight: 600; color: var(--text); text-decoration: none; }
.ord-brand img { width: 30px; height: 30px; border-radius: 5px; }
.ord-user { display: flex; align-items: center; gap: .75rem; font-size: .82rem; color: var(--taupe); }
.ord-main { max-width: 760px; margin: 0 auto; padding: 1.25rem 1.25rem 5rem; }
.ord-muted { color: var(--taupe); font-weight: 400; }

/* ---- Auth gate ---- */
.ord-gate { max-width: 380px; margin: 4rem auto; text-align: center; padding: 0 1.25rem; }
.ord-gate img { width: 56px; height: 56px; border-radius: 10px; margin-bottom: 1rem; }
.ord-gate h1 { font-size: 1.4rem; margin: 0 0 .35rem; }
.ord-gate p { color: var(--taupe); margin: 0 0 1.5rem; font-size: .9rem; }
.ord-error { color: var(--accent); font-size: .85rem; margin-top: 1rem; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.2rem; border: none; border-radius: 8px; font-size: .9rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: opacity .15s, background .15s; min-height: 44px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: .9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-small { padding: .35rem .75rem; min-height: 0; font-size: .78rem; }
.btn-block { width: 100%; }

/* ---- Cards / forms ---- */
.card { background: var(--card); border-radius: 10px; padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.field { margin-bottom: .75rem; }
.field label { display: block; font-size: .78rem; font-weight: 500; color: var(--taupe); margin-bottom: .25rem; }
.field input, .field select { width: 100%; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; font-family: inherit; background: #fff; }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 150px; }
.ord-hint { margin: .35rem 0 0; font-size: .72rem; color: var(--taupe); }
.ord-empty { text-align: center; padding: 2.5rem 1rem; color: var(--taupe); }

/* ---- Repeat-last banner ---- */
.sup-repeat { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: #fff; border: 1px solid #e8e0d8; border-left: 3px solid var(--accent); border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1.25rem; }
.sup-repeat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--taupe); }
.sup-repeat-meta { font-size: .95rem; font-weight: 600; }

/* ---- Catalog search / results ---- */
.sup-view-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .75rem; }
.sup-view-hint { font-size: .72rem; color: var(--taupe); }
.sup-view-toggle { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sup-view-btn { padding: .3rem .7rem; font-size: .75rem; background: #fff; border: none; cursor: pointer; color: var(--taupe); }
.sup-view-btn + .sup-view-btn { border-left: 1px solid var(--line); }
.sup-view-btn.active { background: var(--accent); color: #fff; }
.sup-results { margin-top: .75rem; max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.sup-results:empty { display: none; }
.sup-results-hint { padding: .65rem .75rem; font-size: .78rem; color: var(--taupe); text-align: center; }
.sup-result-row { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-bottom: 1px solid rgba(0,0,0,.05); }
.sup-result-row:last-child { border-bottom: none; }
.sup-result-name { flex: 1; font-size: .88rem; min-width: 0; word-break: break-word; }
.sup-result-cat { display: inline-block; margin-left: .4rem; font-size: .68rem; color: var(--taupe); background: #f4efe9; border-radius: 4px; padding: .05rem .35rem; white-space: nowrap; }
.sup-add-btn { white-space: nowrap; }
.sup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; padding: .5rem; }
.sup-grid-cell { position: relative; display: flex; flex-direction: column; padding: 0; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; background: #fff; overflow: hidden; cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.sup-grid-cell:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.sup-grid-cell.is-added { opacity: .55; cursor: default; }
.sup-grid-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: #f4efe9; }
.sup-grid-name { font-size: .7rem; line-height: 1.2; padding: .35rem .4rem; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sup-grid-check { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .75rem; line-height: 22px; text-align: center; }
.sup-thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 8px; background: #f4efe9; }
.sup-thumb-empty { display: inline-block; }

/* Skeleton thumbnails: shimmer until the image loads. */
@keyframes sup-skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
img.sup-thumb, img.sup-grid-img { opacity: 0; transition: opacity .3s ease; background-color: #f4efe9; background-image: linear-gradient(90deg, #f1ebe3 25%, #e7ddd0 37%, #f1ebe3 63%); background-size: 200% 100%; animation: sup-skel 1.25s linear infinite; }
img.sup-thumb.is-loaded, img.sup-grid-img.is-loaded { opacity: 1; animation: none; background-image: none; }

/* ---- Order builder ---- */
.sup-order-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.sup-order-list { display: flex; flex-direction: column; gap: .4rem; }
.sup-order-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; background: #faf7f3; border-radius: 8px; }
.sup-order-name { flex: 1; min-width: 0; font-size: .88rem; word-break: break-word; }
.sup-qty { width: 76px; flex: none; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; text-align: center; }
.sup-remove { flex: none; width: 30px; height: 30px; border: none; background: none; color: var(--accent); font-size: 1.3rem; line-height: 1; cursor: pointer; border-radius: 8px; opacity: .7; }
.sup-remove:hover { opacity: 1; background: rgba(158,38,20,.08); }

/* ---- History ---- */
.ord-list { display: flex; flex-direction: column; gap: .75rem; }
.ord-card { display: flex; align-items: center; gap: .75rem; background: #fff; border: 1px solid #e8e0d8; border-radius: 10px; padding: .75rem; }
.ord-card-info { flex: 1; min-width: 0; }
.ord-card-title { font-weight: 600; font-size: .9rem; }
.ord-card-meta { font-size: .78rem; color: var(--taupe); }
.ord-card-actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.ord-card-actions .btn { min-height: 38px; }
.ord-tag { display: inline-block; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: rgba(158,38,20,.08); border-radius: 4px; padding: .02rem .35rem; }

/* ---- Sticky review CTA ---- */
.sup-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); transform: translateY(110%); transition: transform .25s ease; box-shadow: 0 -2px 12px rgba(0,0,0,.08); padding: env(safe-area-inset-bottom, 0) 0 0; }
.sup-sticky.show { transform: translateY(0); }
.sup-sticky-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.25rem; }
.sup-sticky-count { font-size: .88rem; font-weight: 600; }

/* ---- Modal ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 1.5rem; max-width: 460px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal h2 { font-size: 1.1rem; margin: 0 0 1rem; }
.modal .close-modal { position: absolute; top: .6rem; right: .9rem; background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--taupe); line-height: 1; }
.sup-review-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: .5rem; }
.sup-review-row { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding: .45rem .75rem; border-bottom: 1px solid rgba(0,0,0,.05); font-size: .88rem; }
.sup-review-row:last-child { border-bottom: none; }
.sup-review-row .qty { font-weight: 700; white-space: nowrap; }
.sup-review-total { margin-top: .6rem; font-size: .82rem; color: var(--taupe); text-align: right; }
.modal-actions { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 120px; }

/* ---- Toast ---- */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column-reverse; gap: .5rem; pointer-events: none; }
.toast { padding: .65rem 1.2rem; border-radius: 8px; font-size: .85rem; font-weight: 500; color: #fff; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: #2e7d32; }
.toast-error { background: #c62828; }

@media (max-width: 560px) {
  .ord-main { padding: 1rem 1rem 5rem; }
  /* Stack the card so actions sit below the info instead of overlapping it. */
  .ord-card { flex-direction: column; align-items: stretch; gap: .6rem; }
  .ord-card-actions { justify-content: stretch; }
  .ord-card-actions .btn { flex: 1; min-height: 44px; }
}
