/* ==========================================================================
   Product Quick View — front-end styles
   ========================================================================== */

:root {
    --pqv-bg: #ffffff;
    --pqv-fg: #1a1a1a;
    --pqv-muted: #6b6b6b;
    --pqv-border: #e5e5e5;
    --pqv-accent: #111111;
    --pqv-accent-fg: #ffffff;
    --pqv-sale: #c0392b;
    --pqv-radius: 10px;
    --pqv-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    --pqv-transition: 200ms ease;
    --pqv-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- Grid ---- */
.pqv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    font-family: var(--pqv-font);
    color: var(--pqv-fg);
}

@media (min-width: 900px) {
    .pqv-grid[data-pqv-cols="2"] { grid-template-columns: repeat(2, 1fr); }
    .pqv-grid[data-pqv-cols="3"] { grid-template-columns: repeat(3, 1fr); }
    .pqv-grid[data-pqv-cols="4"] { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Card ---- */
.pqv-card {
    background: var(--pqv-bg);
    border: 1px solid var(--pqv-border);
    border-radius: var(--pqv-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--pqv-transition), box-shadow var(--pqv-transition);
}

.pqv-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.pqv-card__media {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f4f4f4;
}

.pqv-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 400ms ease;
}

.pqv-card:hover .pqv-card__media img {
    transform: scale(1.05);
}

.pqv-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 999px;
    background: var(--pqv-sale);
    color: #fff;
    z-index: 2;
}

.pqv-quick-view-btn {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translate(-50%, 20px);
    opacity: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: var(--pqv-accent);
    color: var(--pqv-accent-fg);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--pqv-transition), transform var(--pqv-transition);
    z-index: 2;
}

.pqv-quick-view-btn svg {
    width: 16px;
    height: 16px;
}

.pqv-card:hover .pqv-quick-view-btn,
.pqv-card:focus-within .pqv-quick-view-btn {
    opacity: 1;
    transform: translate(-50%, 0);
}

.pqv-quick-view-btn:hover {
    background: #000;
}

.pqv-card__body {
    padding: 16px;
}

.pqv-card__title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.pqv-card__price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 15px;
}

.pqv-price {
    font-weight: 600;
}

.pqv-price--sale {
    color: var(--pqv-sale);
}

.pqv-price--orig {
    color: var(--pqv-muted);
    text-decoration: line-through;
    font-weight: 400;
    font-size: 13px;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.pqv-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity var(--pqv-transition), visibility 0s linear var(--pqv-transition);
    font-family: var(--pqv-font);
    color: var(--pqv-fg);
}

.pqv-modal.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--pqv-transition);
}

.pqv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.pqv-modal__dialog {
    position: relative;
    background: var(--pqv-bg);
    width: min(960px, 94vw);
    max-height: 92vh;
    border-radius: var(--pqv-radius);
    box-shadow: var(--pqv-shadow);
    overflow: hidden;
    transform: translateY(20px) scale(0.98);
    transition: transform var(--pqv-transition);
    display: flex;
    flex-direction: column;
}

.pqv-modal.is-open .pqv-modal__dialog {
    transform: translateY(0) scale(1);
}

.pqv-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--pqv-fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background var(--pqv-transition);
}

.pqv-modal__close:hover {
    background: #fff;
}

.pqv-modal__close svg {
    width: 18px;
    height: 18px;
}

.pqv-modal__content {
    overflow-y: auto;
}

/* ---- Modal layout ---- */
.pqv-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 760px) {
    .pqv-detail {
        grid-template-columns: 1fr 1fr;
    }
}

/* ---- Gallery ---- */
.pqv-gallery {
    background: #f4f4f4;
    position: relative;
    min-height: 320px;
}

.pqv-gallery__main {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.pqv-gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 250ms ease;
}

.pqv-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--pqv-fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background var(--pqv-transition);
}

.pqv-gallery__nav:hover {
    background: #fff;
}

.pqv-gallery__nav svg {
    width: 18px;
    height: 18px;
}

.pqv-gallery__nav--prev { left: 12px; }
.pqv-gallery__nav--next { right: 12px; }

.pqv-gallery__thumbs {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    background: #f4f4f4;
}

.pqv-gallery__thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color var(--pqv-transition);
}

.pqv-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pqv-gallery__thumb.is-active {
    border-color: var(--pqv-accent);
}

/* ---- Info panel ---- */
.pqv-info {
    padding: 28px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

@media (min-width: 760px) {
    .pqv-info {
        padding: 40px 36px;
        max-height: 92vh;
        overflow-y: auto;
    }
}

.pqv-info__title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.pqv-info__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--pqv-muted);
}

.pqv-stars {
    display: inline-flex;
    gap: 2px;
    color: #f5a623;
}

.pqv-stars svg {
    width: 14px;
    height: 14px;
}

.pqv-info__price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 20px;
}

.pqv-info__description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--pqv-muted);
    margin: 0;
}

/* ---- Option groups ---- */
.pqv-options__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.pqv-options__label span {
    font-weight: 400;
    color: var(--pqv-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}

.pqv-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pqv-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    outline: 1px solid var(--pqv-border);
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: transform var(--pqv-transition), outline-color var(--pqv-transition);
}

