/* ==========================================================================
   Cart & Checkout — Edubooks-inspired (Chị Hồng Ơi)
   ========================================================================== */

.cm-co {
  --cm-co-line: #e5eaf3;
  --cm-co-muted: #64748b;
  --cm-co-ink: #1e293b;
  --cm-co-accent: #0a3278;
  --cm-co-price: #c2410c;
  --cm-co-radius: 12px;
  --cm-co-shadow: 0 8px 28px rgba(15, 40, 80, 0.06);
  padding: 1.35rem 0 3rem;
  background: #f4f7fb;
  min-height: 50vh;
}

.cm-co .cm-shell {
  width: min(100% - 32px, 1140px);
  margin: 0 auto;
}

.cm-co__title {
  margin: 0 0 1.25rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--cm-co-ink);
  letter-spacing: -0.02em;
}

.cm-co__title span {
  font-weight: 500;
  color: var(--cm-co-muted);
  font-size: 1rem;
}

.cm-co__alert {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.92rem;
}

.cm-co__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.9fr);
  gap: 1.25rem;
  align-items: start;
}

.cm-co__panel {
  background: #fff;
  border: 1px solid var(--cm-co-line);
  border-radius: var(--cm-co-radius);
  box-shadow: var(--cm-co-shadow);
}

.cm-co__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 140px;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--cm-co-line);
  color: var(--cm-co-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.cm-co__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 140px;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #f1f5f9;
}

.cm-co__row:last-of-type {
  border-bottom: 0;
}

.cm-co__product {
  display: grid;
  grid-template-columns: 22px 72px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.cm-co__product em {
  font-style: normal;
  color: var(--cm-co-muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.cm-co__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 96px;
  background: #f8fafc;
  border: 1px solid var(--cm-co-line);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none !important;
}

.cm-co__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.cm-co__thumb .fa,
.cm-co__thumb .material-symbols-outlined {
  font-size: 28px;
  color: #94a3b8;
}

.cm-co__info {
  min-width: 0;
}

.cm-co__info a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--cm-co-ink);
  text-decoration: none !important;
}

.cm-co__info a:hover {
  color: var(--cm-co-accent);
}

.cm-co__meta {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--cm-co-muted);
}

.cm-co__unit {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.cm-co__unit strong {
  color: var(--cm-co-price);
  font-weight: 700;
}

.cm-co__unit s {
  color: var(--cm-co-muted);
  font-size: 0.85rem;
}

.cm-co__qty {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  border: 1px solid var(--cm-co-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.cm-co__qty button {
  width: 34px;
  height: 34px;
  border: 0;
  background: #fff;
  color: var(--cm-co-ink);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.cm-co__qty button:hover {
  background: #f1f5f9;
}

.cm-co__qty output,
.cm-co__qty span {
  min-width: 36px;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
}

.cm-co__line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.cm-co__line strong {
  color: var(--cm-co-price);
  font-weight: 700;
  white-space: nowrap;
}

.cm-co__line button,
.cm-co__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.cm-co__line button:hover,
.cm-co__remove:hover {
  color: #dc2626;
  background: #fef2f2;
}

.cm-co__coupon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--cm-co-line);
}

.cm-co__coupon p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--cm-co-ink);
}

.cm-co__coupon form {
  display: flex;
  flex: 1 1 260px;
  gap: 0.5rem;
  align-items: flex-start;
}

.cm-co__field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cm-co__coupon input,
.cm-co__field input {
  width: 100%;
  flex: none;
  min-width: 0;
  border: 1px solid var(--cm-co-line);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  background: #fff;
}

.cm-co__coupon .cm-co__btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.cm-co__field > label.error,
.cm-co__coupon label.error,
.cm-co__side label.error {
  display: block;
  margin: 0 !important;
  padding: 0;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.cm-co__side {
  padding: 1.2rem 1.25rem 1.4rem;
}

.cm-co__side-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0 1rem;
  color: var(--cm-co-accent);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cm-co__side .cm-co__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
  flex: none;
  width: 100%;
}

.cm-co__side .cm-co__field > label:not(.error) {
  display: block;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: #334155;
}

.cm-co__side .cm-co__field > label small {
  font-weight: 400;
  color: #64748b;
}

.cm-co__side .cm-co__field > label.error {
  order: 3;
}

.cm-co__side label.cm-co__check,
.cm-co__side label.cm-co__gateway {
  display: flex;
  margin-bottom: 0.75rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #334155;
}

.cm-co__side label small {
  font-weight: 400;
  color: #64748b;
}

