/* ==========================================================================
   Trang chủ — thiết kế tối giản: chữ lớn, tương phản cao, ít trang trí
   ========================================================================== */
body.cm-home {
  --ch-primary: var(--theme-color, #0b57a4);
  --ch-ink: #1b2434;
  --ch-muted: #4d5b70;
  --ch-line: #dde4ee;
  --ch-surface: #ffffff;
  --ch-page: #f5f7fa;
  --ch-radius: 10px;

  margin: 0;
  background: var(--ch-page);
  color: var(--ch-ink);
  font-family: "Inter", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}

body.cm-home a,
body.cm-home button,
body.cm-home input,
body.cm-home textarea {
  font-family: inherit;
  font-size: inherit;
}

body.cm-home a {
  color: inherit;
  text-decoration: none;
}

body.cm-home a:hover {
  text-decoration: underline;
}

body.cm-home h1,
body.cm-home h2,
body.cm-home h3,
body.cm-home h4 {
  color: var(--ch-ink);
  margin: 0;
  line-height: 1.35;
}

body.cm-home p {
  margin: 0;
}

body.cm-home :focus-visible {
  outline: 3px solid var(--ch-primary);
  outline-offset: 2px;
}

.cm-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cm-skip {
  position: absolute;
  left: -9999px;
}

.cm-skip:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--ch-surface);
  border: 2px solid var(--ch-primary);
  border-radius: var(--ch-radius);
}

.cm-shell {
  width: min(100% - 40px, 1140px);
  margin: 0 auto;
}

/* ---------- Buttons ---------- */
.cm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: var(--ch-radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.cm-btn:hover {
  text-decoration: none;
}

.cm-btn--lg {
  min-height: 56px;
  padding: 0 30px;
  font-size: 18px;
}

.cm-btn--primary {
  background: var(--ch-primary);
  border-color: var(--ch-primary);
  color: #fff;
}

.cm-btn--primary:hover {
  background: #08406f;
  border-color: #08406f;
  color: #fff;
}

.cm-btn--ghost {
  background: var(--ch-surface);
  border-color: var(--ch-line);
  color: var(--ch-ink);
}

.cm-btn--ghost:hover {
  border-color: var(--ch-primary);
  color: var(--ch-primary);
}

/* ---------- Header (Edubooks-style) ---------- */
.cm-topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: #fff;
  overflow: visible;
}

.cm-topbar__brand {
  background: #fff;
  border-bottom: 1px solid #eef2f7;
}

.cm-topbar__brand .cm-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.cm-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0a3278;
  text-decoration: none !important;
  white-space: nowrap;
}

.cm-brand img {
  display: block;
  max-height: 44px;
  width: auto;
}

.cm-topbar__bar {
  background: #fff;
  border-bottom: 1px solid #e8edf5;
}

.cm-topbar__bar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.cm-topbar .cm-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #0a3278;
  text-decoration: none !important;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
  transform: none;
}

.cm-topbar .cm-icon-btn:hover {
  background: #eef3fb;
  color: #06265c;
  transform: none;
}

.cm-topbar .cm-icon-btn .material-symbols-outlined,
.cm-topbar .cm-icon-btn .fa {
  font-size: 22px;
  line-height: 1;
}

.cm-topbar .cm-icon-btn .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.cm-apps {
  position: relative;
  flex-shrink: 0;
}

.cm-apps__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 1200;
  width: min(280px, calc(100vw - 32px));
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 10px 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(10, 50, 120, 0.18);
}

.cm-apps__panel[hidden] {
  display: none !important;
}

