/* ============================================================
   Astral Studios — Universal Request System
   Shared styles. Themed per page via --rs-* custom properties.
   ============================================================ */
:root {
  --rs-accent: #C2461C;
  --rs-accent-deep: #9E3413;
  --rs-accent-text: #ffffff;
  --rs-ink: #1a1a1a;
  --rs-muted: #777;
  --rs-paper: #ffffff;
  --rs-surface: #f4f1ec;
  --rs-line: rgba(0,0,0,0.12);
  --rs-radius: 12px;
  --rs-radius-sm: 8px;
  --rs-font: 'Hanken Grotesk', system-ui, sans-serif;
  --rs-display: 'Hanken Grotesk', system-ui, sans-serif;
  --rs-shadow: 0 24px 60px -18px rgba(0,0,0,0.4);
}

.rs-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--rs-font); font-weight: 700; font-size: 13.5px; letter-spacing: 0.01em;
  border: 1.5px solid var(--rs-accent); background: transparent; color: var(--rs-accent);
  padding: 9px 18px; border-radius: 100px; cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s, transform .12s; flex-shrink: 0;
}
.rs-add:hover { background: var(--rs-accent); color: var(--rs-accent-text); }
.rs-add:active { transform: scale(0.94); }
.rs-add.is-added { background: var(--rs-accent); color: var(--rs-accent-text); border-color: var(--rs-accent); }
.rs-add .rs-add-ic { width: 14px; height: 14px; }

/* round/compact variant for tight item rows */
.rs-add.rs-add-round { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.rs-add.rs-add-round .rs-add-label { display: none; }
.rs-add.rs-add-round .rs-add-ic { width: 18px; height: 18px; }

/* ---- sticky summary bar ---- */
.rs-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(160%);
  z-index: 1200; display: flex; align-items: center; gap: 14px;
  background: var(--rs-ink); color: #fff; padding: 11px 12px 11px 22px;
  border-radius: 100px; box-shadow: 0 18px 40px -12px rgba(0,0,0,0.5);
  font-family: var(--rs-font); transition: transform .34s cubic-bezier(.2,.9,.3,1); cursor: pointer;
  max-width: calc(100vw - 32px);
}
.rs-bar.show { transform: translateX(-50%) translateY(0); }
.rs-bar-count {
  width: 26px; height: 26px; border-radius: 50%; background: var(--rs-accent); color: var(--rs-accent-text);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.rs-bar-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.rs-bar-text .t { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.rs-bar-text .s { font-size: 11.5px; opacity: 0.62; white-space: nowrap; }
.rs-bar-go {
  display: inline-flex; align-items: center; gap: 6px; background: var(--rs-accent); color: var(--rs-accent-text);
  font-weight: 700; font-size: 13.5px; padding: 9px 16px; border-radius: 100px; white-space: nowrap;
}
.rs-bar-go svg { width: 14px; height: 14px; }
.rs-bar.bump { animation: rs-bump .3s ease; }
@keyframes rs-bump { 30% { transform: translateX(-50%) translateY(0) scale(1.05); } }

/* ---- backdrop + drawer ---- */
.rs-backdrop {
  position: fixed; inset: 0; background: rgba(15,12,10,0.5); backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .3s; z-index: 1300;
}
.rs-backdrop.show { opacity: 1; visibility: visible; }

.rs-drawer {
  position: fixed; z-index: 1400; background: var(--rs-paper); color: var(--rs-ink);
  font-family: var(--rs-font); display: flex; flex-direction: column;
  left: 0; right: 0; bottom: 0; max-height: 94vh; height: auto;
  border-radius: 22px 22px 0 0; transform: translateY(101%);
  transition: transform .4s cubic-bezier(.2,.9,.3,1); box-shadow: var(--rs-shadow);
}
.rs-drawer.show { transform: translateY(0); }
@media (min-width: 760px) {
  .rs-drawer { left: auto; top: 0; bottom: 0; width: 460px; max-height: none; height: 100%;
    border-radius: 0; transform: translateX(101%); }
  .rs-drawer.show { transform: translateX(0); }
}

.rs-grab { display: flex; justify-content: center; padding: 9px 0 2px; }
.rs-grab span { width: 40px; height: 4px; border-radius: 4px; background: var(--rs-line); }
@media (min-width: 760px) { .rs-grab { display: none; } }

.rs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px 12px; }
.rs-head .rs-title { font-family: var(--rs-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.rs-head .rs-sub { font-size: 12px; color: var(--rs-muted); margin-top: 1px; }
.rs-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rs-line); background: var(--rs-paper);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--rs-ink); flex-shrink: 0; transition: background .15s; }
.rs-close:hover { background: var(--rs-surface); }
.rs-close svg { width: 16px; height: 16px; }

