/* ════════════════════════════════════════════════════
   VPC PRODUCT DESIGNER  — v2.0
   ════════════════════════════════════════════════════ */

/* ── Customize Button ─────────────────────────────── */
.vpc-customize-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 12px;
    background: #111;
    color: #fff;
    border: 2px solid #111;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.4px;
    transition: background .2s, color .2s;
}
.vpc-customize-btn:hover { background: #333; border-color: #333; }

/* ── Overlay ──────────────────────────────────────── */
#vpc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}
#vpc-overlay.open { display: flex; }

/* ── Modal shell ──────────────────────────────────── */
#vpc-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 1600px;
    height: 92vh;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 28px 72px rgba(0,0,0,.32);
}

/* ── Header ───────────────────────────────────────── */
.vpc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 22px;
    border-bottom: 1px solid #ebebeb;
    background: #fff;
    flex-shrink: 0;
}
.vpc-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}
.vpc-header-close {
    width: 34px; height: 34px;
    border: none; background: #f0f0f0;
    border-radius: 50%; cursor: pointer;
    font-size: 20px; font-weight: 400;
    line-height: 34px;
    text-align: center; color: #444;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
    padding: 0;
}
.vpc-header-close:hover { background: #ddd; color: #111; }

/* ── Body ─────────────────────────────────────────── */
.vpc-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── LEFT: product image ──────────────────────────── */
.vpc-left {
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.vpc-product-img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
    transition: opacity .3s;
    padding: 16px;
    box-sizing: border-box;
}
.vpc-img-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.92);
    border: 1.5px solid #ddd;
    border-radius: 50%;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 22px; font-weight: 300; color: #333;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    transition: background .15s, box-shadow .15s;
    z-index: 10;
    padding: 0; line-height: 1;
}
.vpc-img-nav:hover { background: #fff; box-shadow: 0 3px 14px rgba(0,0,0,.22); }
.vpc-img-prev { left: 12px; }
.vpc-img-next { right: 12px; }
.vpc-img-label {
    position: absolute;
    bottom: 12px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.55);
    color: #fff; font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
    letter-spacing: 1px;
}

/* ── RIGHT: steps sidebar ─────────────────────────── */
.vpc-right {
    width: 360px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ebebeb;
    overflow-y: auto;
    background: #fff;
}

