/* ==========================================================
   HV Quick View – popup xem nhanh sản phẩm + thông báo giỏ hàng
   ========================================================== */
.hv-qv {
    --qv-primary: var(--hv-ink, #1f1f1f);
    --qv-accent: var(--hv-red, #c62828);
    --qv-text: #1d2733;
    --qv-muted: #6b7684;
    --qv-border: #e8e4dd;
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    pointer-events: none;
    font-family: var(--e-global-typography-primary-font-family, "Roboto Flex"), sans-serif;
    color: var(--qv-text);
}

.hv-qv.is-open {
    visibility: visible;
    pointer-events: auto;
}

.hv-qv-lock,
.hv-qv-lock body {
    overflow: hidden;
}

.hv-qv__overlay {
    position: absolute;
    inset: 0;
    background: rgba(28, 22, 16, .55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .3s ease;
}

.hv-qv.is-open .hv-qv__overlay {
    opacity: 1;
}

.hv-qv__dialog {
    position: relative;
    width: min(1000px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
    outline: none;
    opacity: 0;
    transform: translateY(24px) scale(.97);
    transition: opacity .3s ease, transform .4s cubic-bezier(.2, .7, .2, 1);
    overscroll-behavior: contain;
}

.hv-qv.is-open .hv-qv__dialog {
    opacity: 1;
    transform: none;
}

.hv-qv .hv-qv__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f3f1ed;
    color: var(--qv-text);
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .3s ease;
}

.hv-qv .hv-qv__close:hover {
    background: var(--hv-ink, #1f1f1f);
    color: #fff;
    transform: rotate(90deg);
}

/* ---------- Bố cục ---------- */
.hv-qv__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 36px;
    padding: 28px;
}

/* Gallery */
.hv-qv__gallery {
    min-width: 0;
}

.hv-qv__main {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 18px;
    background: #f6f4f0;
}

.hv-qv__img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: contain;
    opacity: 0;
    transform: scale(1.03);
    transition: opacity .35s ease, transform .5s ease;
}

.hv-qv__img.is-active {
    opacity: 1;
    transform: none;
}

.hv-qv .hv-qv__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: var(--qv-text);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity .25s ease, background .2s ease, color .2s ease;
}

.hv-qv__nav--prev {
    left: 12px;
}

.hv-qv__nav--next {
    right: 12px;
}

.hv-qv__main:hover .hv-qv__nav,
.hv-qv .hv-qv__nav:focus-visible {
    opacity: 1;
}

.hv-qv .hv-qv__nav:hover {
    background: var(--qv-primary);
    color: #fff;
}

.hv-qv__counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(29, 39, 51, .65);
    color: #fff;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.hv-qv__thumbs {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.hv-qv__thumbs::-webkit-scrollbar {
    display: none;
}

.hv-qv .hv-qv__thumb {
    flex: 0 0 72px;
    height: 72px;
    padding: 4px;
    overflow: hidden;
    border: 1.5px solid transparent;
    border-radius: 12px;
    background: #f6f4f0;
    cursor: pointer;
    opacity: .65;
    transition: border-color .2s ease, opacity .2s ease;
}

.hv-qv__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.hv-qv .hv-qv__thumb:hover,
.hv-qv .hv-qv__thumb.is-active {
    border-color: var(--qv-primary);
    opacity: 1;
}

/* Thông tin */
.hv-qv__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 8px 8px 4px 0;
}

.hv-qv__cat {
    align-self: flex-start;
    margin-bottom: 8px;
    color: var(--qv-accent) !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-decoration: none !important;
    text-transform: uppercase;
}

.hv-qv__title {
    margin: 0 44px 12px 0;
    color: var(--qv-primary);
    font-size: clamp(21px, 2.2vw, 27px);
    font-weight: 700;
    line-height: 1.3;
}

.hv-qv__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-bottom: 18px;
    color: var(--qv-muted);
    font-size: 13.5px;
}

.hv-qv__meta strong {
    color: var(--qv-text);
    font-weight: 600;
}

.hv-qv__stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.hv-qv__stock::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
}

.hv-qv__stock.is-in {
    color: #2e7d32;
}

.hv-qv__stock.is-out {
    color: #b42318;
}

