/* ------------------------------------------------------------------
   Shopee Voucher Widget — mọi selector đều scope trong .svw-root
   để không đụng CSS của theme.
   ------------------------------------------------------------------ */

.svw-root {
  --svw-orange: #ee4d2d;
  --svw-blue: #1876f2;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #222230;
  background: #fff;
  padding: 1rem 0;
}

.svw-root * { box-sizing: border-box; }

.svw-root .svw-heading {
  margin: 0 0 .35rem;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
}

.svw-root .svw-note {
  display: block;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: #6c757d;
}

/* ------------------------- Thanh lọc danh mục ------------------------- */

.svw-root .js-vtd-cats {
  cursor: pointer;
  display: grid;
  width: 100%;
  gap: .5rem;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  overflow-x: auto;
  margin: .5rem 0;
  padding-bottom: .5rem;
  text-align: center;
}

.svw-root .js-vtd-cats::-webkit-scrollbar { height: 5px; -webkit-appearance: none; }
.svw-root .js-vtd-cats::-webkit-scrollbar-thumb { background-color: #377dff; border-radius: 10px; }
.svw-root .js-vtd-cats::-webkit-scrollbar-track { background-color: #fff; border-radius: 10px; }

.svw-root .js-vtd-cats > span {
  min-width: 125px;
  color: #363642;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 8px;
  background-color: rgba(34, 34, 48, .08);
  border: 1px solid transparent;
  border-radius: .25rem;
  user-select: none;
}

.svw-root .js-vtd-cats > span.is-active,
.svw-root .js-vtd-cats > span.has-panel {
  color: #335eea;
  background-color: rgba(1, 147, 84, .2);
}

.svw-root .vtd-caret::after {
  content: "";
  display: inline-block;
  margin-left: .3em;
  border: .3em solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
  vertical-align: .15em;
}

.svw-root .vtd-dropdown { position: relative; }

.svw-root .vtd-menu {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  padding: .25rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: .25rem;
  box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
  text-align: left;
}

.svw-root .vtd-menu.is-open { display: block; }

.svw-root .vtd-menu .js-vtd-filter {
  display: block;
  width: 100%;
  padding: .375rem .75rem;
  margin-bottom: .25rem;
  border-radius: .25rem;
  font-size: 13px;
  color: #363642;
  background-color: rgba(34, 34, 48, .08);
  white-space: nowrap;
}

.svw-root .vtd-menu .js-vtd-filter:last-child { margin-bottom: 0; }
.svw-root .vtd-menu .js-vtd-filter:hover,
.svw-root .vtd-menu .js-vtd-filter.is-active { color: #335eea; background-color: rgba(1, 147, 84, .2); }

/* --- modal "Voucher Shop" --- */
.svw-root .vtd-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, .5);
  padding: 1.75rem 1rem;
  overflow-y: auto;
}

.svw-root .vtd-modal.is-open { display: block; }

.svw-root .vtd-modal__dialog {
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  border-radius: .3rem;
}

.svw-root .vtd-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
}

.svw-root .vtd-modal__header h5 { margin: 0; font-size: 1.25rem; font-weight: 500; }

.svw-root .vtd-modal__close {
  border: 0;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: .5;
}

.svw-root .vtd-modal__close:hover { opacity: 1; }
.svw-root .vtd-modal__body { padding: 1rem; }

.svw-root .vtd-modal__body .js-vtd-filter {
  display: inline-block;
  margin: .25rem;
  padding: .375rem .75rem;
  border-radius: .25rem;
  font-size: 13px;
  color: #363642;
  background-color: rgba(34, 34, 48, .08);
  cursor: pointer;
}