.cm-apps__heading {
  margin: 0;
  padding: 6px 16px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.cm-apps__panel a {
  display: block;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none !important;
}

.cm-apps__panel a:hover,
.cm-apps__panel a.is-active {
  background: #f1f5f9;
  color: #0a3278;
}

.cm-apps__divider {
  margin: 8px 12px;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

.cm-topbar .cm-search {
  flex: 1 1 auto !important;
  flex-basis: auto !important;
  order: 0 !important;
  display: flex !important;
  align-items: center;
  min-width: 0 !important;
  width: auto;
  max-width: none;
  height: 44px;
  gap: 0;
  padding: 0 6px 0 18px;
  background: #f4f7fb;
  border: 1px solid #d7e0ee;
  border-radius: 999px;
  color: #64748b;
  box-shadow: none;
}

.cm-topbar .cm-search input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1e293b;
  font-size: 14px;
}

.cm-topbar .cm-search input::placeholder {
  color: #94a3b8;
}

.cm-topbar .cm-search input:focus {
  outline: none;
}

.cm-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.cm-search__submit:hover {
  color: #0a3278;
  background: #e8eef8;
}

.cm-search__submit .material-symbols-outlined,
.cm-search__submit .fa {
  font-size: 18px;
}

.cm-topbar .cm-actions {
  display: flex !important;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  flex-wrap: nowrap !important;
  width: auto !important;
  order: 0 !important;
  margin-left: 0;
}

.cm-cart em {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.cm-user-drop {
  position: relative;
}

.cm-user-drop .dropdown-toggle::after {
  display: none !important;
}

.cm-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d7e0ee;
}

.cm-userbar__menu.dropdown-menu {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  right: 0 !important;
  left: auto !important;
  z-index: 1200 !important;
  min-width: 220px;
  margin: 0;
  padding: 8px 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  background: #fff;
  transform: none !important;
  inset: auto 0 auto auto !important;
  display: none;
}

.cm-userbar__menu.dropdown-menu.show {
  display: block !important;
}

.cm-userbar__menu .dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.cm-userbar__menu .dropdown-item:hover {
  background: #f1f5f9;
  color: #0a3278;
}

.cm-userbar__menu strong.dropdown-item {
  font-weight: 800;
  color: #0f172a;
  pointer-events: none;
}

/* ---------- Hero ---------- */
.cm-hero {
  background: var(--ch-surface);
  border-bottom: 1px solid var(--ch-line);
}

.cm-hero__inner {
  padding: 60px 0 52px;
  max-width: 760px;
}

.cm-hero h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.cm-hero p {
  margin-top: 16px;
  font-size: 19px;
  color: var(--ch-muted);
}

.cm-hero__actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.cm-trust {
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.cm-trust li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ch-muted);
}

.cm-trust span {
  color: #15803d;
}

/* ---------- Sections ---------- */
.cm-section {
  padding: 52px 0 0;
}

.cm-section:last-of-type {
  padding-bottom: 60px;
}

.cm-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.cm-section__head h2 {
  font-size: 27px;
  font-weight: 700;
}

.cm-section__more {
  font-weight: 600;
  color: var(--ch-primary);
  white-space: nowrap;
}

/* ---------- Categories ---------- */
.cm-cats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.cm-cat {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 20px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
  font-size: 18px;
  font-weight: 600;
}

.cm-cat:hover {
  border-color: var(--ch-primary);
  color: var(--ch-primary);
  text-decoration: none;
}

.cm-cat span {
  font-size: 28px;
  color: var(--ch-primary);
}

/* ---------- Product cards ---------- */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.cm-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--ch-surface);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
  overflow: hidden;
}

.cm-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  min-height: 220px;
  background: #eef2f7;
  border-bottom: 1px solid var(--ch-line);
  overflow: hidden;
}

.cm-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.cm-card__media span,
.cm-card__media .material-symbols-outlined {
  font-size: 88px;
  color: #64748b;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48;
}

.cm-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  flex: 1;
}

.cm-card__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  display: block;
  overflow: visible;
}

.cm-card__title a:hover {
  color: var(--ch-primary);
}