.hv-qv__rating {
    color: #e0a12b;
    font-weight: 600;
}

.hv-qv__rating em {
    color: var(--qv-muted);
    font-style: normal;
    font-weight: 400;
}

.hv-qv__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    padding: 14px 0;
    border-top: 1px solid var(--qv-border);
    border-bottom: 1px solid var(--qv-border);
}

.hv-qv__price-now {
    color: var(--qv-accent);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}

.hv-qv__price-now small {
    color: var(--qv-muted);
    font-size: 14px;
    font-weight: 500;
}

.hv-qv__price-old {
    color: #9aa3ad;
    font-size: 16px;
}

.hv-qv__price-off {
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--qv-accent) 12%, #fff);
    color: var(--qv-accent);
    font-size: 12.5px;
    font-weight: 700;
}

/* Thông số dạng 2 cột nhãn – giá trị */
.hv-qv__specs {
    display: grid;
    gap: 0;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.hv-qv__specs li {
    display: grid;
    grid-template-columns: minmax(110px, 40%) minmax(0, 1fr);
    gap: 12px;
    margin: 0;
    padding: 9px 0;
    border-bottom: 1px dashed var(--qv-border);
    font-size: 14px;
    line-height: 1.45;
}

.hv-qv__specs li:last-child {
    border-bottom: 0;
}

.hv-qv__specs span {
    color: var(--qv-muted);
}

.hv-qv__specs strong {
    color: var(--qv-text);
    font-weight: 600;
}

.hv-qv__desc {
    margin-top: 16px;
    color: var(--qv-muted);
    font-size: 14.5px;
    line-height: 1.65;
}

.hv-qv__desc p {
    margin: 0;
}

/* Mua hàng */
.hv-qv__buy {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.hv-qv__qty {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 52px;
    overflow: hidden;
    border: 1.5px solid var(--qv-border);
    border-radius: 999px;
}

.hv-qv .hv-qv__qty-btn {
    width: 44px;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--qv-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.hv-qv .hv-qv__qty-btn:hover {
    background: #f3f1ed;
    color: var(--qv-primary);
}

.hv-qv .hv-qv__qty input {
    width: 44px;
    height: 100%;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--qv-text);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.hv-qv .hv-qv__qty input::-webkit-outer-spin-button,
.hv-qv .hv-qv__qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hv-qv .hv-qv__add {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 52px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    background: var(--hv-ink, #1f1f1f);
    color: #fff !important;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .02em;
    text-decoration: none !important;
    cursor: pointer;
    transition: background .25s ease, box-shadow .25s ease;
}

.hv-qv .hv-qv__add:hover {
    background: var(--hv-ink-hover, #6e6969);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

.hv-qv .hv-qv__add.is-link {
    flex: none;
    margin-top: 22px;
}

.hv-qv .hv-qv__add.is-muted {
    background: #8b8f94;
}

.hv-qv__add-done {
    display: none;
}

.hv-qv .hv-qv__add.is-done {
    background: #2e7d32;
}

.hv-qv .hv-qv__add.is-done .hv-qv__add-label {
    display: none;
}

.hv-qv .hv-qv__add.is-done .hv-qv__add-done {
    display: inline;
}

.hv-qv .hv-qv__add.is-loading {
    color: transparent !important;
    pointer-events: none;
}

.hv-qv .hv-qv__add.is-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hv-qv-spin .7s linear infinite;
}

@keyframes hv-qv-spin {
    to {
        transform: rotate(360deg);
    }
}

.hv-qv__notice {
    margin: 10px 0 0;
    color: #b42318;
    font-size: 13.5px;
}

.hv-qv__notice:empty {
    display: none;
}

.hv-qv__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin-top: 18px;
    color: var(--qv-primary) !important;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none !important;
}

.hv-qv__more:hover {
    color: var(--qv-accent) !important;
}

.hv-qv__more svg {
    transition: transform .25s ease;
}

.hv-qv__more:hover svg {
    transform: translateX(4px);
}

.hv-qv__error {
    margin: 0;
    padding: 60px 28px;
    color: var(--qv-muted);
    text-align: center;
}

/* Khung chờ tải */
.hv-skel {
    display: block;
    border-radius: 10px;
    background: linear-gradient(90deg, #f1eee9 0%, #f8f6f2 50%, #f1eee9 100%);
    background-size: 200% 100%;
    animation: hv-skel 1.2s ease-in-out infinite;
}

.hv-skel--line {
    height: 14px;
    margin-bottom: 14px;
}

.hv-skel--title {
    height: 30px;
    width: 85%;
    margin-bottom: 14px;
}

.hv-skel--price {
    height: 36px;
    width: 40%;
    margin: 6px 0 18px;
}

.hv-skel--block {
    height: 150px;
    margin-bottom: 18px;
}

.hv-skel--btn {
    height: 52px;
    border-radius: 999px;
}

@keyframes hv-skel {
    to {
        background-position: -200% 0;
    }
}

/* ---------- Mobile: tấm trượt từ dưới lên ---------- */
@media (max-width: 767px) {
    .hv-qv {
        align-items: flex-end;
        padding: 0;
    }

    .hv-qv__dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 22px 22px 0 0;
        transform: translateY(100%);
    }

    .hv-qv__dialog::before {
        content: "";
        position: sticky;
        top: 8px;
        z-index: 4;
        display: block;
        width: 44px;
        height: 4px;
        margin: 8px auto -12px;
        border-radius: 4px;
        background: #d9d4cc;
    }

    .hv-qv__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        padding: 18px 16px 24px;
    }

    .hv-qv .hv-qv__close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .hv-qv__main {
        aspect-ratio: 4 / 3;
    }

    .hv-qv .hv-qv__nav {
        opacity: 1;
        width: 34px;
        height: 34px;
    }

    .hv-qv .hv-qv__thumb {
        flex-basis: 58px;
        height: 58px;
    }

    .hv-qv__info {
        padding: 0;
    }

    .hv-qv__title {
        margin-right: 0;
    }

    .hv-qv__price-now {
        font-size: 24px;
    }

    /* Nút mua dính đáy màn hình */
    .hv-qv__buy {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin: 18px -16px 0;
        padding: 12px 16px;
        background: #fff;
        box-shadow: 0 -8px 20px rgba(0, 0, 0, .06);
    }

    .hv-qv__qty,
    .hv-qv .hv-qv__add {
        height: 48px;
    }
}

/* ==========================================================
   Thông báo nhỏ "Đã thêm vào giỏ"
   ========================================================== */
.hv-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 100002;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 32px);
    padding: 12px 14px 12px 12px;
    border-radius: 14px;
    background: #1d2733;
    color: #fff;
    font-family: var(--e-global-typography-primary-font-family, "Roboto Flex"), sans-serif;
    font-size: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
    transition: opacity .3s ease, transform .4s cubic-bezier(.2, .7, .2, 1);
}

.hv-toast.is-show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.hv-toast__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2e7d32;
    font-size: 14px;
    font-weight: 700;
}

