/* ========================================
   HUEGO QUICK VIEW MODULE
======================================== */

.huego-qv-overlay {
    font-family: var(--huego-font-family);
}

.huego-qv-overlay {
    position: fixed;
    inset: 0;

    z-index: 999999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: var(--huego-color-overlay);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}


.huego-qv-overlay.is-open {
    opacity: 1;
    visibility: visible;
}


/* Không scroll trang khi popup mở */

body.huego-qv-open {
    overflow: hidden;
}


/* ========================================
   MODAL
======================================== */

.huego-qv-modal {
    position: relative;

    width: 100%;
    max-width: 820px;

    max-height: calc(100vh - 40px);

    overflow-y: auto;

    background: var(--huego-color-surface);

    border-radius: 16px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.2);

    transform: translateY(15px) scale(0.98);

    transition: transform 0.25s ease;
}


.huego-qv-overlay.is-open .huego-qv-modal {
    transform: translateY(0) scale(1);
}


/* ========================================
   CLOSE
======================================== */

.huego-qv-close {
    position: absolute;

    top: 14px;
    right: 14px;

    z-index: 10;

    width: 36px;
    height: 36px;

    padding: 0;

    border: 0;

    border-radius: 50%;

    background: var(--huego-color-surface);

    color: var(--huego-color-text-strong);

    font-size: 28px;
    line-height: 32px;

    cursor: pointer;

    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.12);
}


/* ========================================
   CONTENT
======================================== */

.huego-qv-content {
    min-height: 300px;
}


/* ========================================
   PRODUCT GRID
======================================== */

.huego-qv-product {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);

    gap: 36px;

    padding: 36px;
}


/* ========================================
   IMAGE
======================================== */

.huego-qv-product-image {
    width: 100%;
}


.huego-qv-image {
    display: block;

    width: 100%;
    height: auto;

    aspect-ratio: 1 / 1;

    object-fit: cover;

    border-radius: 12px;
}


/* ========================================
   PRODUCT INFO
======================================== */

.huego-qv-product-info {
    display: flex;
    flex-direction: column;

    justify-content: center;
}


.huego-qv-title {
    margin:
        0
        45px
        12px
        0;

    font-size: 26px;
    line-height: 1.3;

    font-weight: 600;
}


/* ========================================
   PRICE
======================================== */

.huego-qv-price {
    margin-bottom: 16px;

    color: var(--huego-color-accent);
    font-size: 32px;
    font-weight: var(--huego-font-weight-bold);
    line-height: 1.2;
}

.huego-qv-price .woocommerce-Price-amount,
.huego-qv-price .woocommerce-Price-currencySymbol,
.huego-qv-price bdi,
.huego-qv-price ins {
    color: inherit;
}

.huego-qv-price del {
    margin-right: 8px;
    color: var(--huego-color-text-muted);
    font-size: 0.68em;
    opacity: 0.72;
}

.huego-qv-price ins {
    text-decoration: none;
}


/* ========================================
   PRODUCT ATTRIBUTES
======================================== */

.huego-qv-attributes-wrap {
    width: 100%;
    margin: 0 0 20px;
    overflow: hidden;
    border: 1px solid var(--huego-color-border);
    border-radius: var(--huego-radius-sm);
    background: var(--huego-color-surface-soft);
}

.huego-qv-attributes {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
    background: transparent;
    color: var(--huego-color-text);
    font-size: 13px;
    line-height: 1.45;
}