/* progress */
.rs-prog { display: flex; gap: 6px; padding: 4px 22px 14px; }
.rs-prog .p { flex: 1; height: 4px; border-radius: 4px; background: var(--rs-line); transition: background .25s; }
.rs-prog .p.on { background: var(--rs-accent); }

.rs-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 22px 16px; -webkit-overflow-scrolling: touch; }
.rs-step { display: none; }
.rs-step.on { display: block; animation: rs-fade .25s ease; }
@keyframes rs-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.rs-step-label { font-family: var(--rs-display); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--rs-accent); font-weight: 700; margin-bottom: 12px; }

/* item list (step 1) */
.rs-items { display: flex; flex-direction: column; gap: 10px; }
.rs-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--rs-line); border-radius: var(--rs-radius-sm); }
.rs-item-main { flex: 1; min-width: 0; }
.rs-item-name { font-weight: 700; font-size: 14.5px; }
.rs-item-price { font-size: 12.5px; color: var(--rs-muted); margin-top: 2px; }
.rs-stepper { display: flex; align-items: center; gap: 2px; border: 1px solid var(--rs-line); border-radius: 100px; padding: 3px; }
.rs-stepper button { width: 26px; height: 26px; border: none; background: var(--rs-surface); border-radius: 50%; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--rs-ink); display: flex; align-items: center; justify-content: center; transition: background .14s; }
.rs-stepper button:hover { background: var(--rs-line); }
.rs-stepper .q { min-width: 24px; text-align: center; font-weight: 700; font-size: 14px; }
.rs-item-del { border: none; background: none; cursor: pointer; color: var(--rs-muted); padding: 4px; display: flex; }
.rs-item-del:hover { color: var(--rs-accent); }
.rs-item-del svg { width: 16px; height: 16px; }

.rs-empty { text-align: center; padding: 38px 16px; color: var(--rs-muted); }
.rs-empty .ic { width: 54px; height: 54px; border-radius: 50%; background: var(--rs-surface); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.rs-empty .ic svg { width: 24px; height: 24px; color: var(--rs-muted); }
.rs-empty p { font-size: 14.5px; line-height: 1.5; max-width: 240px; margin: 0 auto; }

.rs-subtotal { display: flex; align-items: baseline; justify-content: space-between; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rs-line); }
.rs-subtotal .l { font-size: 13px; color: var(--rs-muted); }
.rs-subtotal .v { font-family: var(--rs-display); font-size: 24px; font-weight: 700; }
.rs-note { margin-top: 10px; font-size: 12px; color: var(--rs-muted); line-height: 1.5;
  background: var(--rs-surface); border-radius: var(--rs-radius-sm); padding: 11px 13px; }

