/**
 * Clubbercise Product Quickview
 * - Injects a red circular "+" trigger in the corner of each product card
 *   image. The original "Select options" button is left untouched (it
 *   still navigates to the product page as expected).
 * - Click -> opens the off-canvas side panel with product details and
 *   variation <select>s.
 */

/* ============================================================
   TRIGGER BUTTON (+) on each product card image
   Red circle with a "+" glyph, Nasatheme-style.
   ============================================================ */
.cb-quickview-trigger {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border-radius: 36px !important;
    background: #f76b6a;
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    padding: 0;
    border: 2px solid #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transition: background 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(6px);
}

/* Desktop hover: reveal the button */
@media (hover: hover) {
    .w-grid-item-h:hover .cb-quickview-trigger,
    .w-post-elm.post_image:hover .cb-quickview-trigger {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch / mobile: always visible */
@media (hover: none) {
    .cb-quickview-trigger {
        opacity: 1;
        transform: none;
    }
}

.cb-quickview-trigger:hover,
.cb-quickview-trigger:focus {
    background: #f00c93;
    outline: none;
}

/* ============================================================
   BACKDROP
   ============================================================ */
.cb-qv-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.cb-qv-backdrop.cb-is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.28s ease;
}

/* ============================================================
   DRAWER (right side)
   ============================================================ */
.cb-qv {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: #fff;
    color: #111;
    z-index: 999999;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.cb-qv.cb-is-open {
    transform: translateX(0);
}

.cb-qv--loading {
    align-items: center;
    justify-content: center;
}

.cb-qv__loader {
    display: flex;
    gap: 6px;
}

.cb-qv__loader span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #111;
    animation: cb-qv-pulse 1s ease-in-out infinite;
}

.cb-qv__loader span:nth-child(2) { animation-delay: 0.15s; }
.cb-qv__loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cb-qv-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ============================================================
   HEADER
   ============================================================ */
.cb-qv__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.cb-qv__eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #555;
}

.cb-qv__close {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #111;
    transition: background 0.18s ease;
    padding: 0;
}

.cb-qv__close:hover,
.cb-qv__close:focus {
    background: #f3f3f3;
    outline: none;
}

.cb-qv__close svg {
    width: 18px;
    height: 18px;
}

/* ============================================================
   BODY (scrollable)
   ============================================================ */
.cb-qv__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   MEDIA (main image + gallery thumbs)
   ============================================================ */
.cb-qv__media {
    margin-bottom: 18px;
}

.cb-qv__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f5f5f5;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.cb-qv__gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.cb-qv__gallery img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    background: #f5f5f5;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.18s ease;
}

.cb-qv__gallery img:hover {
    border-color: #111;
}

/* ============================================================
   TITLE / PRICE / DESCRIPTION
   ============================================================ */
.cb-qv__name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: #111;
    margin: 0 0 8px 0;
}

.cb-qv__price {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin: 0 0 16px 0;
}

.cb-qv__desc {
    font-size: 14px;
    line-height: 1.55;
    color: #444;
    margin: 0 0 20px 0;
}

.cb-qv__desc p {
    margin: 0 0 8px 0;
}

/* ============================================================
   ATTRIBUTES (variation selectors)
   ============================================================ */
.cb-qv__attrs {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.cb-qv__attr {
    display: block;
}

.cb-qv__attr-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 6px;
}

.cb-qv__attr-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d4d4d4;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #111;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23111' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    padding-right: 32px;
}

.cb-qv__attr-select:focus {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   FORM (qty + add-to-cart)
   ============================================================ */
.cb-qv__form {
    display: grid;
    gap: 10px;
}

.cb-qv__qty {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cb-qv__qty label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cb-qv__qty input {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid #d4d4d4;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.cb-qv__qty input:focus {
    outline: none;
    border-color: #111;
}

.cb-qv__submit {
    width: 100%;
    padding: 14px 18px;
    background: #000;
    color: #fff;
    border: 2px solid #000;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.cb-qv__submit:hover:not(:disabled) {
    background: #fff;
    color: #000;
}

.cb-qv__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cb-qv__view {
    text-align: center;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    padding: 6px 0;
}

.cb-qv__view:hover {
    color: #000;
    text-decoration: underline;
}

/* ============================================================
   SUCCESS NOTICE (after add-to-cart)
   ============================================================ */
.cb-qv__success {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 14px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    margin-bottom: 16px;
}

.cb-qv__success svg {
    width: 22px;
    height: 22px;
    color: #047857;
    flex-shrink: 0;
}

.cb-qv__success p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #065f46;
    flex: 1;
}

.cb-qv__checkout {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: #000;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.cb-qv__checkout:hover {
    background: #1a1a1a;
}

.cb-qv__continue {
    background: transparent;
    border: none;
    color: #047857;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

/* ============================================================
   BODY LOCK + RESPONSIVE + REDUCED MOTION
   ============================================================ */
body.cb-quickview-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .cb-qv {
        max-width: 100%;
    }
    .cb-quickview-trigger {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cb-qv,
    .cb-qv-backdrop,
    .cb-quickview-trigger {
        transition: none;
    }
}