.huego-qv-attributes th,
.huego-qv-attributes td {
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid var(--huego-color-border);
    background: transparent;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.huego-qv-attributes tr:last-child th,
.huego-qv-attributes tr:last-child td {
    border-bottom: 0;
}

.huego-qv-attributes th {
    width: 43%;
    color: var(--huego-color-primary);
    font-weight: var(--huego-font-weight-semibold);
}

.huego-qv-attributes td {
    color: var(--huego-color-text);
    font-weight: var(--huego-font-weight-regular);
}


/* ========================================
   DESCRIPTION
======================================== */

.huego-qv-description {
    margin-bottom: 25px;

    font-size: 15px;
    line-height: 1.7;
}


.huego-qv-description p:last-child {
    margin-bottom: 0;
}


/* ========================================
   BUY AREA
======================================== */

.huego-qv-buy {
    display: flex;

    gap: 12px;

    align-items: stretch;
}


/* ========================================
   QUANTITY
======================================== */

.huego-qv-quantity {
    display: flex;

    height: 46px;

    border: 1px solid var(--huego-color-border);

    border-radius: 7px;

    overflow: hidden;
}


.huego-qv-quantity button {
    width: 38px;

    border: none;

    background: var(--huego-color-surface-soft);

    cursor: pointer;

    font-size: 18px;
}


.huego-qv-qty {
    width: 48px;

    padding: 0;

    border: 0;

    border-left: 1px solid var(--huego-color-border);
    border-right: 1px solid var(--huego-color-border);

    text-align: center;

    outline: none;

    -moz-appearance: textfield;
}


.huego-qv-qty::-webkit-inner-spin-button,
.huego-qv-qty::-webkit-outer-spin-button {
    -webkit-appearance: none;

    margin: 0;
}


/* ========================================
   ADD CART
======================================== */

.huego-qv-add-cart,
.huego-qv-view-product {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 46px;

    padding: 10px 24px;

    border: 0;

    border-radius: 7px;

    background: var(--huego-color-primary);

    color: var(--huego-color-surface);

    font-size: 15px;
    font-weight: 600;

    text-decoration: none;

    cursor: pointer;
}


.huego-qv-add-cart:hover,
.huego-qv-view-product:hover {
    opacity: 0.9;

    color: var(--huego-color-surface);
}


.huego-qv-add-cart:disabled {
    opacity: 0.65;

    cursor: wait;
}


/* ========================================
   MESSAGE
======================================== */

.huego-qv-message {
    min-height: 24px;

    margin-top: 12px;

    font-size: 14px;
}


.huego-qv-message .success {
    color: var(--huego-color-success);
}


.huego-qv-message .error {
    color: var(--huego-color-error);
}


/* ========================================
   LOADING
======================================== */

.huego-qv-loading,
.huego-qv-error {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 300px;

    padding: 30px;

    text-align: center;
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 767px) {

    .huego-qv-overlay {
        padding: 12px;
    }


    .huego-qv-modal {
        max-height: calc(100vh - 24px);

        border-radius: 12px;
    }


    .huego-qv-product {
        grid-template-columns: 1fr;

        gap: 20px;

        padding: 20px;
    }


    .huego-qv-product-image {
        padding-top: 20px;
    }


    .huego-qv-title {
        margin-right: 35px;

        font-size: 21px;
    }


    .huego-qv-price {
        margin-bottom: 14px;
        font-size: 28px;
    }

    .huego-qv-attributes-wrap {
        margin-bottom: 16px;
    }

    .huego-qv-attributes {
        font-size: 12.5px;
    }

    .huego-qv-attributes th,
    .huego-qv-attributes td {
        padding: 8px 10px;
    }


    .huego-qv-buy {
        flex-direction: column;
    }


    .huego-qv-quantity {
        align-self: flex-start;
    }


    .huego-qv-add-cart {
        width: 100%;
    }

}

/* ========================================
   QUICK VIEW ACTIONS
======================================== */

.huego-qv-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;

    width: 100%;

    margin-top: 4px;
}


/* Nút Đặt hàng ngay */

.huego-qv-order-now {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 50px;

    padding: 12px 24px;

    border: 1px solid var(--huego-color-primary);
    border-radius: 8px;

    background: var(--huego-color-primary);

    color: var(--huego-color-white);

    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;

    text-align: center;
    text-decoration: none;
    text-transform: uppercase;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.huego-qv-order-now:hover,
.huego-qv-order-now:focus {
    background: var(--huego-color-primary-hover);
    border-color: var(--huego-color-primary-hover);

    color: var(--huego-color-white);

    transform: translateY(-1px);
}


/* Link xem chi tiết */

.huego-qv-product-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    align-self: center;

    margin-top: 14px;

    color: var(--huego-color-text-muted);

    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;

    text-align: center;
    text-decoration: underline;
    text-underline-offset: 4px;

    transition: color 0.2s ease;
}

.huego-qv-product-detail::after {
    content: "→";

    margin-left: 6px;

    text-decoration: none;
}

.huego-qv-product-detail:hover,
.huego-qv-product-detail:focus {
    color: var(--huego-color-primary);
}


/* Mobile */

