/* User-side pages (home / reader / book / payment / reservations / notifications).
   Builds on css/base.css classes + css/theme.css variables only. */

:root {
  /* amber for admin_status 'N' pending badges (user pages) */
  --warning: #E5A63A;
}

/* ---------- badges (reservation status) ---------- */
.badge-warn    { color: var(--warning); }
.badge-confirm { color: var(--success); }
.badge-cancel  { color: var(--brand); }

/* ---------- stars (incl. fractional: outline glyph + 50% filled overlay) ---------- */
.stars { color: var(--star); letter-spacing: 1px; font-size: 13px; }
.star-h { position: relative; display: inline-block; }
.star-h .star-h-fill {
  position: absolute; left: 0; top: 0; width: 50%; overflow: hidden;
}

/* ---------- home mobile logo header (topnav is hidden < 768px) ---------- */
.home-brand { display: none; }
@media (max-width: 767.98px) {
  .home-brand {
    display: block;
    font-size: 18px; font-weight: 800; color: var(--brand);
    padding: 2px 0 10px;
  }
}

/* ---------- reader list ---------- */
.reader-card { display: block; }
.reader-photo {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-input);
  overflow: hidden;
  background: var(--surface-alt);
  margin-bottom: 12px;
}
.reader-photo img { width: 100%; height: 100%; object-fit: cover; }
.reader-photo-fallback {
  width: 100%; height: 100%; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: var(--text-muted);
  background: var(--surface-alt);
}
.reader-price { color: var(--brand); font-weight: 800; font-size: 15px; }
.reader-tagline {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* non-interactive specialty chips */
.chip-static { cursor: default; padding: 5px 12px; font-size: 12px; }

/* ---------- reader detail ---------- */
.reader-hero {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-input);
  overflow: hidden;
  background: var(--surface-alt);
}
.reader-hero img { width: 100%; height: 100%; object-fit: cover; }

.review-row { padding: 12px 0; }
.review-row + .review-row { border-top: 1px solid var(--border); }
.helpful-btn { padding: 4px 10px; }

/* ---------- booking wizard ---------- */
.mode-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  background: var(--surface-alt); color: var(--text);
  border: 1px solid var(--border-alt); border-radius: var(--radius-input);
  padding: 14px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.mode-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.mode-card.mode-static { cursor: default; }

/* month-calendar grid (booking date step) */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-head { margin-bottom: 4px; }
.cal-wd {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); padding: 4px 0;
}
.cal-title { font-size: 15px; white-space: nowrap; }
/* month nav — same circular idiom as .week-nav (pro.css) */
.cal-nav {
  flex: none; width: 36px; height: 36px; min-width: 36px; min-height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-alt); background: var(--surface-alt);
  color: var(--text-secondary); font-size: 18px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  margin: 0 8px;
}
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-cell {
  aspect-ratio: 1 / 1; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-alt); color: var(--text-body);
  border: 1px solid var(--border-alt); border-radius: var(--radius-input);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.cal-cell.cal-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell:disabled { opacity: .3; cursor: default; }
.cal-cell.today { border-color: var(--text-secondary); }
.cal-cell.selected { background: var(--brand); border-color: var(--brand); color: #fff; }

.slot-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
}
.slot-btn {
  background: var(--surface-alt); color: var(--text-body);
  border: 1px solid var(--border-alt); border-radius: var(--radius-pill);
  padding: 9px 4px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.slot-btn.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.slot-btn:disabled {
  opacity: .35; cursor: default; text-decoration: line-through;
}

/* sticky CTA at the bottom of reader/booking flows */
.cta-sticky {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px 0 4px;
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}
@media (max-width: 767.98px) {
  /* the mobile tab bar is fixed over the scrollport bottom — stick above it */
  .cta-sticky { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
}
/* Bottom clearance for pages whose LAST flow child is a .cta-sticky bar
   (booking page). The bar is in-flow, so it reserves its own height — what
   eats into the preceding card is the sticky *bottom offset*: the bar rides
   exactly that far above its flow position (tab bar + safe area on mobile;
   0 on desktop), covering the card's last lines at every scroll position.
   Reserve that same offset (plus breathing room) below the bar, mirroring
   the .cta-sticky bottom calc above — the bar height itself cancels out and
   never needs measuring. */
.page-cta-sticky { padding-bottom: 16px; }
@media (max-width: 767.98px) {
  .page-cta-sticky {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  }
}

/* fixed reserve bar (reader detail) — pinned to the viewport bottom,
   above the mobile tab bar; inner constrained to the content column */
.cta-fixed {
  position: fixed; left: 0; right: 0; z-index: 30;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.cta-fixed-inner { max-width: var(--content-max); margin: 0 auto; }
@media (min-width: 768px) {
  /* no tab bar on desktop — the bar itself absorbs the safe area */
  .cta-fixed { bottom: 0; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); }
}
/* room above the bar so the last review + "see more" are never covered */
.page-cta-fixed { padding-bottom: 88px; }

/* ---------- review dialog ---------- */
.star-pick { display: flex; gap: 6px; }
.star-pick button {
  background: none; border: 0; cursor: pointer;
  font-size: 30px; line-height: 1; color: var(--text-muted); padding: 2px;
  transition: color .12s, transform .1s;
}
.star-pick button.on { color: var(--star); }
/* half-selected star: left half gold, right half muted (0.5-step rating) */
.star-pick button.half {
  background: linear-gradient(90deg, var(--star) 50%, var(--text-muted) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.star-pick button:active { transform: scale(1.15); }

/* ---------- payment result ---------- */
.pay-result-icon {
  width: 56px; height: 56px; margin: 0 auto;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
}
.pay-ok   { background: rgba(59, 178, 115, .15); color: var(--success); }
.pay-fail { background: var(--brand-soft); color: var(--brand); }

/* ---------- notifications ---------- */
.notif-unread { border-color: var(--border-alt); }
.notif-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); margin-right: 7px; vertical-align: 2px;
}

/* ---------- My Page (shared hub + sub-pages, all roles) ---------- */
.menu-label {
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  margin: 16px 4px 6px;
}
.menu-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow: hidden;
}
.menu-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 14px 16px; color: var(--text); font-size: 14px; font-weight: 600;
  transition: background .12s;
}
.menu-row:active { background: var(--surface-alt); }
.menu-row + .menu-row { border-top: 1px solid var(--border); }
.menu-row .menu-main { flex: 1; min-width: 0; }
.menu-row .menu-sub {
  display: block; color: var(--text-secondary); font-size: 12px;
  font-weight: 400; margin-top: 2px;
}
.menu-row .chev { color: var(--text-muted); font-size: 16px; }

/* wallet / earnings ledgers */
.ledger-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.ledger-row:last-child { border-bottom: 0; }
.amt-pos { color: var(--success); font-weight: 700; white-space: nowrap; }
.amt-neg { color: var(--brand); font-weight: 700; white-space: nowrap; }

/* FAQ accordion (native <details>) */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary {
  cursor: pointer; list-style: none; padding: 14px 4px;
  font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '›'; margin-left: auto; color: var(--text-muted); transform: rotate(90deg); transition: transform .15s; }
.faq-item[open] summary::after { transform: rotate(-90deg); }
.faq-answer { padding: 0 4px 14px; color: var(--text-body); font-size: 13px; white-space: pre-wrap; }

/* long-form text (announcements, policies, inquiry bodies) */
.prose { color: var(--text-body); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

/* inquiry admin-reply block */
.inq-reply {
  margin-top: 12px; padding: 12px;
  background: var(--surface-alt); border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
}
