:root {
  --ink: #2b2320;
  --paper: #fdfaf5;
  --card: #ffffff;
  --brand: #b8722f;
  --brand-dark: #8f5620;
  --accent: #2f6f5e;
  --line: #e7ddcf;
  --muted: #7a7067;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(43, 35, 32, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

a { color: var(--brand-dark); }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.brand span { color: var(--brand); }

/* Hero */
.hero {
  padding: 48px 0 28px;
  text-align: center;
}
.hero h1 {
  font-size: 2rem;
  margin: 0 0 12px;
}
.hero p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

/* Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px;
  padding: 24px 0 56px;
}
.book-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .15s ease;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(43,35,32,0.14);
}
.book-card__cover {
  aspect-ratio: 5 / 7;
  background: #efe6d6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.book-card__title { font-size: 1.02rem; font-weight: 700; margin: 0; }
.book-card__desc { font-size: .88rem; color: var(--muted); margin: 0; flex: 1; }
.book-card__price { font-weight: 700; color: var(--brand-dark); }
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fdeee0;
  color: var(--brand-dark);
  width: fit-content;
}
.badge--soon { background: #eee; color: var(--muted); }

/* Detail page */
.detail {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
  padding: 36px 0;
}
@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; }
}
.detail__cover img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail h1 { margin-top: 0; font-size: 1.6rem; }
.spec-list { list-style: none; padding: 0; margin: 16px 0; }
.spec-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.spec-list li b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.highlights { padding-left: 20px; }
.highlights li { margin-bottom: 6px; }
.price-row { font-size: 1.3rem; font-weight: 700; color: var(--brand-dark); margin: 18px 0; }
.price-row small { display:block; font-size: .85rem; color: var(--muted); font-weight: 400; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); }
.btn--outline {
  background: transparent;
  color: var(--brand-dark);
  border: 2px solid var(--brand);
}
.btn--block { display: block; width: 100%; }
.btn[disabled] { background: #ccc; cursor: not-allowed; }

/* Order form */
.order-box {
  margin-top: 24px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.order-box h3 { margin-top: 0; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
}
.radio-group { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  flex: 1;
  min-width: 140px;
  text-align: center;
}
.radio-card input { display: none; }
.radio-card.selected { border-color: var(--brand); background: #fdf3e8; }
.radio-card .r-price { display: block; font-weight: 700; color: var(--brand-dark); margin-top: 2px; }
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-row button {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 1.1rem; cursor: pointer;
}
.qty-row input { width: 70px; text-align: center; }
.total-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-top: 1px dashed var(--line); margin-top: 8px;
  font-weight: 700; font-size: 1.1rem;
}
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.error-text { color: var(--danger); font-size: .85rem; margin-top: 6px; display:none; }

/* Payment step */
.pay-box { text-align: center; }
.pay-box img.qr { width: 240px; height: 240px; border: 1px solid var(--line); border-radius: 12px; margin: 12px auto; display:block; }
.pay-info { text-align: left; background: #fdf6ea; border: 1px solid #f0dfb8; border-radius: 10px; padding: 16px; margin: 16px 0; }
.pay-info div { margin-bottom: 6px; }
.pay-info b { color: var(--brand-dark); }
.order-code { font-family: monospace; font-size: 1.1rem; background: #fff; padding: 3px 8px; border-radius: 6px; border: 1px dashed var(--brand); }
.pay-warning { text-align: left; font-size: .88rem; font-weight: 600; color: var(--danger); background: #fdecea; border: 1px solid var(--danger); border-radius: 8px; padding: 10px 12px; margin: 12px 0; }

.success-box { text-align: center; padding: 20px 0; }
.success-box .icon { font-size: 2.6rem; }

.step { display: none; }
.step.active { display: block; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  margin-top: 40px;
}
.site-footer .footer-note { margin-top: 6px; font-size: .8rem; opacity: .8; }

/* Author section */
.author {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 8px 0 48px;
}
@media (max-width: 700px) {
  .author { grid-template-columns: 1fr; text-align: center; }
  .author__photo img { margin: 0 auto; }
}
.author__photo img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.author h2 { margin-top: 0; margin-bottom: 4px; }
.author__name { font-weight: 700; font-size: 1.05rem; margin: 0 0 12px; }
.author__name span { font-weight: 400; color: var(--muted); }
.author__cv { padding-left: 20px; margin: 0 0 16px; }
.author__cv li { margin-bottom: 6px; }
.author__quote {
  margin: 0;
  padding: 14px 18px;
  border-left: 4px solid var(--brand);
  background: #fdf3e8;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--brand-dark);
}

/* Preview gallery + lightbox */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin: 16px 0 8px;
}
.gallery__item {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  text-align: center;
}
.gallery__item img { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; object-position: top; }
.gallery__item span { display: block; font-size: .78rem; color: var(--muted); padding: 6px 8px; }

.lightbox {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(20,15,10,.75); }
.lightbox__content {
  position: relative; z-index: 1;
  max-width: min(90vw, 640px); max-height: 90vh;
  background: #fff; border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; align-items: center;
}
.lightbox__content img { max-width: 100%; max-height: 78vh; border-radius: 6px; object-fit: contain; }
.lightbox__caption { margin-top: 8px; font-size: .9rem; color: var(--muted); }
.lightbox__close {
  position: absolute; top: -14px; right: -14px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none; cursor: pointer; font-size: 1rem;
}

.loading-overlay {
  position: fixed; inset: 0; background: rgba(253,250,245,.85);
  display: none; align-items: center; justify-content: center;
  font-weight: 700; z-index: 50;
}
.loading-overlay.active { display: flex; }

/* Nút Zalo + Gọi điện nổi góc màn hình */
.contact-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-float__btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  font-size: .8rem;
  font-weight: 700;
  transition: transform .15s ease;
}
.contact-float__btn:hover { transform: scale(1.08); }
.contact-float__btn--zalo { background: #0068ff; }
.contact-float__btn--call { background: var(--accent); }
.contact-float__btn svg { width: 26px; height: 26px; }
@media (max-width: 500px) {
  .contact-float { right: 12px; bottom: 12px; gap: 10px; }
  .contact-float__btn { width: 50px; height: 50px; }
}

/* Mục quà tặng miễn phí (vd Sổ tay săn từ) */
.gift {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 28px;
  align-items: center;
  background: #eef6f2;
  border: 1px solid #cfe6da;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 30px;
  margin: 8px 0 40px;
}
@media (max-width: 700px) {
  .gift { grid-template-columns: 1fr; text-align: center; }
  .gift__cover img { margin: 0 auto; }
}
.gift__cover img {
  width: 100%;
  max-width: 180px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: block;
}
.badge--gift { background: #dff0e6; color: var(--accent); }
.gift h2 { margin: 10px 0 8px; }
.gift__desc { color: var(--ink); margin: 0 0 18px; }

/* Admin dashboard */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.stat-card__value { font-size: 1.4rem; font-weight: 700; color: var(--brand-dark); }
.stat-card__label { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  font-size: .85rem;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.admin-table th { background: #fdf6ea; color: var(--brand-dark); }
.admin-table tbody tr:hover { background: #fffaf2; }

.status-badge { padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status-badge--wait { background: #eee; color: var(--muted); }
.status-badge--warn { background: #fdeee0; color: var(--brand-dark); }
.status-badge--ok { background: #e3f3ee; color: var(--accent); }

.filter-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.filter-field select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .9rem; background: #fff; min-width: 190px; font-family: inherit;
}
.admin-table tfoot td { font-weight: 700; background: #fdf6ea; border-top: 2px solid var(--line); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0; font-size: .88rem; color: var(--muted); }
.pagination button { padding: 6px 14px; }
.pagination button[disabled] { opacity: .4; cursor: not-allowed; }

.btn--danger { color: var(--danger); border-color: var(--danger); }