/* fields (steps 2 & 3) */
.rs-field { margin-bottom: 16px; }
.rs-field > label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 7px; }
.rs-field .opt { color: var(--rs-muted); font-weight: 500; }
.rs-field input[type=text], .rs-field input[type=tel], .rs-field input[type=email],
.rs-field input[type=number], .rs-field input[type=date], .rs-field input[type=time], .rs-field textarea, .rs-field select {
  width: 100%; font-family: var(--rs-font); font-size: 15px; color: var(--rs-ink);
  background: var(--rs-paper); border: 1.5px solid var(--rs-line); border-radius: var(--rs-radius-sm);
  padding: 12px 13px; outline: none; transition: border-color .16s; -webkit-appearance: none; appearance: none;
}
.rs-field textarea { resize: vertical; min-height: 74px; }
.rs-field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
.rs-field input:focus, .rs-field textarea:focus, .rs-field select:focus { border-color: var(--rs-accent); }
.rs-field.err input, .rs-field.err select { border-color: #d23f3f; }
.rs-field.err .rs-seg button { border-color: #d23f3f; }
.rs-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* segmented */
.rs-seg { display: flex; flex-wrap: wrap; gap: 7px; }
.rs-seg button { flex: 1; min-width: fit-content; font-family: var(--rs-font); font-weight: 600; font-size: 13.5px;
  border: 1.5px solid var(--rs-line); background: var(--rs-paper); color: var(--rs-ink);
  padding: 10px 12px; border-radius: var(--rs-radius-sm); cursor: pointer; transition: all .15s; white-space: nowrap; }
.rs-seg button:hover { border-color: var(--rs-muted); }
.rs-seg button.on { background: var(--rs-accent); border-color: var(--rs-accent); color: var(--rs-accent-text); }

/* file */
.rs-file { display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--rs-line); border-radius: var(--rs-radius-sm); padding: 13px; cursor: pointer; transition: border-color .15s; }
.rs-file:hover { border-color: var(--rs-accent); }
.rs-file input { display: none; }
.rs-file .fic { width: 34px; height: 34px; border-radius: var(--rs-radius-sm); background: var(--rs-surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rs-file .fic svg { width: 17px; height: 17px; color: var(--rs-muted); }
.rs-file .ft { font-size: 13px; } .rs-file .ft b { font-weight: 700; } .rs-file .ft span { color: var(--rs-muted); display: block; font-size: 11.5px; }

/* footer nav */
.rs-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--rs-line); background: var(--rs-paper);
  padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.rs-btn { flex: 1; font-family: var(--rs-font); font-weight: 700; font-size: 15px; padding: 14px; border-radius: var(--rs-radius-sm);
  cursor: pointer; border: none; transition: background .16s, transform .1s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.rs-btn:active { transform: scale(0.98); }
.rs-btn-primary { background: var(--rs-accent); color: var(--rs-accent-text); }
.rs-btn-primary:hover { background: var(--rs-accent-deep); }
.rs-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.rs-btn-ghost { flex: 0 0 auto; background: var(--rs-surface); color: var(--rs-ink); padding: 14px 20px; }
.rs-btn-ghost:hover { background: var(--rs-line); }
.rs-btn svg { width: 16px; height: 16px; }

/* confirmation */
.rs-confirm { display: none; text-align: center; padding: 30px 22px 10px; }
.rs-confirm.on { display: block; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation: rs-fade .3s ease; }
.rs-confirm .big { width: 66px; height: 66px; border-radius: 50%; background: var(--rs-accent); color: var(--rs-accent-text);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.rs-confirm .big svg { width: 32px; height: 32px; }
.rs-confirm h3 { font-family: var(--rs-display); font-size: 26px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }
.rs-confirm p { font-size: 15px; color: var(--rs-muted); line-height: 1.6; max-width: 320px; margin: 0 auto 8px; }
.rs-recap { text-align: left; background: var(--rs-surface); border-radius: var(--rs-radius); padding: 16px 18px; margin: 22px 0 8px; }

/* delivered-to-business indicator */
.rs-delivered { display: flex; align-items: center; gap: 12px; text-align: left; margin: 4px auto 4px; max-width: 340px;
  background: var(--rs-surface); border: 1px solid var(--rs-line); border-radius: var(--rs-radius); padding: 13px 15px; }
.rs-deliv-ics { display: flex; flex-shrink: 0; }
.rs-deliv-ics i { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; border: 2px solid var(--rs-paper); }
.rs-deliv-ics i.wa { background: #1d8a4f; }
.rs-deliv-ics i.em { background: var(--rs-accent); margin-left: -8px; }
.rs-deliv-ics i svg { width: 15px; height: 15px; }
.rs-deliv-tx { font-size: 12.5px; line-height: 1.45; color: var(--rs-ink); }
.rs-deliv-tx b { font-weight: 700; }
.rs-recap h4 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rs-muted); margin-bottom: 10px; }
.rs-recap .rl { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 4px 0; }
.rs-recap .rl span:last-child { font-weight: 700; }
.rs-preview { margin-top: 14px; }
.rs-preview summary { cursor: pointer; font-size: 13px; color: var(--rs-accent); font-weight: 700; }
.rs-preview pre { white-space: pre-wrap; font-family: 'Space Mono', ui-monospace, monospace; font-size: 11.5px; line-height: 1.55;
  background: var(--rs-surface); border-radius: var(--rs-radius-sm); padding: 14px; margin-top: 10px; color: var(--rs-ink); max-height: 30vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

body.rs-lock { overflow: hidden; }

/* touch targets — ensure 44px minimum on mobile */
@media (max-width: 760px) {
  .rs-stepper button { width: 36px; height: 36px; }
  .rs-item-del { padding: 10px; }
  .rs-add-round { width: 44px; height: 44px; }
  .rs-add-round .rs-add-ic { width: 20px; height: 20px; }
}