.svw-root .vtd-modal__body .js-vtd-filter:hover,
.svw-root .vtd-modal__body .js-vtd-filter.is-active { color: #335eea; background-color: rgba(1, 147, 84, .2); }

/* ---------------------------- Danh sách mã ---------------------------- */

.svw-root .bc_voucher_list {
  padding: 0 0 10px;
  margin: 0 auto;
  list-style: none;
  font-size: 14px;
}

/* Không set margin ở đây: sẽ đè mất "margin: 0 auto" căn giữa của .bc_voucher_item. */
.svw-root .bc_voucher_list li { list-style: none; padding: 0; }
.svw-root .bc_voucher_list a { text-decoration: none; box-shadow: none; }

.svw-root .bc_voucher_item {
  display: flex;
  align-items: stretch;
  background: #fff;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
  color: #000;
}

.svw-root .bc_voucher_item + .bc_voucher_item { margin-top: 1rem; }

/* --- cột logo --- */
.svw-root .bc_voucher_logo {
  display: inline-flex;
  flex: 0 0 auto;
  width: 106px;
  position: relative;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 4px 0 0 4px;
  color: #fff;
  padding: 1rem;
  text-align: center;
  background-color: var(--svw-orange);
}

.svw-root .bc_voucher_logo > img {
  object-fit: contain;
  border-radius: 100%;
  width: 60px;
  height: 60px;
  max-width: none;
  background: #fff;
  pointer-events: none;
}

.svw-root .bc_voucher_logo > span {
  font-size: 11px;
  line-height: 16px;
  margin-top: .2rem;
  max-width: 53px;
  color: #fff;
}

.svw-root .bc_voucher_logo::after {
  content: "";
  width: 10px;
  height: 20px;
  border-radius: 0 20px 20px 0;
  position: absolute;
  left: 0;
  bottom: calc(50% - 10px);
  background-color: #fff;
}

/* --- thân thẻ --- */
.svw-root .bc_voucher_info {
  display: flex;
  flex-direction: row;
  flex: 1 1 0%;
  border: 1px solid #ddd;
  border-left-width: 0;
  border-radius: 0 8px 8px 0;
  position: relative;
  padding: .5rem 1rem .5rem 0;
}

.svw-root .bc_voucher_info::after {
  content: "";
  width: 10px;
  height: 20px;
  position: absolute;
  right: -1px;
  bottom: calc(50% - 10px);
  background-color: #fff;
  border: 1px solid #ddd;
  border-right-color: #fff;
  border-radius: 20px 0 0 20px;
}

.svw-root .bc_voucher_divider { margin: .25rem; }

.svw-root .bc_voucher_content {
  display: flex;
  width: 100%;
  padding: .5rem .25rem;
  font-size: 14px;
  background-color: rgb(235 245 250);
  border-radius: 3px;
}

.svw-root .bc_voucher_content_main { flex: 1 1 0%; }
.svw-root .bc_voucher_title { overflow: hidden; line-height: 1rem; }

.svw-root .bc_voucher_label {
  display: inline-flex;
  padding: .1rem .5rem;
  border-radius: 3px;
  margin-right: .3rem;
  background-color: #ffe89b;
  color: #eb3600;
}

.svw-root .bc_voucher_process {
  display: inline-flex;
  width: 202px;
  height: 7px;
  border-radius: 6px;
  background-color: #e5e5e5;
  overflow: hidden;
  margin: 5px 0 2px;
}

.svw-root .bc_voucher_process > span {
  background-color: var(--svw-orange);
  background-image: linear-gradient(to right, yellow, red);
}

.svw-root .bc_voucher_desc_item {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 400;
  line-height: 20px;
}

.svw-root .bc_voucher_desc_item > svg { margin-right: 5px; flex: 0 0 auto; }
.svw-root .bc_voucher_desc_item > * { pointer-events: none; }
.svw-root .bc_voucher_color_red { color: var(--svw-orange); }
.svw-root .bc_voucher_color_blue { color: var(--svw-blue); }

.svw-root .bc_voucher_action { display: flex; flex-direction: column; }

@media (min-width: 768px) {
  .svw-root .bc_voucher_action > div:first-child { display: none; }
}

.svw-root .bc_voucher_button {
  background-color: var(--svw-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 3px;
  font-size: 14px;
  padding: .2rem 1rem;
  cursor: pointer;
  white-space: nowrap;
}

.svw-root .bc_voucher_button:not(:last-child) { margin-bottom: .5rem; }
.svw-root .bc_voucher_button > * { pointer-events: none; }
.svw-root .bc_voucher_button > svg { margin-right: .5rem; flex: 0 0 auto; }
.svw-root .bc_voucher_button.is-copied { background-color: #0072f5; }

/* ---------------------------- Phân trang ---------------------------- */

.svw-root .svw-paging {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding-left: 0;
  margin: 1rem 0 0;
  list-style: none;
}

.svw-root .svw-paging .page-link {
  display: block;
  border-radius: 3rem;
  padding: .5rem .75rem;
  line-height: 1.25;
  color: #222230;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.svw-root .svw-paging .page-link:hover { color: #346cb0; background-color: rgba(52, 108, 176, .08); }
.svw-root .svw-paging .page-link.is-active { color: #346cb0; font-weight: 700; }
.svw-root .svw-paging .page-link.is-disabled { opacity: .35; pointer-events: none; }

.svw-root .svw-total {
  margin: .5rem 0 0;
  text-align: center;
  font-size: 12px;
  color: #6c757d;
}

.svw-root .svw-state {
  text-align: center;
  padding: 2rem 0;
  color: #6c757d;
  list-style: none;
}

/* ---------------------------- Mobile ---------------------------- */

@media (max-width: 576px) {
  .svw-root .bc_voucher_logo { width: 80px; min-height: 114px; padding: .5rem; }
  .svw-root .bc_voucher_logo > img { width: 44px; height: 44px; }
  .svw-root .bc_voucher_info { padding: .5rem .5rem .5rem 0; }

  .svw-root .bc_voucher_content {
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: .25rem;
  }

  .svw-root .bc_voucher_title > span { font-size: 12px; }
  .svw-root .bc_voucher_process { width: 100%; }
  .svw-root .bc_voucher_desc > .bc_voucher_desc_item:last-child { display: none; }

  .svw-root .bc_voucher_action { flex-direction: row; align-items: center; }
  .svw-root .bc_voucher_action_mobile { display: flex; width: 100%; }

  .svw-root .bc_voucher_action > .bc_voucher_buttons {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    flex-direction: row-reverse;
  }

  .svw-root .bc_voucher_button {
    margin-bottom: 0 !important;
    height: 1rem;
    font-size: 11px;
    padding: .1rem .5rem;
  }

  .svw-root .bc_voucher_button:not(:first-child) { margin-right: 4px; }
  .svw-root .bc_voucher_button > svg { height: 10px; width: 10px; margin-right: .2rem; }
}
