/* ============================================================
   DP Variation Popup — Bottom-sheet style
   File: public/css/components/dp-variation-popup.css
   ============================================================ */

/* Body scroll lock */
body.dp-vp-body-lock {
    overflow: hidden;
}

/* ── Overlay ─────────────────────────────────────────────── */
.dp-vp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.55);
    z-index: 99990;
    display: flex;
    align-items: flex-end;       /* bottom-sheet by default  */
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.dp-vp-overlay.dp-vp-active {
    opacity: 1;
    pointer-events: all;
}

/* ── Popup panel ─────────────────────────────────────────── */
.dp-vp-popup {
    background: #ffffff;
    border-radius: 24px 24px 0 0;   /* rounded top corners only */
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateY(40px);
    transition: transform 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.dp-vp-overlay.dp-vp-active .dp-vp-popup {
    transform: translateY(0);
}

.dp-vp-popup::-webkit-scrollbar       { width: 4px; }
.dp-vp-popup::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* Desktop: center & add bottom margin, round all corners */
@media (min-width: 520px) {
    .dp-vp-overlay { align-items: center; }
    .dp-vp-popup   {
        border-radius: 24px;
        margin-bottom: 0;
        transform: translateY(32px);
    }
}

/* ── Drag handle ─────────────────────────────────────────── */
.dp-vp-handle {
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 4px;
    margin: 14px auto 0;
    flex-shrink: 0;
}

/* ── Image strip ─────────────────────────────────────────── */
.dp-vp-image-strip {
    width: 100%;
    /* height set inline from PHP setting */
    background: #f4f1ec;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
    flex-shrink: 0;
    border-radius: 12px;
    margin-left: 12px;
    margin-right: 12px;
    width: calc(100% - 24px);
}

.dp-vp-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: opacity 0.25s ease;
}

/* ── Sale badge ──────────────────────────────────────────── */
.dp-vp-sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #e8440a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    letter-spacing: 0.04em;
    pointer-events: none;
    line-height: 1.6;
}

/* ── Close button ────────────────────────────────────────── */
.dp-vp-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #1a1a1a;
    line-height: 1;
    transition: background 0.18s, transform 0.18s;
    z-index: 2;
    backdrop-filter: blur(4px);
}
.dp-vp-close:hover {
    background: #fff;
    transform: scale(1.1);
}

/* ── Body ────────────────────────────────────────────────── */
.dp-vp-body {
    padding: 18px 22px 28px;
}

.dp-vp-product-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.3;
}

.dp-vp-product-price {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.dp-vp-product-price ins  { text-decoration: none; }
.dp-vp-product-price del  { opacity: 0.4; font-size: 14px; font-weight: 400; }

.dp-vp-product-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 18px;
}

/* ── Attribute groups ────────────────────────────────────── */
.dp-vp-swatch-group {
    margin-bottom: 16px;
}

.dp-vp-swatch-label-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 10px;
}

.dp-vp-attr-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
}

.dp-vp-attr-selected-val {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
}

/* ── Swatches row ────────────────────────────────────────── */
.dp-vp-swatches-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Base swatch reset */
.dp-vp-swatch {
    border: none;
    cursor: pointer;
    outline: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
    position: relative;
    font-family: inherit;
    padding: 0;
    background: none;
    line-height: 1;
}

.dp-vp-swatch:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

.dp-vp-swatch:hover:not(.dp-vp-swatch-oos) {
    transform: scale(1.1);
}

/* Color swatch */
.dp-vp-swatch-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.dp-vp-swatch-color.dp-vp-swatch-selected {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #1a1a1a;
    transform: scale(1.05);
}

/* Label / size swatch */
.dp-vp-swatch-label {
    padding: 6px 16px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    height: 38px;
    display: inline-flex;
    align-items: center;
}

.dp-vp-swatch-label:hover:not(.dp-vp-swatch-oos) {
    border-color: #1a1a1a;
}

.dp-vp-swatch-label.dp-vp-swatch-selected {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
    transform: none;
}

/* Out of stock */
.dp-vp-swatch-oos {
    opacity: 0.32;
    cursor: not-allowed;
    text-decoration: line-through;
    pointer-events: none;
}

/* Generic attribute select */
.dp-vp-attr-select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    color: #1a1a1a;
    appearance: auto;
    transition: border-color 0.18s;
}
.dp-vp-attr-select:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* ── Notice ──────────────────────────────────────────────── */
.dp-vp-notice {
    font-size: 12px;
    font-weight: 500;
    min-height: 16px;
    margin-bottom: 2px;
    transition: opacity 0.2s;
}
.dp-vp-notice-warning { color: #e8440a; }
.dp-vp-notice-error   { color: #dc2626; }
.dp-vp-notice-success { color: #16a34a; }

/* ── Footer ──────────────────────────────────────────────── */
.dp-vp-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

/* Quantity stepper */
.dp-vp-qty {
    display: flex;
    align-items: center;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
}

.dp-vp-qty-btn {
    width: 36px;
    height: 46px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
    font-weight: 300;
    flex-shrink: 0;
}
.dp-vp-qty-btn:hover { background: #f5f5f5; }

.dp-vp-qty-input {
    width: 40px;
    height: 46px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    background: none;
    outline: none;
    -moz-appearance: textfield;
}
.dp-vp-qty-input::-webkit-outer-spin-button,
.dp-vp-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Popup Add to Cart button */
.dp-vp-atc-btn {
    flex: 1;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 50px;   /* pill shape to match demo */
    background: #1a1a1a;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.22s, transform 0.15s, opacity 0.2s;
    padding: 0 20px;
    position: relative;
}

.dp-vp-atc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #6b7280;
}

.dp-vp-atc-btn:not(:disabled):hover {
    opacity: 0.88;
    transform: scale(1.02);
}

.dp-vp-atc-btn.dp-vp-loading {
    background: #6b7280;
    pointer-events: none;
}

.dp-vp-atc-btn.dp-vp-success {
    background: #16a34a;
    pointer-events: none;
}

/* Icon inside popup ATC button */
.dp-vp-atc-icon-wrap {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.dp-vp-atc-icon-wrap i   { font-size: 1em; }
.dp-vp-atc-icon-wrap svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Spinner */
.dp-vp-atc-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dpVpSpin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes dpVpSpin {
    to { transform: rotate(360deg); }
}
