/* === Books reservation === */
.pickup-tag { font-family: var(--font-mono); font-weight: 600; font-size: .68rem; letter-spacing: .14em; color: var(--text-muted); text-transform: uppercase; white-space: nowrap; }

.book-rows { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.book-row {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  transition: border-color .2s;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.book-row:hover { border-color: var(--line-strong); }
@media (prefers-reduced-motion: reduce) { .book-row { transition: none; } }

.book-thumb { width: 58px; height: 80px; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-elev-2); flex: none; }
.book-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-ph { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: .94rem; background: var(--bg-elev-2); }
.book-ph.tint-brand { background: radial-gradient(circle at 50% 30%, var(--brand-soft-2), var(--bg-elev-2) 80%); }
.book-ph.tint-mod   { background: radial-gradient(circle at 50% 30%, rgba(91,167,255,.22), var(--bg-elev-2) 80%); }
.book-ph.tint-warn  { background: radial-gradient(circle at 50% 30%, rgba(255,181,71,.22), var(--bg-elev-2) 80%); }

.book-row-main { flex: 1; min-width: 0; }
.book-title-row { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.year-cap { font-family: var(--font-mono); font-weight: 600; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--text-dim); padding: 3px 9px; border-radius: 999px; }
.book-row-sub { color: var(--text-dim); font-size: .82rem; margin-top: 4px; }
.stock-ok   { color: var(--easy); font-weight: 600; }
.stock-low  { color: var(--warn); font-weight: 600; }
.stock-out  { color: var(--hard); font-weight: 600; }

.book-price { font-family: var(--font-mono); font-weight: 600; font-size: .92rem; width: 96px; text-align: right; flex: none; }

.btn-add { cursor: pointer; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 18px; font-weight: 600; font-size: .8rem; background: var(--bg-elev-2); color: var(--text); width: 92px; flex: none; transition: background .15s, color .15s, border-color .15s; }
.btn-add:active { transform: translateY(1px); }
.btn-add.added { background: var(--accent-soft); color: var(--accent-text); border-color: rgba(199,255,61,.3); }
.btn-add[disabled] { background: var(--bg-elev-2); color: var(--text-muted); border-color: var(--line); cursor: default; }
@media (prefers-reduced-motion: reduce) { .btn-add { transition: none; } }

.qty-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--bg-elev-2); flex: none; min-width: 92px; }
.qty-stepper--compact { min-width: 0; }
.qty-btn { cursor: pointer; border: none; background: transparent; color: var(--text); width: 30px; height: 34px; font-size: 1rem; line-height: 1; padding: 0; transition: background .15s, color .15s; }
.qty-btn:hover:not([disabled]) { background: var(--bg-elev-1); }
.qty-btn[disabled] { color: var(--text-muted); cursor: default; }
.qty-val { font-family: var(--font-mono); font-weight: 600; font-size: .85rem; min-width: 22px; text-align: center; }
.qty-static { font-family: var(--font-mono); font-weight: 600; font-size: .76rem; color: var(--text-dim); }
@media (prefers-reduced-motion: reduce) { .qty-btn { transition: none; } }

.res-panel { border-radius: var(--r-xl); padding: 24px; position: sticky; top: 20px; }
.res-eyebrow { font-family: var(--font-mono); font-weight: 600; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.res-items { display: flex; flex-direction: column; gap: 10px; }
.res-item { display: flex; align-items: center; gap: 12px; background: var(--bg-elev-2); border-radius: var(--r-md); padding: 10px 12px; }
.res-item .code { font-family: var(--font-display); font-weight: 700; font-size: .88rem; width: 44px; }
.res-item .yr { color: var(--text-dim); font-size: .76rem; flex: 1; }
.res-item .p { font-family: var(--font-mono); font-weight: 600; font-size: .82rem; }
.res-item .x { cursor: pointer; border: none; background: none; color: var(--text-muted); font-size: .95rem; padding: 2px 4px; transition: color .15s; }
.res-item .x:hover { color: var(--hard); }
@media (prefers-reduced-motion: reduce) { .res-item .x { transition: none; } }

.res-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.res-total .n { font-size: .82rem; color: var(--text-dim); }
.res-total .v { font-family: var(--font-mono); font-weight: 600; font-size: 1.25rem; }

.res-breakdown { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.res-line { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; color: var(--text-dim); }
.res-line span:last-child { font-family: var(--font-mono); font-weight: 600; color: var(--text); }
.res-line.muted span:last-child { color: var(--text-muted); font-weight: 500; font-family: inherit; }

.fulfillment-field { margin-top: 2px; }
.fulfillment-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fulfillment-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-elev-2);
  cursor: pointer;
  font-weight: 600;
  font-size: .86rem;
  transition: border-color .15s, background .15s, color .15s;
}
.fulfillment-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(21, 0, 255, .18);
}
.fulfillment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.delivery-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.delivery-fields.hidden { display: none; }