.cm-card__desc {
  color: var(--ch-muted);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cm-card__price {
  font-size: 18px;
  font-weight: 800;
  color: #b45309;
}

.cm-card__price.is-free {
  color: #15803d;
}

.cm-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.cm-card__actions .cm-btn--primary {
  background: #00acee;
  border-color: #00acee;
  color: #fff;
}

.cm-card__actions .cm-btn--primary:hover {
  background: #0095d0;
  border-color: #0095d0;
  color: #fff;
}

.cm-card__actions .cm-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
}

.cm-activity {
  list-style: none;
  margin: 0;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
}

.cm-activity li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.cm-activity .material-symbols-outlined {
  color: var(--ch-primary);
  font-size: 22px;
}

.cm-activity .material-symbols-outlined.is-purchase {
  color: #15803d;
}

.cm-activity p {
  color: var(--ch-muted);
  font-size: 15px;
}

.cm-activity a {
  color: var(--ch-ink);
  font-weight: 700;
  text-decoration: underline;
}

.cm-activity small {
  display: inline-block;
  margin-left: 6px;
  color: #8b98ab;
  font-size: 13px;
}

.cm-empty {
  grid-column: 1 / -1;
  padding: 40px;
  background: var(--ch-surface);
  border: 1px dashed var(--ch-line);
  border-radius: var(--ch-radius);
  color: var(--ch-muted);
  text-align: center;
}

/* ---------- Steps ---------- */
.cm-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  counter-reset: none;
}

.cm-steps li {
  padding: 24px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
}

.cm-steps strong {
  display: block;
  margin-bottom: 8px;
  font-size: 19px;
  color: var(--ch-primary);
}

.cm-steps p {
  color: var(--ch-muted);
}

/* ---------- Features ---------- */
.cm-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.cm-feature {
  padding: 26px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
}

.cm-feature > span {
  font-size: 34px;
  color: var(--ch-primary);
}

.cm-feature h3 {
  margin: 12px 0 8px;
  font-size: 20px;
}

.cm-feature p {
  color: var(--ch-muted);
}

/* ---------- Help / contact ---------- */
.cm-help {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 36px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-line);
  border-radius: var(--ch-radius);
}

.cm-help__info h2 {
  font-size: 27px;
}

.cm-help__info p {
  margin-top: 14px;
  color: var(--ch-muted);
}

.cm-help__list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cm-help__list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
}

.cm-help__list span {
  font-size: 26px;
  color: var(--ch-primary);
}

.cm-contact-form {
  display: flex;
  flex-direction: column;
}

.cm-contact-form label {
  margin-bottom: 6px;
  font-weight: 600;
}

.cm-contact-form input,
.cm-contact-form textarea {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--ch-page);
  border: 2px solid var(--ch-line);
  border-radius: var(--ch-radius);
  color: var(--ch-ink);
  resize: vertical;
}

.cm-contact-form input:focus,
.cm-contact-form textarea:focus {
  outline: none;
  border-color: var(--ch-primary);
  background: var(--ch-surface);
}

.cm-contact-form label.error {
  margin: -12px 0 14px;
  color: #b91c1c;
  font-weight: 500;
}

/* ---------- Footer ---------- */
.cm-footer {
  margin-top: 20px;
  padding: 48px 0 0;
  background: #16233c;
  color: #cfd8e6;
}

.cm-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 36px;
}

.cm-footer h3,
.cm-footer h4 {
  color: #fff;
}

.cm-footer h3 {
  font-size: 21px;
  margin-bottom: 12px;
}

.cm-footer h4 {
  font-size: 17px;
  margin-bottom: 14px;
}

.cm-footer p {
  color: #cfd8e6;
}

.cm-footer__grid > div > a {
  display: block;
  margin-bottom: 10px;
  color: #cfd8e6;
}

.cm-footer__grid > div > a:hover {
  color: #fff;
}

