/* Shared product-card media buttons and sales row. */
.box-text-products h3.name { font: inherit; color: inherit; min-height: 48px; letter-spacing: normal; text-transform: none; }
.tts-product-card .box-image { position: relative; }
.tts-product-card .image-tools a.quick-view { display: none; }
.tts-product-card-tools { position: absolute; bottom: 6px; inset-inline: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.tts-product-card-tools a { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; margin: 0; padding: 5px; pointer-events: auto; }
.tts-product-card-tools .tts-card-quick-view { width: 36px; height: 36px; border: 1px solid #e6e6e6; border-radius: 4px; background: #fff; }
.tts-product-card-tools .tts-card-video { margin-left: auto; width: 40px; height: 34px; padding: 0; }
.tts-product-card .box-image .tts-product-card-tools a.tts-card-quick-view img { display: block; width: 24px; height: 24px; aspect-ratio: auto; }
.tts-product-card .box-image .tts-product-card-tools a.tts-card-video img { display: block; width: 34px; height: 24px; aspect-ratio: auto; }
.tts-product-card-tools a:hover { opacity: .75; }
.tts-product-card-tools a:focus-visible { outline: 2px solid #C9252C; outline-offset: 2px; }
.tts-product-card .tts-card-sales-row { display: flex; width: 100%; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 10px; color: #111; font-size: 13px; line-height: 1.5; }
.tts-card-sales strong { font-size: 16px; font-weight: 700; }
.tts-card-bestseller { flex-shrink: 0; padding: 3px 8px; color: #3783ff; background: #edf5ff; font-size: 12px; font-weight: 600; }
.category-catalog .catalog-products .tts-card-sales-row { order: 4; margin-top: 6px; }

/* Native dialog provides keyboard focus containment and Escape handling. */
body.tts-product-modal-open { overflow: hidden; }
.tts-product-modal { width: min(1100px, calc(100vw - 48px)); max-width: none; max-height: 90vh; max-height: 90dvh; margin: auto; padding: 0; border: 0; border-radius: 6px; background: #fff; color: #111; overflow: visible; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.tts-product-modal:not([open]) { display: none; }
.tts-product-modal::backdrop { background: rgba(0,0,0,.65); }
.tts-product-modal .tts-product-modal-close { position: absolute; top: -18px; right: -18px; z-index: 2; display: flex; align-items: center; justify-content: center; width: 38px; min-width: 0; height: 38px; min-height: 0; margin: 0; padding: 7px; border: 1px solid #eee; border-radius: 50% !important; background: #fff; color: #777; line-height: 1; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.tts-product-modal-close svg { width: 24px; height: 24px; }
.tts-product-modal-body { max-height: 90vh; max-height: 90dvh; overflow: auto; border-radius: 6px; overscroll-behavior: contain; }
.tts-product-modal button:focus-visible, .tts-product-modal a:focus-visible { outline: 2px solid #C9252C; outline-offset: 3px; }
.tts-product-modal-loading, .tts-product-modal-error { padding: 60px 24px; margin: 0; text-align: center; font-size: 15px; }
.tts-product-modal-error { color: #C9252C; }
.tts-quick-product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); min-height: 440px; }
.tts-quick-gallery { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 360px; background: #fff; }
.tts-quick-gallery-image { display: block; width: 100%; max-height: 70vh; aspect-ratio: 1 / 1; object-fit: contain; }
.tts-product-modal .tts-quick-gallery-prev, .tts-product-modal .tts-quick-gallery-next { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 36px; min-width: 0; height: 38px; margin: 0; padding: 7px; border: 0; border-radius: 4px; background: rgba(0,0,0,.2); color: #fff; }
.tts-quick-gallery-prev { left: 0; }
.tts-quick-gallery-next { right: 0; }
.tts-quick-gallery-prev svg, .tts-quick-gallery-next svg { width: 22px; height: 22px; }
.tts-quick-gallery-counter { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 3px 8px; border-radius: 3px; background: #f5f5f5; color: #777; font-size: 12px; }
.tts-quick-summary { min-width: 0; padding: 40px; background: #fafafa; }
.tts-quick-summary .tts-quick-title { margin: 0 0 16px; color: #111; font-size: 24px; font-weight: 700; line-height: 1.4; text-transform: uppercase; }
.tts-quick-description { font-size: 15px; line-height: 1.6; }
.tts-quick-description ul, .tts-quick-description ol { padding-left: 20px; margin-left: 0; }
.tts-quick-description li { margin-left: 0; margin-bottom: 10px; }
.tts-quick-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #e6e6e6; }
.tts-quick-actions a { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px; border: 1px solid #C9252C; border-radius: 4px; color: #C9252C; font-size: 13px; font-weight: 700; line-height: 1.4; text-align: center; }
.tts-quick-actions .tts-quick-details { background: #C9252C; color: #fff; }
.tts-quick-actions svg { flex-shrink: 0; width: 22px; height: 22px; }
.tts-quick-actions a[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.tts-quick-notice { margin: 12px 0 0; font-size: 13px; color: #C9252C; }
.tts-product-modal [hidden] { display: none !important; }
.tts-product-modal--video { width: min(1000px, calc(100vw - 48px)); background: #000; }
.tts-product-modal--video .tts-product-modal-body { aspect-ratio: 16 / 9; overflow: hidden; }
.tts-product-modal--video iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 849px) {
    .tts-product-modal { width: calc(100vw - 32px); }
    .tts-product-modal .tts-product-modal-close { top: -12px; right: -10px; width: 34px; height: 34px; }
    .tts-quick-product { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .tts-quick-gallery { min-height: 0; }
    .tts-quick-gallery-image { height: 36vh; height: 36dvh; max-height: 320px; }
    .tts-quick-summary { padding: 20px; }
    .tts-quick-summary .tts-quick-title { font-size: 20px; }
    .tts-quick-description { font-size: 14px; }
    .tts-quick-actions { gap: 8px; }
    .tts-quick-actions a { padding: 8px 6px; font-size: 12px; }
    .tts-quick-actions svg { width: 18px; height: 18px; }
}
@media (max-width: 576px) {
    .tts-product-card .tts-card-sales-row { gap: 4px; font-size: 11px; }
    .tts-card-sales strong { font-size: 13px; }
    .tts-card-sales-unit { display: none; }
    .tts-card-bestseller { padding: 3px 5px; font-size: 10px; }
    .tts-product-card-tools .tts-card-quick-view { width: 30px; height: 30px; padding: 2px; }
    .tts-product-card-tools .tts-card-video { width: 34px; padding: 0; }
}

/* DevVN supplies the Buy Now action; the theme only styles its button. */
.tts-product-card { --tts-card-cart-width: 50px; --tts-card-action-height: 38px; }
.category-catalog .tts-product-card { --tts-card-cart-width: 38px; }
section .tts-product-card.product .box-text-products .btns { align-items: stretch; gap: 8px; }
.tts-product-card .box-text-products .btns .add-to-cart-button { flex: 0 0 var(--tts-card-cart-width); }
section .tts-product-card.product .box-text-products .btns .add_to_cart_button { width: var(--tts-card-cart-width); height: var(--tts-card-action-height); }
section .tts-product-card.product .box-text-products .btns a.devvn_buy_now,
.tts-quick-actions a.devvn_buy_now {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    inset: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    margin-block: 0;
    height: var(--tts-card-action-height, 42px);
    min-height: 0;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #C9252C;
    border-radius: 4px;
    background: #C9252C;
    color: #fff;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: normal;
    text-align: center;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
}
section .tts-product-card.product .box-text-products .btns a.devvn_buy_now::before,
.tts-quick-actions a.devvn_buy_now::before {
    content: '';
    display: block;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin: 0;
    background: currentColor;
    -webkit-mask: url(../image/icon-buynow-l.svg) center / contain no-repeat;
    mask: url(../image/icon-buynow-l.svg) center / contain no-repeat;
    transform: none;
}
section .tts-product-card.product .box-text-products .btns a.devvn_buy_now:hover,
.tts-quick-actions a.devvn_buy_now:hover { background: #ae2026; border-color: #ae2026; color: #fff; }
section .tts-product-card.product .box-text-products .btns a.devvn_buy_now:focus-visible,
.tts-quick-actions a.devvn_buy_now:focus-visible { outline: 2px solid #C9252C; outline-offset: 3px; }
@media (max-width: 849px) {
    .tts-product-card, .category-catalog .tts-product-card { --tts-card-cart-width: 30px; --tts-card-action-height: 32px; }
    section .tts-product-card.product .box-text-products .btns { gap: 5px; }
    section .tts-product-card.product .box-text-products .btns a.devvn_buy_now { gap: 4px; padding-inline: 5px; font-size: 11px; }
    section .tts-product-card.product .box-text-products .btns a.devvn_buy_now::before { flex-basis: 15px; width: 15px; height: 15px; }
}

/* Compact product names and media controls on mobile. */
@media (max-width: 849px) {
    section .products .tts-product-card.product .box-text-products .name a { font-size: 14px !important; line-height: 1.45; }
    .tts-quick-summary .tts-quick-title { font-size: 18px; }
    .tts-product-card-tools .tts-card-quick-view { width: 28px; height: 28px; padding: 3px; }
    .tts-product-card .box-image .tts-product-card-tools a.tts-card-quick-view img { width: 20px; height: 20px; }
    .tts-product-card-tools .tts-card-video { width: 30px; height: 28px; padding: 0; }
    .tts-product-card .box-image .tts-product-card-tools a.tts-card-video img { width: 28px; height: 20px; }
}

/* One card presentation for category results and the related-product carousel. */
section .tts-product-list .tts-product-card.product { display: flex; flex-direction: column; height: auto; min-width: 0; }
section .tts-product-list .tts-product-card.product > .col-inner { display: flex; flex: 1; flex-direction: column; width: 100%; height: auto; padding: 12px; border: 1px solid #e6e6e6; border-radius: 4px; background: #fff; }
section .tts-product-list .tts-product-card .product.box { display: flex; flex: 1; flex-direction: column; height: auto; padding: 0; }
section .tts-product-list .tts-product-card .box-image { width: 100%; margin: 0; }
section .tts-product-list .tts-product-card .box-image > div:first-child > a { display: block; aspect-ratio: 4 / 3; }
section .tts-product-list .tts-product-card .box-image img { width: 100%; height: 100%; object-fit: contain; }
section .tts-product-list .tts-product-card .box-text-products { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 12px 0 0; }
section .tts-product-list .tts-product-card .price-wrapper { display: contents; }
section .tts-product-list .tts-product-card .box-text-products .star-rating { order: 1; height: 18px; margin: 0; }
section .tts-product-list .tts-product-card:not(:has(.star-rating)) .box-text-products::before { content: ''; order: 1; height: 18px; }
section .tts-product-list .tts-product-card .review-count { display: none; }
section .tts-product-list .tts-product-card .title-wrapper { order: 2; min-height: 51px; margin: 0; }
section .tts-product-list .tts-product-card .name { margin: 0; }
section .tts-product-list .tts-product-card .name a { font-weight: 700; line-height: 1.5; }
section .tts-product-list .tts-product-card .price { order: 3; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: auto; }
section .tts-product-list .tts-product-card .price del { font-size: 12px; color: #888; }
section .tts-product-list .tts-product-card .tts-card-sales-row { order: 4; min-height: 24px; margin: 0; }
section .tts-product-list .tts-product-card .btns { order: 5; align-items: stretch; margin-top: 2px; }
section .tts-product-list .tts-product-card { --tts-card-cart-width: 38px; }
.single-product :is(.related, .tts-recently-viewed) .tts-product-carousel { width: 100%; margin: 0; }
.single-product :is(.related, .tts-recently-viewed) .tts-product-carousel .slick-list { margin-inline: calc(-1 * var(--tts-related-gutter)); }
.single-product :is(.related, .tts-recently-viewed) .tts-product-carousel .slick-track { display: flex; }
.single-product :is(.related, .tts-recently-viewed) .tts-product-carousel .tts-product-card {
    display: flex;
    float: none;
    flex: 0 0 auto;
    max-width: none;
    height: auto;
}
.single-product :is(.related, .tts-recently-viewed) .tts-product-carousel:not(.slick-initialized) {
    display: flex;
    overflow: hidden;
}
.single-product :is(.related, .tts-recently-viewed) .tts-product-carousel:not(.slick-initialized) > .tts-product-card { width: 20%; }
@media (max-width: 849px) {
    .single-product :is(.related, .tts-recently-viewed) .tts-product-carousel:not(.slick-initialized) > .tts-product-card { width: 33.333333%; }
}
@media (max-width: 549px) {
    .single-product :is(.related, .tts-recently-viewed) .tts-product-carousel:not(.slick-initialized) > .tts-product-card { width: 50%; }
}
@media (max-width: 849px) {
    section .tts-product-list .tts-product-card.product > .col-inner { padding: 8px; }
    section .tts-product-list .tts-product-card .box-text-products { padding-top: 8px; gap: 6px; }
    section .tts-product-list .tts-product-card .title-wrapper { min-height: 40.6px; }
    section .tts-product-list .tts-product-card .name a { font-size: 14px !important; line-height: 1.45; }
    section .tts-product-list .tts-product-card .price { min-height: 44.8px; }
    section .tts-product-list .tts-product-card { --tts-card-cart-width: 30px; }
}

/* Current prices share one size across archive and carousel cards. */
.tts-product-card .price .amount { font-size: 24px; }
.tts-product-card .price del .amount { font-size: inherit; }
@media (max-width: 849px) {
    .tts-product-card .price .amount { font-size: 20px; }
    .tts-product-card .price del .amount { font-size: inherit; }
}
