/**
 * Cart drawer Rovina - dung token brand co san trong style.css.
 * Khong khai bao mau moi.
 */

.rv-cd {
  position: fixed;
  inset: 0;
  z-index: 99999;
  visibility: hidden;
  pointer-events: none;
}

.rv-cd.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* --- Overlay --- */
.rv-cd__overlay {
  position: absolute;
  inset: 0;
  background: rgba(43, 9, 9, 0.45);
  opacity: 0;
  transition: opacity 380ms cubic-bezier(0.32, 0.72, 0, 1);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.rv-cd.is-open .rv-cd__overlay { opacity: 1; }

/* --- Panel --- */
.rv-cd__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--rovina-background);
  box-shadow: -8px 0 40px rgba(43, 9, 9, 0.18);
  transform: translateX(100%);
  transition: transform 380ms cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.rv-cd.is-open .rv-cd__panel { transform: translateX(0); }

.rv-cd__panel.is-busy { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .rv-cd__overlay,
  .rv-cd__panel { transition: none; }
}

/* --- Head --- */
.rv-cd__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rovina-border);
  flex: 0 0 auto;
}

.rv-cd__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--rovina-font-head);
  font-size: 19px;
  font-weight: 600;
  color: var(--rovina-dark);
}

.rv-cd__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 23px;
  padding: 0 7px;
  font-family: var(--rovina-font-body);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--rovina-primary);
  border-radius: var(--rovina-radius-badge);
}

.rv-cd__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--rovina-dark);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background 160ms ease;
}

.rv-cd__close:hover { background: rgba(147, 51, 51, 0.08); }

/* --- Body --- */
.rv-cd__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 20px;
}

/* --- Free shipping / BXGY progress --- */
.rv-cd__ship {
  padding: 14px 16px;
  margin-bottom: 16px;
  background: rgba(147, 51, 51, 0.06);
  border: 1px solid rgba(147, 51, 51, 0.16);
  border-radius: var(--rovina-radius-card);
}

.rv-cd__ship.is-done {
  background: rgba(34, 139, 87, 0.08);
  border-color: rgba(34, 139, 87, 0.28);
}

.rv-cd__ship-msg {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--rovina-dark);
}

.rv-cd__ship-msg strong { font-weight: 700; }

.rv-cd__ship.is-done .rv-cd__ship-msg { color: #1d6b45; }

.rv-cd__ship-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  font-size: 11px;
  color: #fff;
  background: #228b57;
  border-radius: 50%;
  vertical-align: -3px;
}

/* wc_price chen <span class="woocommerce-Price-amount"> vao trong <strong> */
.rv-cd__ship-msg .woocommerce-Price-amount {
  font-weight: 700;
  color: var(--rovina-primary);
}

.rv-cd__ship.is-done .rv-cd__ship-msg .woocommerce-Price-amount { color: #1d6b45; }

.rv-cd__ship-bar {
  position: relative;
  height: 7px;
  overflow: hidden;
  background: rgba(43, 9, 9, 0.1);
  border-radius: var(--rovina-radius-badge);
}

.rv-cd__ship-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--rovina-primary) 0%,
    var(--rovina-primary-dark) 100%
  );
  border-radius: var(--rovina-radius-badge);
  transition: width 520ms cubic-bezier(0.32, 0.72, 0, 1);
}

.rv-cd__ship.is-done .rv-cd__ship-bar > span {
  background: linear-gradient(90deg, #2ea86a 0%, #1d6b45 100%);
}

/* Nut nang cap len Buy 3 Get 3 */
.rv-cd__upgrade {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 11px;
  padding: 10px 14px;
  font-family: var(--rovina-font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--rovina-primary);
  background: #fff;
  border: 1.5px solid var(--rovina-primary);
  border-radius: var(--rovina-radius-button);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.rv-cd__upgrade:hover {
  color: #fff;
  background: var(--rovina-primary);
}

/* --- Danh sach san pham --- */
.rv-cd__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rv-cd__item {
  display: flex;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--rovina-border);
  transition: opacity 260ms ease, transform 260ms ease;
}

.rv-cd__item.is-going {
  opacity: 0;
  transform: translateX(22px);
}

.rv-cd__thumb {
  flex: 0 0 78px;
  width: 78px;
  overflow: hidden;
  background: #faf7f7;
  border: 1px solid var(--rovina-border);
  border-radius: var(--rovina-radius-product);
}

.rv-cd__thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.rv-cd__info {
  flex: 1 1 auto;
  min-width: 0;
}

.rv-cd__name {
  margin: 0 0 5px;
  font-family: var(--rovina-font-head);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.32;
  color: var(--rovina-dark);
}

/* Badge qua tang - diem nhan cho deal BXGY */
.rv-cd__gift {
  display: inline-block;
  margin-bottom: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1d6b45;
  background: rgba(34, 139, 87, 0.13);
  border-radius: var(--rovina-radius-badge);
}

.rv-cd__deal {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(43, 9, 9, 0.6);
}

.rv-cd__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* --- Qty stepper --- */
.rv-cd__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rovina-border);
  border-radius: var(--rovina-radius-input);
}