.cm-footer__social {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.cm-footer__social a {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #34405c;
  border-radius: var(--ch-radius);
  color: #cfd8e6;
}

.cm-footer__social a:hover {
  background: #34405c;
  color: #fff;
  text-decoration: none;
}

.cm-footer__bottom {
  padding: 18px 0;
  border-top: 1px solid #2a3category;
  color: #9fadc4;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .cm-cats,
  .cm-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .cm-cats,
  .cm-grid,
  .cm-steps,
  .cm-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cm-help,
  .cm-footer__grid {
    grid-template-columns: 1fr;
  }

  .cm-hero h1 {
    font-size: 33px;
  }

  .cm-topbar__brand .cm-shell {
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .cm-brand {
    font-size: 20px;
  }

  .cm-brand img {
    max-height: 32px;
  }

  .cm-topbar__bar-inner {
    gap: 8px;
    min-height: 50px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .cm-topbar .cm-icon-btn {
    width: 36px;
    height: 36px;
  }

  .cm-topbar .cm-icon-btn .fa {
    font-size: 18px;
  }

  .cm-topbar .cm-search {
    height: 38px;
    padding: 0 4px 0 14px;
    order: 0 !important;
    flex-basis: auto !important;
  }

  .cm-topbar .cm-search input {
    font-size: 13px;
  }

  .cm-search__submit {
    width: 32px;
    height: 32px;
  }

  .cm-topbar .cm-actions {
    width: auto !important;
    flex-wrap: nowrap !important;
  }

  .cm-user-avatar {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 640px) {
  body.cm-home {
    font-size: 16px;
  }

  .cm-shell {
    width: calc(100% - 24px);
  }

  .cm-cats,
  .cm-grid,
  .cm-steps,
  .cm-features {
    grid-template-columns: 1fr;
  }

  .cm-grid {
    gap: 12px;
  }

  .cm-card {
    flex-direction: row;
    align-items: stretch;
  }

  .cm-card__media {
    flex: 0 0 118px;
    width: 118px;
    min-height: 0;
    aspect-ratio: auto;
    align-self: stretch;
    border-bottom: 0;
    border-right: 1px solid var(--ch-line);
  }

  .cm-card__media img {
    object-fit: cover;
    object-position: center top;
  }

  .cm-card__media span,
  .cm-card__media .material-symbols-outlined {
    font-size: 40px;
  }

  .cm-card__body {
    gap: 6px;
    padding: 10px 12px;
    min-width: 0;
  }

  .cm-card__title {
    font-size: 14px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .cm-card__desc {
    display: none;
  }

  .cm-card__price {
    font-size: 15px;
  }

  .cm-card__actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 4px;
  }

  .cm-card__actions .cm-btn {
    flex: 1 1 auto;
    min-height: 34px;
    padding: 0 8px;
    font-size: 12px;
  }

  .cm-topbar__brand .cm-shell {
    min-height: 40px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .cm-brand img {
    max-height: 28px;
  }

  .cm-brand {
    font-size: 18px;
  }

  .cm-topbar__bar-inner {
    gap: 6px;
    min-height: 46px;
  }

  .cm-topbar .cm-search {
    height: 34px;
    padding-left: 12px;
  }

  .cm-topbar .cm-search input {
    font-size: 12px;
  }

  .cm-topbar .cm-search input::placeholder {
    font-size: 12px;
  }

  .cm-topbar .cm-icon-btn {
    width: 34px;
    height: 34px;
  }

  .cm-topbar .cm-icon-btn .fa {
    font-size: 16px;
  }

  .cm-hero__inner {
    padding: 40px 0 36px;
  }

  .cm-hero h1 {
    font-size: 28px;
  }

  .cm-hero p {
    font-size: 17px;
  }

  .cm-hero__actions .cm-btn {
    flex: 1 1 100%;
  }

  .cm-section {
    padding-top: 40px;
  }

  .cm-section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .cm-help {
    padding: 24px;
  }
}