.cm-co__side input[type="text"],
.cm-co__side input[type="email"],
.cm-co__side input[type="tel"],
.cm-co__side input[type="password"],
.cm-co__side textarea {
  width: 100%;
  border: 1px solid var(--cm-co-line);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  font-weight: 400;
  font-size: 0.95rem;
  background: #fff;
  color: var(--cm-co-ink);
}

.cm-co__side input:focus,
.cm-co__side textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cm-co__hint {
  margin: 0.2rem 0 0.85rem;
  color: var(--cm-co-muted);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.45;
}

.cm-co__check {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600 !important;
  cursor: pointer;
}

.cm-co__check input {
  width: 18px !important;
  height: 18px;
  margin: 0;
  accent-color: var(--cm-co-accent);
}

.cm-co__vat {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.85rem;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.cm-co__pay {
  display: grid;
  gap: 0.5rem;
  margin: 0.35rem 0 0.9rem;
}

.cm-co__pay > p {
  margin: 0 0 0.15rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--cm-co-ink);
}

.cm-co__gateway {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  margin: 0 !important;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--cm-co-line);
  border-radius: 10px;
  font-weight: 600 !important;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.cm-co__gateway:hover,
.cm-co__gateway.is-selected {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.cm-co__gateway.is-locked {
  pointer-events: none;
}

.cm-co__gateway input {
  width: auto !important;
  margin: 0;
  accent-color: var(--cm-co-accent);
}

.cm-co__gateway img {
  height: 22px;
  width: auto;
  max-width: 72px;
  object-fit: contain;
}

.cm-co__manual {
  margin-bottom: 0.85rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--cm-co-line);
  font-size: 0.88rem;
}

.cm-co__sum {
  margin: 1rem 0 0.9rem;
}

.cm-co__sum > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.92rem;
  color: #475569;
}

.cm-co__sum .is-total {
  margin-top: 0.35rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--cm-co-line);
}

.cm-co__sum .is-total dt {
  font-weight: 700;
  color: var(--cm-co-ink);
}

.cm-co__sum .is-total dd {
  color: var(--cm-co-price);
  font-size: 1.25rem;
  font-weight: 800;
}

.cm-co__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none !important;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.cm-co__btn--primary {
  width: 100%;
  min-height: 48px;
  background: #0a3278;
  border-color: #0a3278;
  color: #fff !important;
  font-size: 1rem;
}

.cm-co__btn--primary:hover {
  background: #08275e;
  border-color: #08275e;
  color: #fff !important;
}

.cm-co__btn--ghost {
  background: #fff;
  border-color: var(--cm-co-line);
  color: var(--cm-co-ink) !important;
}

.cm-co__btn--ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.cm-co__btn--link {
  background: transparent;
  border: 0;
  color: var(--cm-co-accent) !important;
  min-height: auto;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.cm-co__note {
  margin: 0.7rem 0 0;
  text-align: center;
  color: var(--cm-co-muted);
  font-size: 0.8rem;
}

.cm-co__empty {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #fff;
  border: 1px solid var(--cm-co-line);
  border-radius: var(--cm-co-radius);
  box-shadow: var(--cm-co-shadow);
}

.cm-co__empty .fa {
  font-size: 2.5rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

.cm-co__empty h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.cm-co__empty p {
  margin: 0 0 1.25rem;
  color: var(--cm-co-muted);
}

.cm-co__password {
  position: relative;
}

.cm-co__password input {
  padding-right: 44px !important;
}

.cm-co__password .toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  cursor: pointer;
  z-index: 2;
}

.cm-co__recent {
  margin-top: 2.5rem;
}

.cm-co__recent h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .cm-co__grid {
    grid-template-columns: 1fr;
  }

  .cm-co__head {
    display: none;
  }

  .cm-co__row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "product product"
      "qty line";
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.65rem;
  }

  .cm-co__product {
    grid-area: product;
  }

  .cm-co__qty {
    grid-area: qty;
    justify-self: start;
  }

  .cm-co__line {
    grid-area: line;
    width: auto;
    justify-self: end;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .cm-co__side {
    order: 2;
  }
}

@media (max-width: 575px) {
  .cm-co {
    padding: 1rem 0 2rem;
  }

  .cm-co__title {
    font-size: 1.2rem;
  }

  .cm-co__product {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .cm-co__product em {
    display: none;
  }

  .cm-co__thumb {
    width: 64px;
    height: 86px;
  }

  .cm-co__row {
    padding: 0.85rem 0.9rem;
  }

  .cm-co__side {
    padding: 1rem;
  }
}