/* ── Step accordion ───────────────────────────────── */
.vpc-step {
    border-bottom: 1px solid #ebebeb;
}
.vpc-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.vpc-step-header:hover { background: #fafafa; }
.vpc-step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.vpc-step.done .vpc-step-num { background: #22c55e; }
.vpc-step-title {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.vpc-step-summary {
    font-size: 12px;
    color: #888;
    font-weight: 400;
    margin-left: 4px;
}
.vpc-step-chevron {
    font-size: 12px;
    color: #aaa;
    transition: transform .2s;
    flex-shrink: 0;
}
.vpc-step.open .vpc-step-chevron { transform: rotate(180deg); }
.vpc-step-body {
    display: none;
    padding: 4px 20px 20px;
}
.vpc-step.open .vpc-step-body { display: block; }

/* ── Color swatches ───────────────────────────────── */
.vpc-colors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.vpc-color-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 6px 4px;
    transition: border-color .15s, background .15s;
    background: #fafafa;
}
.vpc-color-swatch:hover { border-color: #bbb; background: #f0f0f0; }
.vpc-color-swatch.selected { border-color: #111; background: #f0f0f0; }
.vpc-color-swatch-img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    background: #eee;
}
.vpc-color-swatch-fallback {
    width: 100%;
    height: 70px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    font-weight: 700;
    letter-spacing: .3px;
}
.vpc-color-swatch-name {
    font-size: 10px;
    color: #555;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.vpc-color-swatch.selected .vpc-color-swatch-name { color: #111; font-weight: 700; }
.vpc-selected-label {
    margin-top: 10px;
    font-size: 12px;
    color: #555;
}
.vpc-selected-label strong { color: #111; }

/* ── Print location ───────────────────────────────── */
.vpc-location-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.vpc-location-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.vpc-location-card:hover { border-color: #bbb; background: #fafafa; }
.vpc-location-card.selected { border-color: #111; background: #f8f8f8; }
.vpc-location-card input[type="radio"] { display: none; }
.vpc-location-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.vpc-location-info { flex: 1; }
.vpc-location-name {
    font-size: 13px;
    font-weight: 700;
    color: #111;
}
.vpc-location-price {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}
.vpc-location-check {
    width: 18px; height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    transition: border-color .15s, background .15s;
}
.vpc-location-card.selected .vpc-location-check {
    border-color: #111;
    background: #111;
    color: #fff;
}

/* ── Upload area ──────────────────────────────────── */
.vpc-upload-section { margin-top: 8px; }
.vpc-upload-label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
    display: block;
}
.vpc-upload-box {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    margin-bottom: 10px;
    position: relative;
}
.vpc-upload-box:hover { border-color: #111; background: #f9f9f9; }
.vpc-upload-box.has-file { border-color: #22c55e; background: #f0faf4; border-style: solid; }
.vpc-upload-box svg { display: block; margin: 0 auto 6px; }
.vpc-upload-box p { margin: 0; font-size: 12px; color: #888; line-height: 1.5; }
.vpc-upload-box .vpc-file-name { font-size: 12px; color: #22c55e; font-weight: 600; margin-top: 4px; }
.vpc-fn-name { display: block; margin-bottom: 6px; }
.vpc-remove-art {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 6px; padding: 4px 10px;
    background: #fff0f0; color: #c0392b;
    border: 1px solid #f5c6c6; border-radius: 5px;
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.vpc-remove-art:hover { background: #ffe0e0; }
.vpc-upload-box .vpc-file-preview {
    max-width: 80px; max-height: 80px;
    object-fit: contain;
    border-radius: 6px;
    margin: 6px auto 0;
    display: block;
}
.vpc-upload-progress-bar {
    display: none;
    height: 3px;
    background: #22c55e;
    border-radius: 2px;
    margin-top: 6px;
    animation: vpc-progress 1s ease-in-out infinite alternate;
}
.vpc-upload-progress-bar.active { display: block; }
@keyframes vpc-progress {
    from { width: 20%; } to { width: 95%; }
}

/* ── Size & Quantity ──────────────────────────────── */
.vpc-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.vpc-size-btn {
    min-width: 44px;
    padding: 7px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    color: #444;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, color .15s;
}
.vpc-size-btn:hover { border-color: #aaa; }
.vpc-size-btn.selected { border-color: #111; background: #111; color: #fff; }

.vpc-qty-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.vpc-qty-label { font-size: 12px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .5px; }
.vpc-qty-ctrl {
    display: flex;
    align-items: center;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}
.vpc-qty-btn {
    width: 34px; height: 34px;
    border: none; background: #f4f4f4;
    font-size: 18px; cursor: pointer; color: #333;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.vpc-qty-btn:hover { background: #e8e8e8; }
.vpc-qty-input {
    width: 44px; height: 34px;
    border: none; border-left: 1.5px solid #e0e0e0; border-right: 1.5px solid #e0e0e0;
    text-align: center; font-size: 14px; font-weight: 700;
    outline: none;
}

/* ── Price display ────────────────────────────────── */
.vpc-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid #ebebeb;
    border-bottom: 1px solid #ebebeb;
    background: #fafafa;
    flex-shrink: 0;
}
.vpc-price-label { font-size: 12px; color: #777; font-weight: 600; }
.vpc-price-value { font-size: 20px; font-weight: 800; color: #111; }

/* ── Add to cart button ───────────────────────────── */
.vpc-footer {
    padding: 14px 20px;
    flex-shrink: 0;
    background: #fff;
}
.vpc-add-cart-btn {
    width: 100%;
    padding: 14px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s;
    letter-spacing: .3px;
}
.vpc-add-cart-btn:hover { background: #333; }
.vpc-add-cart-btn:disabled { background: #aaa; cursor: not-allowed; }

/* ── Step "Next" buttons ──────────────────────────── */
.vpc-next-btn {
    width: 100%;
    margin-top: 14px;
    padding: 10px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}
.vpc-next-btn:hover { background: #333; }

/* ── Print zone box — hidden, overlay now in vpc-left ─ */
.vpc-print-zone-box { display: none !important; }

/* ── Print zone border — red dashed guide on shirt ─── */
.vpc-print-zone-border {
    position: absolute;
    display: none;
    pointer-events: none;
    border: 2px dashed rgba(220, 60, 60, 0.75);
    border-radius: 3px;
    box-sizing: border-box;
    z-index: 8;
}

/* ── Design overlay — sits directly in vpc-left ──────── */
.vpc-design-overlay {
    position: absolute;
    display: none;
    overflow: visible;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    z-index: 10;
    box-sizing: border-box;
    pointer-events: auto;
    touch-action: none;
    border: 2px dashed rgba(140, 160, 255, 0.85);
    border-radius: 3px;
}
.vpc-design-overlay:active { cursor: grabbing; }
.vpc-design-overlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
}

/* ── Resize handle — now a sibling in the panel (not inside overlay) ─── */
.vpc-resize-handle {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #111;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: se-resize;
    z-index: 20;
    pointer-events: auto;
    touch-action: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .15s;
}
.vpc-resize-handle:hover { background: #333; transform: scale(1.15); }
.vpc-resize-handle svg {
    display: block;
    pointer-events: none;
    flex-shrink: 0;
    transform: rotate(90deg);
    transform-origin: center center;
}

/* ── Artwork tabs (Front / Back) ──────────────────── */
.vpc-art-tabs {
    display: flex;
    gap: 0;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 12px;
}
.vpc-art-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    background: #f6f6f6;
    font-size: 12px;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    transition: background .15s, color .15s;
    text-align: center;
    letter-spacing: .3px;
}
.vpc-art-tab:first-child { border-right: 1.5px solid #ddd; }
.vpc-art-tab.active {
    background: #111;
    color: #fff;
}
.vpc-art-tab:hover:not(.active) { background: #eee; color: #333; }

/* ── Browse link inside upload box ───────────────── */
.vpc-browse-link { color: #111; text-decoration: underline; cursor: pointer; font-weight: 700; }

/* ── Back artwork optional label ─────────────────── */
.vpc-back-optional {
    font-size: 11.5px;
    color: #888;
    text-align: center;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: #f8f8f8;
    border-radius: 5px;
    border: 1px dashed #ddd;
}

/* ── Skip row ─────────────────────────────────────── */
.vpc-skip-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: #999;
}
.vpc-skip-row a {
    color: #111;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* ── Quality warning ──────────────────────────────── */
.vpc-quality-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff8e6;
    border: 1px solid #f5c842;
    border-radius: 6px;
    font-size: 11.5px;
    color: #7a5800;
    line-height: 1.5;
}

/* ── Helpers ──────────────────────────────────────── */
.vpc-hidden { display: none !important; }
#vpc-design-data-input, #vpc-design-front-input, #vpc-design-back-input { display: none; }

/* ── Share Design ─────────────────────────────────── */
.vpc-share-row {
    padding: 6px 18px 8px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}
.vpc-share-hidden { display: none !important; }
.vpc-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.vpc-share-btn:hover { background: #ececec; }
.vpc-share-btn:disabled { opacity: .6; cursor: default; }
.vpc-share-popup {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.vpc-share-label {
    margin: 0 0 6px;
    font-size: 11.5px;
    color: #666;
    font-weight: 600;
}
.vpc-share-url-row {
    display: flex;
    gap: 6px;
}
.vpc-share-url-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 11.5px;
    color: #333;
    background: #f9f9f9;
    min-width: 0;
}
.vpc-share-copy-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.vpc-share-copy-btn:hover { background: #333; }
.vpc-share-copied {
    margin: 5px 0 0;
    font-size: 11.5px;
    color: #16a34a;
    font-weight: 600;
}

/* ── Responsive ───────────────────────────────────── */

/* Tablet (700–1024px) */
@media (max-width: 1024px) and (min-width: 701px) {
    #vpc-modal { max-width: calc(100vw - 32px); }
    .vpc-right { width: 300px; min-width: 300px; }
    .vpc-colors { grid-template-columns: repeat(4, 1fr); }
}

/* Mobile (≤700px) */
@media (max-width: 700px) {
    /* Full-screen modal */
    #vpc-overlay {
        padding: 0;
        align-items: stretch;
    }
    #vpc-modal {
        width: 100%;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    /* Stack left/right vertically */
    .vpc-body {
        flex-direction: column;
        flex: 1;
        overflow: hidden;
    }

    /* Left panel (mockup image) — fixed compact height */
    .vpc-left {
        flex: 0 0 auto;
        height: 220px;
        min-height: 180px;
        max-height: 260px;
        border-bottom: 1px solid #ebebeb;
    }

    /* Right panel — scrollable */
    .vpc-right {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: none;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Header */
    .vpc-header {
        padding: 10px 14px;
    }
    .vpc-header h2 {
        font-size: 14px;
    }

    /* Steps */
    .vpc-step-header {
        padding: 11px 14px;
        font-size: 13px;
    }
    .vpc-step-body {
        padding: 10px 14px;
    }

    /* Color grid — 4 columns on mobile */
    .vpc-colors {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .vpc-color-swatch {
        width: 36px;
        height: 36px;
    }
    .vpc-color-swatch-img {
        height: 50px;
    }

    /* Location cards — compact */
    .vpc-location-options { gap: 5px; }
    .vpc-location-card { padding: 8px 10px; font-size: 12px; }

    /* Upload boxes */
    .vpc-upload-box {
        padding: 14px 10px;
    }

    /* Size buttons — smaller */
    .vpc-size-btn {
        padding: 7px 10px;
        font-size: 13px;
    }

    /* Price row */
    .vpc-price-row {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* Share row */
    .vpc-share-row {
        padding: 5px 14px 7px;
    }

    /* Footer */
    .vpc-footer {
        padding: 10px 14px;
    }
    .vpc-add-cart-btn {
        width: 100%;
        padding: 13px;
        font-size: 14px;
        justify-content: center;
    }

    /* Close button */
    #vpc-close {
        top: 8px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}

/* Very small phones (≤380px) */
@media (max-width: 380px) {
    .vpc-left {
        height: 180px;
        min-height: 150px;
    }
    .vpc-colors {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    .vpc-color-swatch {
        width: 32px;
        height: 32px;
    }
    .vpc-location-card { padding: 6px 8px; }
    .vpc-colors { grid-template-columns: repeat(3, 1fr); }
}