.res-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

.res-confirm { background: var(--accent-soft); border: 1px solid rgba(199,255,61,.3); border-radius: var(--r-md); padding: 12px 14px; font-size: .78rem; line-height: 1.55; }
.res-confirm .ref { font-family: var(--font-mono); color: var(--accent-text); }

.pay-box {
  background: var(--bg-elev-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 14px 14px 12px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.pay-box__title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  font-size: .86rem;
  margin-bottom: 12px;
}
.pay-box__ar {
  color: var(--text-dim);
  font-weight: 600;
  font-size: .82rem;
}
.pay-box__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.pay-box__list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 12px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.pay-box__label {
  flex: 0 0 auto;
  font-size: .78rem;
  color: var(--text-dim);
  font-weight: 600;
}
.pay-box__list b {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: end;
}
.pay-box__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
  min-width: 0;
}
.pay-box__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-elev-2);
  font-size: .74rem;
  font-weight: 700;
  color: var(--accent-text);
  text-decoration: none;
  white-space: nowrap;
}
.pay-box__link:hover { border-color: var(--accent-text); }
.pay-box__copy {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.pay-box__actions .pay-box__copy { flex: 0 0 auto; }
.pay-box__copy b {
  flex: 1 1 auto;
  text-align: end;
}
.pay-box__copy span {
  font-size: .68rem;
  font-weight: 600;
  color: var(--accent-text);
}
.pay-box__copy:hover b { color: var(--accent-text); }
.pay-box__copy:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 4px;
  border-radius: 2px;
}
.pay-box__note {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pay-box__note p {
  margin: 0;
  font-size: .76rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.pay-box__note b { color: var(--text-dim); }

.pay-note { font-size: .72rem; color: var(--text-muted); line-height: 1.6; text-align: center; }
.pay-note b { color: var(--text-dim); font-family: var(--font-mono); font-weight: 600; }

/* ===========================================================
   Responsive system
   Breakpoints: 1024 (tablet landscape) · 880 (tablet) ·
                768 (tablet portrait) · 560 (phone) · 380 (small phone)
   =========================================================== */

/* --- Tablet landscape & below --- */
@media (max-width: 1024px) {
  :root { --nav-h: 60px; --container: 960px; }
  .container { padding: 0 18px; }
  .grid-2 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .lb-podium { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- Tablet --- */
@media (max-width: 880px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  /* minmax(0,1fr) prevents wide children (payment URLs, etc.) from blowing out the page */
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > *,
  .grid-3 > * { min-width: 0; max-width: 100%; }
  .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  .res-panel { position: static; top: auto; max-width: 100%; }
  .pickup-tag { white-space: normal; letter-spacing: .1em; }
}

/* --- Tablet: book row wraps so price/actions drop below title --- */
@media (max-width: 900px) {
  .book-row {
    flex-wrap: wrap;
  }
  .book-price { width: auto; text-align: left; }
}

/* --- Phone: card becomes a tidy grid so nothing clips off-screen --- */
@media (max-width: 560px) {
  .res-panel { padding: 18px 16px; }
  .book-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb main price"
      "action action action";
    gap: 10px 12px;
    align-items: center;
    padding: 12px 14px;
    width: 100%;
  }
  .book-thumb { grid-area: thumb; width: 48px; height: 66px; }
  .book-row-main { grid-area: main; min-width: 0; }
  .book-title-row { flex-wrap: wrap; gap: 6px 8px; font-size: .98rem; }
  .book-row-sub {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .book-price {
    grid-area: price;
    width: auto;
    max-width: 7.5rem;
    text-align: right;
    font-size: .82rem;
    white-space: nowrap;
  }
  .btn-add,
  .qty-stepper {
    grid-area: action;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-self: stretch;
  }
  .pay-box__list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .pay-box__copy { flex-wrap: wrap; }
}

/* Books page header: keep brand + actions from overflowing phones */
@media (max-width: 560px) {
  .nav-inner { flex-wrap: wrap; row-gap: 8px; }
  .nav-right { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .brand-name { font-size: .95rem; }
}

/* Light theme: accent borders that hardcode neon lime */
[data-theme="light"] .btn-add.added,
[data-theme="light"] .res-confirm {
  border-color: rgba(63, 98, 0, 0.28);
}
[data-theme="light"] .book-ph.tint-mod {
  background: radial-gradient(circle at 50% 30%, rgba(24, 96, 192, 0.18), var(--bg-elev-2) 80%);
}
[data-theme="light"] .book-ph.tint-warn {
  background: radial-gradient(circle at 50% 30%, rgba(154, 90, 0, 0.16), var(--bg-elev-2) 80%);
}