.hv-toast.is-error .hv-toast__icon {
    background: #b42318;
}

.hv-toast__link {
    margin-left: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff !important;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none !important;
}

.hv-toast__link:hover {
    background: rgba(255, 255, 255, .22);
}

@media (prefers-reduced-motion: reduce) {
    .hv-qv *,
    .hv-qv__dialog,
    .hv-toast {
        transition: none !important;
        animation: none !important;
    }
}

/* WooCommerce tự chèn link "Xem giỏ hàng" sau nút – đã có trong thông báo nên ẩn đi */
.hv-qv .added_to_cart,
.hv-pcard__actions .added_to_cart {
    display: none !important;
}

/* Bỏ viền / nền focus mặc định của theme Hello trên các nút trong popup */
.hv-qv button:focus {
    outline: none;
}

.hv-qv button:focus-visible,
.hv-qv a:focus-visible {
    outline: 2px solid var(--qv-primary);
    outline-offset: 2px;
}

@media (hover: none) {
    .hv-qv .hv-qv__thumb:hover:not(.is-active) {
        border-color: transparent;
        opacity: .65;
    }

    .hv-qv .hv-qv__nav:hover,
    .hv-qv .hv-qv__qty-btn:hover {
        background: rgba(255, 255, 255, .9);
        color: var(--qv-text);
    }

    .hv-qv .hv-qv__qty-btn:hover {
        background: transparent;
    }
}