@media (max-width: 767px) {

    .huego-qv-order-now {
        min-height: 48px;
        width: 100%;
    }

    .huego-qv-product-detail {
        margin-top: 12px;
    }

}

/* ========================================
   VARIABLE PRODUCT
======================================== */

.huego-qv-variation-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;

    margin-bottom: 14px;
}

.huego-qv-variation-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.huego-qv-variation-field label {
    color: var(--huego-color-text);

    font-size: 14px;
    font-weight: 600;
}

.huego-qv-variation-select {
    width: 100%;
    min-height: 44px;

    padding: 8px 38px 8px 12px;

    border: 1px solid var(--huego-color-border);
    border-radius: 7px;

    background-color: var(--huego-color-white);

    color: var(--huego-color-text);

    font-size: 14px;
}

.huego-qv-variation-select:focus {
    border-color: var(--huego-color-primary);
    outline: none;

    box-shadow: 0 0 0 2px var(--huego-color-focus-ring);
}

.huego-qv-selected-variation {
    min-height: 22px;

    margin-bottom: 14px;

    color: var(--huego-color-text-muted);

    font-size: 14px;
    line-height: 1.5;
}

.huego-qv-variation-error {
    color: var(--huego-color-error);
}

.huego-qv-order-now.is-disabled {
    border-color: var(--huego-color-border-strong);

    background: var(--huego-color-border);

    color: var(--huego-color-disabled-text);

    cursor: not-allowed;

    pointer-events: auto;

    transform: none;
}



/* ==========================================================================\n   HUEGO 2.0 alpha.3.1 — viewport-safe Quick View\n   ========================================================================== */
.huego-qv-overlay,
.huego-qv-modal,
.huego-qv-content,
.huego-qv-product,
.huego-qv-product-image,
.huego-qv-product-info {
    box-sizing: border-box;
    min-width: 0;
}

.huego-qv-overlay {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: contain;
}

.huego-qv-modal {
    width: min(820px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.huego-qv-content,
.huego-qv-product,
.huego-qv-product-image,
.huego-qv-product-info,
.huego-qv-product img {
    max-width: 100%;
}

@media (max-width: 767px) {
    .huego-qv-overlay {
        align-items: center;
        justify-content: center;
        padding: 10px;
    }

    .huego-qv-modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        margin: 0;
        border-radius: 14px;
    }

    .huego-qv-content {
        width: 100%;
        overflow-x: hidden;
    }

    .huego-qv-product {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 18px 16px 20px;
    }

    .huego-qv-product-image {
        width: 100%;
        padding-top: 12px;
    }

    .huego-qv-image {
        width: 100% !important;
        max-width: 100% !important;
        max-height: min(42dvh, 360px);
        aspect-ratio: 1 / 1;
        object-fit: contain;
    }

    .huego-qv-product-info {
        width: 100%;
    }

    .huego-qv-title {
        margin-right: 38px;
        overflow-wrap: anywhere;
    }

    .huego-qv-description {
        overflow-wrap: anywhere;
    }

    .huego-qv-variation-select,
    .huego-qv-order-now,
    .huego-qv-actions {
        max-width: 100%;
    }
}

/* HUEGO 2.0 alpha.5.1 — Settings-driven Quick View composition. */
.huego-qv-product.huego-qv-product--no-image{grid-template-columns:minmax(0,1fr)}
.huego-qv-product.huego-qv-product--no-image .huego-qv-product-info{max-width:none}

/* ========================================
   PRODUCT GALLERY — HUEGO FINAL
======================================== */
.huego-qv-product-gallery {
    min-width: 0;
}

.huego-qv-thumbs {
    display: flex;
    gap: var(--huego-space-sm, 8px);
    margin-top: var(--huego-space-sm, 8px);
    padding: 2px 1px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.huego-qv-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--huego-color-border);
    border-radius: var(--huego-radius-sm, 8px);
    background: var(--huego-color-surface);
    cursor: pointer;
}

.huego-qv-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.huego-qv-thumb.is-active {
    border-color: var(--huego-color-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--huego-color-primary) 12%, transparent);
}

.huego-qv-thumb:focus-visible {
    outline: 2px solid var(--huego-color-primary);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .huego-qv-thumb {
        flex-basis: 56px;
        width: 56px;
        height: 56px;
    }
}