.pqv-color:hover {
    transform: scale(1.08);
}

.pqv-color.is-active {
    outline: 2px solid var(--pqv-accent);
    outline-offset: 2px;
}

.pqv-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pqv-size {
    min-width: 48px;
    padding: 10px 14px;
    border: 1px solid var(--pqv-border);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: border-color var(--pqv-transition), background var(--pqv-transition);
}

.pqv-size:hover {
    border-color: var(--pqv-accent);
}

.pqv-size.is-active {
    background: var(--pqv-accent);
    color: var(--pqv-accent-fg);
    border-color: var(--pqv-accent);
}

/* ---- Quantity + cart ---- */
.pqv-actions {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
}

.pqv-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--pqv-border);
    border-radius: 8px;
    overflow: hidden;
}

.pqv-qty__btn {
    width: 44px;
    height: 48px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    font-family: inherit;
    color: var(--pqv-fg);
    transition: background var(--pqv-transition);
}

.pqv-qty__btn:hover {
    background: #f2f2f2;
}

.pqv-qty__input {
    width: 54px;
    height: 48px;
    border: none;
    border-left: 1px solid var(--pqv-border);
    border-right: 1px solid var(--pqv-border);
    text-align: center;
    font-size: 15px;
    font-family: inherit;
    -moz-appearance: textfield;
}

.pqv-qty__input::-webkit-outer-spin-button,
.pqv-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pqv-add-to-cart {
    flex: 1;
    min-width: 200px;
    height: 48px;
    border: none;
    border-radius: 8px;
    background: var(--pqv-accent);
    color: var(--pqv-accent-fg);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background var(--pqv-transition);
}

.pqv-add-to-cart:hover {
    background: #000;
}

.pqv-add-to-cart.is-added {
    background: #27ae60;
}

.pqv-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pqv-error {
    color: var(--pqv-sale);
    font-size: 13px;
    min-height: 18px;
}

/* ---- Scrollbar polish for the info panel ---- */
.pqv-info::-webkit-scrollbar,
.pqv-modal__content::-webkit-scrollbar {
    width: 8px;
}

.pqv-info::-webkit-scrollbar-thumb,
.pqv-modal__content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* ---- Scroll-lock body utility ---- */
body.pqv-no-scroll {
    overflow: hidden;
}

/* ==========================================================================
   WooCommerce shop-loop auto-injection
   The button is placed inside <li class="product"> by the plugin.
   These rules position it relative to the card without sitting in the
   middle of the product photo.
   ========================================================================== */

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
ul.products li.product {
    position: relative;
}

/* Reset defaults from the demo-grid rule so WC cards aren't affected by it. */
.pqv-quick-view-btn--shop {
    position: absolute;
    transform: none;
    opacity: 1;
    font-family: var(--pqv-font);
    z-index: 5;
}

/* ---------- Variant: top-right icon (default, recommended) ---------- */
.pqv-quick-view-btn--top-right {
    top: 10px;
    right: 10px;
    left: auto;
    bottom: auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--pqv-accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--pqv-transition), color var(--pqv-transition), transform var(--pqv-transition);
}

.pqv-quick-view-btn--top-right svg {
    width: 18px;
    height: 18px;
    margin: 0;
}

.pqv-quick-view-btn--top-right:hover {
    background: var(--pqv-accent);
    color: var(--pqv-accent-fg);
    transform: scale(1.06);
}

/* ---------- Variant: bottom bar (full-width slide-up on hover) ---------- */
.pqv-quick-view-btn--bottom-bar {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    border-radius: 0;
    padding: 12px 18px;
    background: var(--pqv-accent);
    color: var(--pqv-accent-fg);
    justify-content: center;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--pqv-transition), opacity var(--pqv-transition);
}

/* Bottom-bar: slide-up on hover. Constrain to just the image area using
   the product link wrapper if available, otherwise the whole <li>. */
.woocommerce ul.products li.product:hover .pqv-quick-view-btn--bottom-bar,
.woocommerce ul.products li.product:focus-within .pqv-quick-view-btn--bottom-bar,
ul.products li.product:hover .pqv-quick-view-btn--bottom-bar,
ul.products li.product:focus-within .pqv-quick-view-btn--bottom-bar {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Variant: centered pill (legacy) ---------- */
.pqv-quick-view-btn--center {
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%) translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--pqv-transition), transform var(--pqv-transition);
}

.woocommerce ul.products li.product:hover .pqv-quick-view-btn--center,
.woocommerce ul.products li.product:focus-within .pqv-quick-view-btn--center,
ul.products li.product:hover .pqv-quick-view-btn--center,
ul.products li.product:focus-within .pqv-quick-view-btn--center {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

/* On touch devices, always show whatever variant is active. */
@media (hover: none) {
    .pqv-quick-view-btn--bottom-bar,
    .pqv-quick-view-btn--center {
        opacity: 1;
        pointer-events: auto;
    }
    .pqv-quick-view-btn--bottom-bar { transform: translateY(0); }
    .pqv-quick-view-btn--center     { transform: translate(-50%, -50%); }
}
