:root {
  --ink: #2b2320;
  --paper: #ffffff;
  --card: #fffaf5;
  --brand: #f2760f;
  --brand-dark: #c85a00;
  --brand-light: #fff1e0;
  --accent: #1f8a6b;
  --line: #ffe0bd;
  --muted: #78706a;
  --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); }
img { max-width: 100%; }

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

/* Header */
.site-header {
  background: var(--paper);
  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;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}
.brand span { color: var(--brand); }
.header-nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.header-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.header-nav a:hover { color: var(--brand-dark); }
.header-nav .btn { padding: 9px 18px; font-size: .9rem; }

/* Hero */
.hero {
  padding: 52px 0 30px;
  text-align: center;
  background: linear-gradient(180deg, var(--brand-light) 0%, var(--paper) 100%);
}
.hero h1 {
  font-size: 2.1rem;
  margin: 0 0 14px;
}
.hero p {
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto;
  font-size: 1.05rem;
}
.hero .hero-actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

section.block { padding: 46px 0; }
section.block h2 { font-size: 1.55rem; margin: 0 0 6px; text-align: center; }
section.block .block-sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 30px; }
.block--tint { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Badges */
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  width: fit-content;
}
.badge--soon { background: #eee; color: var(--muted); }
.badge--gift { background: #dff0e6; color: var(--accent); }
.badge--free { background: #dff0e6; color: var(--accent); }

/* Course grid */
.course-grid, .ebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.course-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;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(43,35,32,0.16); }
.course-card__cover {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-light);
}
.course-card__cover img { width: 100%; height: 100%; object-fit: contain; }
.course-card__body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.course-card__title { font-size: 1.08rem; font-weight: 800; margin: 0; }
.course-card__desc { font-size: .88rem; color: var(--muted); margin: 0; flex: 1; }
.course-card__price { font-weight: 800; color: var(--brand-dark); font-size: 1.02rem; }
.course-card__price small { font-weight: 500; color: var(--muted); font-size: .78rem; }

/* Cover art (CSS-designed, no photo) */
.cover-art {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 18px;
  color: #fff;
}
.cover-art .cover-art__icon { font-size: 2.4rem; line-height: 1; }
.cover-art .cover-art__title { font-weight: 800; font-size: 1.05rem; line-height: 1.3; }
.cover-art .cover-art__sub { font-size: .72rem; opacity: .9; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }

/* Ebook cards */
.ebook-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.ebook-card__cover { aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--brand-light); display: flex; align-items: center; justify-content: center; }
.ebook-card__cover img { width: 100%; height: 100%; object-fit: contain; }
.ebook-card__title { font-weight: 700; font-size: 1rem; margin: 4px 0 0; }
.ebook-card__desc { font-size: .85rem; color: var(--muted); flex: 1; }