.rv-cd__qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--rovina-dark);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 140ms ease;
}

.rv-cd__qty-btn:hover { color: var(--rovina-primary); }

.rv-cd__qty-val {
  min-width: 26px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--rovina-dark);
}

.rv-cd__price {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--rovina-dark);
  white-space: nowrap;
}

.rv-cd__remove {
  margin-top: 7px;
  padding: 0;
  font-size: 12px;
  color: rgba(43, 9, 9, 0.5);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 140ms ease;
}

.rv-cd__remove:hover { color: var(--rovina-primary); }

/* --- O ghi chu --- */
.rv-cd__note { margin-top: 18px; }

.rv-cd__note-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--rovina-dark);
}

.rv-cd__note-label span {
  font-weight: 400;
  color: rgba(43, 9, 9, 0.5);
}

.rv-cd__note-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--rovina-font-body);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--rovina-dark);
  background: #fff;
  border: 1px solid var(--rovina-border);
  border-radius: var(--rovina-radius-input);
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.rv-cd__note-input:focus {
  border-color: var(--rovina-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(147, 51, 51, 0.12);
}

.rv-cd__note-saved {
  display: block;
  height: 15px;
  margin-top: 4px;
  font-size: 11.5px;
  color: #1d6b45;
  opacity: 0;
  transition: opacity 240ms ease;
}

.rv-cd__note-saved.is-on { opacity: 1; }

/* --- Totals --- */
.rv-cd__totals {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--rovina-border);
}

.rv-cd__total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  color: var(--rovina-dark);
}

.rv-cd__total-row strong {
  font-size: 18px;
  font-weight: 700;
}

.rv-cd__tax {
  margin: 5px 0 0;
  font-size: 12px;
  color: rgba(43, 9, 9, 0.55);
}

/* --- Footer --- */
.rv-cd__foot {
  flex: 0 0 auto;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--rovina-border);
}

.rv-cd__checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  font-family: var(--rovina-font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  background: var(--rovina-primary);
  border-radius: var(--rovina-radius-button);
  transition: background 170ms ease, transform 170ms ease;
}

.rv-cd__checkout:hover {
  color: #fff;
  background: var(--rovina-primary-dark);
  transform: translateY(-1px);
}

.rv-cd__viewcart {
  display: block;
  margin-top: 9px;
  font-size: 13px;
  color: rgba(43, 9, 9, 0.65);
  text-align: center;
  text-decoration: underline;
}

.rv-cd__viewcart:hover { color: var(--rovina-primary); }

.rv-cd__guarantee {
  margin: 9px 0 0;
  font-size: 11.5px;
  color: rgba(43, 9, 9, 0.5);
  text-align: center;
}

/* --- Empty --- */
.rv-cd__empty {
  padding: 46px 12px;
  text-align: center;
}

.rv-cd__empty-title {
  margin: 0 0 7px;
  font-family: var(--rovina-font-head);
  font-size: 17px;
  font-weight: 600;
  color: var(--rovina-dark);
}

.rv-cd__empty-sub {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(43, 9, 9, 0.6);
}

.rv-cd__empty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 28px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: var(--rovina-primary);
  border-radius: var(--rovina-radius-button);
}

.rv-cd__empty-btn:hover {
  color: #fff;
  background: var(--rovina-primary-dark);
}

/* --- Loading + loi --- */
.rv-cd__loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
}

.rv-cd__loading.is-on { display: flex; }

.rv-cd__loading span {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(147, 51, 51, 0.25);
  border-top-color: var(--rovina-primary);
  border-radius: 50%;
  animation: rv-cd-spin 640ms linear infinite;
}

@keyframes rv-cd-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rv-cd__loading span { animation-duration: 1.6s; }
}

.rv-cd__error {
  margin: 0;
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
  font-size: 13px;
  color: #fff;
  background: var(--rovina-primary);
  transition: max-height 260ms ease, padding 260ms ease;
}

.rv-cd__error.is-on {
  max-height: 80px;
  padding: 11px 20px;
}

/* --- Bubble dem tren icon gio --- */
.rv-header__bubble.is-pop { animation: rv-cd-pop 380ms cubic-bezier(0.32, 0.72, 0, 1); }

@keyframes rv-cd-pop {
  0% { transform: scale(0.5); }
  55% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* --- Khoa scroll khi drawer mo --- */
body.rv-lock { overflow: hidden; }

/* --- Trang thai nut Add to cart khi dang gui --- */
.single_add_to_cart_button.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.single_add_to_cart_button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 19px;
  height: 19px;
  margin: -9.5px 0 0 -9.5px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rv-cd-spin 640ms linear infinite;
}

/* --- Mobile --- */
@media (max-width: 480px) {
  .rv-cd__panel { width: 100vw; }
  .rv-cd__head { padding: 15px 16px; }
  .rv-cd__body { padding: 14px 16px 18px; }
  .rv-cd__foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .rv-cd__thumb { flex-basis: 66px; width: 66px; }

  /* Tap target >= 44px cho de bam */
  .rv-cd__qty-btn { width: 38px; height: 38px; }
  .rv-cd__remove { padding: 6px 0; }
}