/* Buttons */
.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);
  padding: 10px 20px;
}
.btn--outline:hover { background: var(--brand-light); }
.btn--block { display: block; width: 100%; }
.btn--zalo { background: #0068ff; }
.btn--zalo:hover { background: #0052cc; }
.btn[disabled] { background: #ccc; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* Detail page */
.detail {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 40px;
  padding: 36px 0;
}
@media (max-width: 780px) {
  .detail { grid-template-columns: 1fr; }
}
.detail__cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail__cover .cover-art {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 4/3;
}
.detail__cover-caption { font-size: .8rem; color: var(--muted); text-align: center; margin: 8px 0 0; font-style: italic; }
.detail h1 { margin-top: 0; font-size: 1.7rem; }
.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.35rem; font-weight: 800; color: var(--brand-dark); margin: 18px 0; }
.price-row small { display:block; font-size: .85rem; color: var(--muted); font-weight: 400; }

/* Curriculum / fee tables */
.data-table { width: 100%; border-collapse: collapse; margin: 14px 0 22px; font-size: .9rem; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.data-table th { background: var(--brand-light); color: var(--brand-dark); }
.data-table td.num, .data-table th.num { text-align: right; white-space: nowrap; }
.data-table .price-cell { font-weight: 700; color: var(--brand-dark); }
.table-wrap { overflow-x: auto; }

.format-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.format-table th, .format-table td { border: 1px solid var(--line); padding: 12px 14px; font-size: .92rem; vertical-align: top; }
.format-table th { background: var(--brand-light); color: var(--brand-dark); text-align: left; }
.format-table td.price { font-weight: 800; color: var(--brand-dark); white-space: nowrap; }

.note-box { background: var(--brand-light); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; font-size: .9rem; margin: 16px 0; }
.note-box b { color: var(--brand-dark); }

/* Video embed */
.video-wrap { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin: 16px 0; background: #000; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }

/* 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: 12px 16px;
  cursor: pointer;
  flex: 1;
  min-width: 160px;
  text-align: left;
}
.radio-card input { display: none; }
.radio-card.selected { border-color: var(--brand); background: var(--brand-light); }
.radio-card .r-title { display: block; font-weight: 700; }
.radio-card .r-desc { display: block; font-size: .8rem; color: var(--muted); margin-top: 3px; }
.radio-card .r-price { display: block; font-weight: 800; color: var(--brand-dark); margin-top: 6px; }
.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: var(--brand-light); border: 1px solid var(--line); 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; }

/* Zalo QR box (tư vấn) */
.zalo-box { text-align: center; padding: 10px 0; }
.zalo-box img.qr { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 12px; margin: 12px auto; display:block; background:#fff; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 28px;
  color: var(--muted);
  font-size: .88rem;
  margin-top: 40px;
  background: var(--card);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px; margin-bottom: 20px; }
.footer-grid h4 { margin: 0 0 10px; color: var(--ink); font-size: .95rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: var(--muted); text-decoration: none; }
.footer-grid a:hover { color: var(--brand-dark); }
.footer-social { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.footer-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand-dark);
  text-decoration: none;
}
.footer-social svg { width: 18px; height: 18px; }
.footer-note { text-align: center; margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: .8rem; opacity: .85; }

/* 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;
}
@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;
  border: 4px solid var(--brand-light);
}
.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: var(--brand-light);
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--brand-dark);
}

/* Sach cross-promo */
.sach-promo {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  align-items: center;
}
.sach-promo__covers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; grid-column: span 1; }
.sach-promo__covers img { border-radius: 8px; box-shadow: var(--shadow); width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.sach-promo__info { grid-column: span 3; }
@media (max-width: 760px) {
  .sach-promo { grid-template-columns: 1fr; text-align: center; }
  .sach-promo__covers { grid-column: 1; max-width: 280px; margin: 0 auto; }
  .sach-promo__info { grid-column: 1; }
}
.sach-promo__info h3 { margin-top: 0; }

/* 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(255,255,255,.85);
  display: none; align-items: center; justify-content: center;
  font-weight: 700; z-index: 50;
}
.loading-overlay.active { display: flex; }

/* Modal (dùng cho luồng tư vấn Zalo) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 65; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(20,15,10,.55);
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 460px; width: 100%; padding: 24px; max-height: 90vh; overflow-y: auto;
  position: relative;
}
.modal-box h3 { margin-top: 0; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--brand-light); color: var(--brand-dark); cursor: pointer; font-size: 1rem;
}

/* 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í */
.gift-strip { text-align: center; margin-bottom: 26px; color: var(--muted); }

/* 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: var(--brand-light); color: var(--brand-dark); }
.admin-table tbody tr:hover { background: #fff6ec; }

.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: var(--brand-light); color: var(--brand-dark); }
.status-badge--ok { background: #e3f3ee; color: var(--accent); }
.status-badge--lead { background: #e6eefc; color: #2953a6; }

.admin-tabs { display: flex; gap: 10px; margin: 24px 0 16px; flex-wrap: wrap; }
.admin-tabs button { padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: .88rem; }
.admin-tabs button.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
