/* --- Basic Reset & Mobile-First Styles --- */

#app-container {
    max-width: var(--wp--style--global--wide-size);
    height: 100%;
    display: flex;
    flex-direction: column;
    /* Mobile: Top-to-bottom */
    background: #fff;
    position: relative;
}

#canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Prevents scrollbars if canvas is 1px too big */
}

#product-canvas {
    display: block;
    /* Removes default inline spacing */
    width: 100% !important;
    height: 100% !important;
    outline: none;
    cursor: grab;
}

#product-canvas.is-dragging {
    cursor: grabbing;
}

/* --- Sidebar: mobile-first --- */
#sidebar {
    /* Mobile: place in normal document flow under the canvas */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#sidebar-content {
    padding: 16px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

#sidebar-content::-webkit-scrollbar {
    width: 6px;
}

#sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* --- Sidebar Action Bar (bottom) --- */
#sidebar-action-bar {
    border: 1px solid #eee;
    border-left: none;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: end;
    align-items: center;
}

#sidebar-action-bar button span {
    padding-left: 4px;
}

.add-to-cart-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* WC cart form merges into the flex row; express payment buttons appear alongside. */
.dprcu-express-form {
    display: contents;
}

.dprcu-price-cart-wrapper{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Native WC add-to-cart button styled to match the customizer action buttons. */
.dprcu-cart-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: #111;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.dprcu-cart-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}



/* --- Mobile Menu Grid --- */
.mobile-menu-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    /* 2-column grid */
    gap: 10px;
}

.mobile-submenu-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-button {
    padding: 10px 8px;
    background: #f9f9f9;
    border: 1px solid #eee;
    min-height: 100px;
    border-radius: 8px;
    text-align: center;
    /* Center text for grid */
    font-size: 14px;
    /* Slightly smaller for grid */
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    /* Stack icon and text */
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.mobile-section-description {
    font-size: 12px;
    color: rgb(102, 102, 102);
    padding: 12px 16px;
    margin: 0px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgb(238, 238, 238);
}

#btn-mobile-back {
    padding: 14px 12px;
    background: #f0f0f0;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-submenu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mobile-submenu-header h3 {
    margin: 0;
    font-size: 18px;
}

.cust-section {
    margin-bottom: 24px;
    border-bottom: 1px solid #eee;
    padding-bottom: 16px;
}

.cust-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cust-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 12px;
}

.color-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.swatch-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    /* Space between swatch and name */
    cursor: pointer;
    transition: transform 0.1s ease;
}

.swatch-wrapper:hover {
    transform: scale(1.05);
}

.swatch-name {
    font-size: 12px;
    color: #555;
    text-align: center;
}

/* Desktop Swatch Size */
.color-swatch {
    width: 100%;
    height: 80px;
    border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}

.logic-swatch {
    overflow: hidden;
    width: 100%;
    height: 80px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
}

.swatch-price-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Active State (applied to wrapper) */
.swatch-wrapper.active .color-swatch,
.swatch-wrapper.active .logic-swatch,
.swatch-wrapper:focus-visible .color-swatch,
.swatch-wrapper:focus-visible .logic-swatch {
    /* Outside the swatch (a border would shrink the color). Width and color: Settings → Appearance. */
    box-shadow: 0 0 0 var(--dprcu-ring-width, 2px) var(--dprcu-highlight, #096dd9);
}

.swatch-wrapper.active .swatch-name {
    font-weight: 600;
    color: #000;
}


/* --- View Controls (Left) --- */
#view-controls {
    height: 100%;
    position: absolute;
    left: 16px;
    top: 0px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;
    gap: 4px;
    z-index: 10;
}

.control-btn,
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    line-height: 0;
    min-width: 44px;
    min-height: 44px;
    width: auto;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    color: #333333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-back {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.control-btn.floating {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.control-btn:hover {
    transform: scale(1.1);
    color: var(--dprcu-accent, #096dd9);
}

.control-btn:disabled {
    opacity: 0.4;
    color: #aaa;
    cursor: not-allowed;
    transform: none;
}

/* --- Desktop Layout (min-width: 769px) --- */
@media (min-width: 769px) {

    /* No body/html flex centering here: it assumed a page holding only the
       customizer, and lined up header, content and footer as columns. */

    #app-container {
        /* Use most of the viewport width on desktop while keeping a small page margin */
        height: 80vh;
        flex-direction: row;
        /* Side-by-side */
        overflow: hidden;
    }

    #canvas-container {
        flex-grow: 1;
        flex-basis: 0;
    }

    /* Ensure the canvas fills the entire canvas container on desktop so it isn't narrow */
    #canvas-container {
        height: 100%;
        min-height: 0;
        display: flex;
        align-items: stretch;
    }

    /* Higher-specificity selector to avoid needing !important */
    #app-container #canvas-container>#product-canvas,
    #app-container #canvas-container canvas {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: cover;
    }

    /* Desktop: fix the sidebar to the right and restore canvas margin */
    #sidebar {
        display: flex;
        width: 420px;
        flex-direction: column;
        /* Above the canvas only: 50 also put it over sticky site headers. */
        z-index: 1;
    }

    /* Ensure mobile-only UI is hidden on desktop widths */
    .mobile-menu-container,
    .mobile-submenu-container,
    #btn-mobile-back {
        display: none;
    }
}

.customizer-title {
    padding: .25em;
    margin: 0px;
}

.step-icon-img {
    width: 75%;
    object-fit: contain;
    border-radius: 4px;
}


/* Loader Container */
#customizer-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    /* Semi-transparent white */
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /* Let clicks pass through when fading out */
}

#customizer-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Spinner Animation */
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

#loader-text {
    font-family: sans-serif;
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ── Viewer-only mode ──────────────────────────────────────────────────────
 *
 * The outer wrapper uses WooCommerce's own gallery CSS classes, so the
 * theme's column layout positions it correctly. We only need to give the
 * canvas a height and hide the sidebar shell.
 * ─────────────────────────────────────────────────────────────────────── */

.psc-viewer-only #app-container {
    display: block;
    width: 100%;
    height: 500px;
}

/* The base #canvas-container rule already sets width/height 100% */

.psc-viewer-only #btn-undo,
.psc-viewer-only #btn-redo {
    display: none;
}

.psc-viewer-only #sidebar.psc-hidden {
    display: none;
}



/* ── Share Modal ──────────────────────────────────────────────────────────── */

#share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

#share-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.share-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.share-modal-content {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 12px;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.share-modal-close:hover {
    color: #333;
}

.share-modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.share-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.share-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.share-option label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-link-container {
    display: flex;
    gap: 8px;
}

#share-link-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: monospace;
    background: #f9f9f9;
    color: #333;
}

/* --- Watermark / Branding --- */
.dprcu-watermark {
    position: absolute;
    bottom: 12px;
    right: 12px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    z-index: 10;
    background-color: black;
}

.dprcu-watermark:hover {
    opacity: 0.7;
}

.dprcu-watermark a {
    padding: 4px 8px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    text-decoration: none;
}

.dprcu-watermark img {
    max-width: 100px !important;
    max-height: 40px;
    width: auto;
    height: auto;
    display: block;
}

.btn-link-copy {
    padding: 10px 16px;
    background: var(--dprcu-accent, #096dd9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-link-copy:hover {
    background: #0753c3;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.share-btn {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.share-btn-facebook {
    color: #1877f2;
    border-color: #1877f2;
}

.share-btn-facebook:hover {
    background: #f0f2f5;
}

.share-btn-twitter {
    color: #1da1f2;
    border-color: #1da1f2;
}

.share-btn-twitter:hover {
    background: #f7f9fa;
}

.share-btn-linkedin {
    color: #0a66c2;
    border-color: #0a66c2;
}

.share-btn-linkedin:hover {
    background: #f3f6f8;
}

.share-btn-pinterest {
    color: #e60023;
    border-color: #e60023;
}

.share-btn-pinterest:hover {
    background: #fff5f5;
}

.btn-download-image {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #333;
}

.btn-download-image svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.btn-download-image:hover {
    background: #e8e8e8;
}

@media (max-width: 768px) {
    .share-modal-content {
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        position: fixed;
        bottom: 0;
        left: 0;
    }

    #share-modal.active {
        align-items: flex-end;
    }

    .share-buttons {
        grid-template-columns: 1fr;
    }
}

/* --- Help Modal --- */
#help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    -webkit-transform: translateZ(0);
}

#help-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.help-modal-content {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.help-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.help-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal-close:hover {
    color: #333;
}

.help-modal-body {
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-grow: 1;
}

.shortcuts-section {
    margin-bottom: 24px;
}

.shortcuts-section:last-child {
    margin-bottom: 0;
}

.shortcuts-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-item kbd:first-of-type {
    margin-left: auto;
}

.shortcut-keys {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0;
}

.shortcut-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    color: #666;
    flex-shrink: 0;
}

kbd {
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 6px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: inline-block;
    margin: 0 2px;
}

.kbd-plus {
    margin: 0 4px;
    color: #333;
    font-size: 11px;
    font-weight: 600;
}

.shortcut-desc {
    flex-grow: 0;
    padding: 0 8px;
    font-size: 13px;
    color: #666;
}

.help-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

@media (max-width: 768px) {
    .help-modal-content {
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90dvh;
        margin-top: auto;
    }

    #help-modal.active {
        align-items: flex-end;
    }

    .shortcut-key {
        font-size: 10px;
        padding: 3px 6px;
    }

    .shortcut-desc {
        font-size: 12px;
    }

    .shortcut-icon {
        width: 18px;
        height: 18px;
    }

    kbd {
        font-size: 11px;
        padding: 2px 5px;
    }

    .customizer-title {
        padding: 12px 0px;
    }

    /* Make canvas square on mobile: use aspect-ratio so it stays width x width */
    #canvas-container {
        margin-right: 0;
        margin-bottom: 0;
    }

    #product-canvas {
        aspect-ratio: 1 / 1.5;
        width: 100%;
        height: auto;
    }

    #sidebar-content {
        padding: 8px;
        overflow: auto;
    }

    /* Larger swatch sizes for the mobile bottom bar */
    #sidebar-content .color-swatch {
        height: 100px;
    }

    #sidebar-content .logic-swatch {
        height: 100px;
    }

    #sidebar-content .swatch-name {
        font-size: 13px;
    }

    #view-controls {
        left: 4px;
    }

    .color-swatches {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .control-btn.floating {
        bottom: unset;
        left: unset;
        top: 16px;
        right: 16px;
        padding: 10px 14px;
    }
}


.dprcu-ar-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    /* container is transparent to taps */
    z-index: 2147483647;
    /* WebXR puts it above canvas anyway, but be explicit for non-XR fallback */
    font-family: system-ui, sans-serif;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}

.dprcu-ar-overlay>* {
    pointer-events: auto;
    /* children are tappable */
}

.dprcu-ar-overlay[hidden] {
    display: none;
}

/* Exit button — top right, large tap target */
.dprcu-ar-exit {
    position: absolute;
    top: env(safe-area-inset-top, 16px);
    right: env(safe-area-inset-right, 16px);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

/* Hints — centered top */
.dprcu-ar-hint {
    position: absolute;
    top: calc(env(safe-area-inset-top, 16px) + 16px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    font-size: 14px;
    white-space: nowrap;
}

/* Controls — bottom center bar */
.dprcu-ar-controls {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 16px) + 16px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
}

.dprcu-ar-btn {
    min-width: 64px;
    height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.dprcu-ar-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

[hidden] {
    display: none !important;
}

/* =============================================================================
   Style "Integrated with the theme" (Settings → Appearance)
   =============================================================================
   Active when the body has .dprcu-style-theme. Fonts come from the theme, colors
   from the --dprcu-* variables written by the Appearance settings. The body class
   sits in :where() so it adds no specificity; doubled IDs and the "html" prefix are
   what keep these rules above the base ones at every breakpoint. */

/* --- Frame: fits the content column instead of a fixed 1200 × 800 app --- */
:where(.dprcu-style-theme) #app-container#app-container {
	max-width: none;
	height: auto;
	gap: 0;
	border: 1px solid var(--dprcu-border);
	border-radius: 4px;
	overflow: hidden;
	background: var(--dprcu-viewer);
}

/* Side by side from 1000px: below that the 420px panel left the model a sliver. */
@media (min-width: 1000px) {
	:where(.dprcu-style-theme) #app-container#app-container {
		display: grid;
		grid-template-columns: minmax(0, 1fr) clamp(320px, 34%, 420px);
		height: clamp(500px, 68vh, 680px);
	}
	:where(.dprcu-style-theme) #app-container#app-container #canvas-container { height: 100%; }
	/* The panel's fixed 420px overflowed narrower columns. */
	:where(.dprcu-style-theme) #app-container#app-container #sidebar {
		height: 100%;
		width: auto;
		min-width: 0;
		max-width: none;
		border-left: 1px solid var(--dprcu-border);
	}
}

@media (max-width: 999px) {
	:where(.dprcu-style-theme) #app-container#app-container { display: block; height: auto; }
	:where(.dprcu-style-theme) #app-container#app-container #canvas-container { height: clamp(320px, 52vh, 460px); }
	:where(.dprcu-style-theme) #app-container#app-container #sidebar {
		height: auto;
		width: auto;
		min-width: 0;
		max-width: none;
		border-top: 1px solid var(--dprcu-border);
	}
}

/* What counts is the width of the customizer, not of the screen: in a half-width
   column (a product page) the panel goes under the model below 620px, with all
   swatches on one row. */
:where(.dprcu-style-theme) :has(> #app-container) { container: dprcu / inline-size; }

@media (min-width: 1000px) {
	@container dprcu (max-width: 619px) {
		html :where(.dprcu-style-theme) #app-container#app-container { display: block; height: auto; }
		html :where(.dprcu-style-theme) #app-container#app-container #canvas-container { height: clamp(340px, 48vh, 440px); }
		html :where(.dprcu-style-theme) #app-container#app-container #sidebar {
			height: auto;
			border-left: 0;
			border-top: 1px solid var(--dprcu-border);
		}
		html :where(.dprcu-style-theme) #app-container#app-container .color-swatches { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
		html :where(.dprcu-style-theme) #app-container#app-container #dprcu-total-price { flex: 0 1 auto; }
		html :where(.dprcu-style-theme) #app-container#app-container .dprcu-cart-btn { flex: 1 1 150px; }
	}
}

/* --- Panel --- */
:where(.dprcu-style-theme) #sidebar { background: var(--dprcu-panel); z-index: 1; }
:where(.dprcu-style-theme) #loader-text { font-family: inherit; }
:where(.dprcu-style-theme) #sidebar #sidebar-content { padding: 22px 22px 8px; }

:where(.dprcu-style-theme) #sidebar .cust-section h3,
:where(.dprcu-style-theme) #sidebar .mobile-submenu-header {
	font-size: 14px;
	letter-spacing: .08em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--dprcu-text);
	margin: 0 0 14px;
}

:where(.dprcu-style-theme) #sidebar .cust-section { margin-bottom: 0; padding-bottom: 18px; }
:where(.dprcu-style-theme) #sidebar .cust-section + .cust-section { border-top: 1px solid var(--dprcu-divider); padding-top: 16px; }

/* --- Swatches: three per row, the name inside the swatch on hover or focus --- */
:where(.dprcu-style-theme) #sidebar .swatch-wrapper { position: relative; }
:where(.dprcu-style-theme) #sidebar .swatch-name {
	position: absolute;
	left: 50%;
	bottom: 6px;
	transform: translateX(-50%);
	max-width: calc(100% - 8px);
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
	z-index: 2;
	padding: 3px 8px;
	border-radius: 4px;
	background: var(--dprcu-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity .12s ease;
}
:where(.dprcu-style-theme) #sidebar .swatch-wrapper:hover .swatch-name,
:where(.dprcu-style-theme) #sidebar .swatch-wrapper:focus-visible .swatch-name { opacity: 1; }

:where(.dprcu-style-theme) :where(#sidebar) .color-swatches {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px clamp(12px, 2vw, 28px);
}

:where(.dprcu-style-theme) #sidebar .swatch-wrapper {
	border: 0;
	padding: 0;
	background: none;
	border-radius: 10px;
}
:where(.dprcu-style-theme) #sidebar .color-swatch {
	height: 60px;
	border-radius: 10px;
	border: 1px solid var(--dprcu-divider);
	box-sizing: border-box;
}

/* The selection is shown by the ring on the swatch only. */
:where(.dprcu-style-theme) #sidebar .swatch-wrapper.active,
:where(.dprcu-style-theme) #sidebar .swatch-wrapper:focus-visible {
	outline: none;
	box-shadow: none;
	border-color: transparent;
}

@media (max-width: 999px) {
	:where(.dprcu-style-theme) #sidebar#sidebar .color-swatch { height: 56px; }
}

/* --- Step buttons on mobile: outlined, one at each end of the row --- */
:where(.dprcu-style-theme) #sidebar .mobile-menu-button {
	padding-block: 16px;
	background: var(--dprcu-panel);
	border: 2px solid var(--dprcu-accent);
	border-radius: 10px;
	box-shadow: none;
	color: var(--dprcu-accent);
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.3;
}
:where(.dprcu-style-theme) #sidebar .mobile-menu-button:hover,
:where(.dprcu-style-theme) #sidebar .mobile-menu-button:focus-visible { border-color: var(--dprcu-highlight); outline: none; }

:where(.dprcu-style-theme) #sidebar#sidebar .mobile-menu-container {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}
:where(.dprcu-style-theme) #sidebar#sidebar .mobile-menu-container > .mobile-menu-button {
	flex: 0 1 auto;
	width: min(200px, calc(50% - 6px));
}

/* --- Price and Add to cart on one row, stacked when the panel is narrow --- */
:where(.dprcu-style-theme) #app-container #sidebar-action-bar {
	border-top: 1px solid var(--dprcu-divider);
	padding: 14px 22px;
	background: var(--dprcu-panel);
}

:where(.dprcu-style-theme) #app-container #dprcu-express-form,
:where(.dprcu-style-theme) #app-container #dprcu-express-form > div,
:where(.dprcu-style-theme) #app-container .dprcu-price-cart-wrapper { min-width: 0; max-width: 100%; }

:where(.dprcu-style-theme) #app-container .dprcu-price-cart-wrapper {
	display: flex;
	align-items: center;
	gap: 10px 14px;
	flex-wrap: wrap;
}

@media (max-width: 1199px) {
	:where(.dprcu-style-theme) #app-container #dprcu-total-price { flex: 1 1 100%; }
	:where(.dprcu-style-theme) #app-container .dprcu-cart-btn { flex: 1 1 100%; }
}

@media (min-width: 1000px) and (max-width: 1199px) {
	:where(.dprcu-style-theme) #app-container#app-container { height: clamp(560px, 72vh, 680px); }
}

:where(.dprcu-style-theme) #app-container #dprcu-total-price {
	font-size: 20px;
	line-height: 1.2;
	font-weight: 700;
	flex: 0 1 auto;
	min-width: 0;
	color: var(--dprcu-accent);
}

:where(.dprcu-style-theme) #app-container .dprcu-cart-btn {
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1.2em;
	letter-spacing: 0.04em;
	padding: 16px 28px;
	border-style: none;
	flex: 1 1 150px;
	min-width: 0;
	justify-content: center;
	white-space: nowrap;
	border-radius: 8px;
}
:where(.dprcu-style-theme) #app-container .dprcu-cart-btn svg { display: none; }

html :where(.dprcu-style-theme) #app-container#app-container .dprcu-cart-btn.dprcu-cart-btn:not(:disabled) {
	background: var(--dprcu-accent);
	color: var(--dprcu-highlight);
}
html :where(.dprcu-style-theme) #app-container#app-container .dprcu-cart-btn.dprcu-cart-btn:not(:disabled):hover {
	background: var(--dprcu-accent-hover);
	color: var(--dprcu-highlight);
}

/* --- Viewer tools: smaller, so eleven of them fit the height of the frame --- */
:where(.dprcu-style-theme) #canvas-container { padding: 0; }
:where(.dprcu-style-theme) #canvas-container > div:has(> .control-btn) {
	flex-wrap: wrap;
	align-content: center;
	max-height: calc(100% - 12px);
	gap: 3px 6px;
}
:where(.dprcu-style-theme) #canvas-container .control-btn {
	width: 38px;
	height: 38px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
:where(.dprcu-style-theme) #canvas-container .control-btn svg { width: 18px; height: 18px; }

@media (max-width: 999px) {
	:where(.dprcu-style-theme) #canvas-container .control-btn { width: 32px; height: 32px; }
	:where(.dprcu-style-theme) #canvas-container .control-btn svg { width: 16px; height: 16px; }
}

/* AR only works on phones and tablets. */
@media (min-width: 1000px) {
	:where(.dprcu-style-theme) #canvas-container #btn-view-ar { display: none; }
}

/* --- Share and help dialogs --- */
:where(.dprcu-style-theme) .share-modal-content,
:where(.dprcu-style-theme) .help-modal-content {
	font-family: inherit;
	background: #fff;
	border-radius: 4px;
	max-width: min(560px, calc(100vw - 32px));
	max-height: min(86vh, 760px);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

:where(.dprcu-style-theme) .share-modal-header,
:where(.dprcu-style-theme) .help-modal-header {
	font-family: inherit;
	font-size: 12px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--dprcu-text);
	border-bottom: 1px solid var(--dprcu-border);
}

:where(.dprcu-style-theme) .share-modal-body,
:where(.dprcu-style-theme) .help-modal-body { font-size: 15px; color: var(--dprcu-accent); }

:where(.dprcu-style-theme) .share-option label,
:where(.dprcu-style-theme) .shortcuts-section > span:first-child {
	font-family: inherit;
	font-size: 11px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--dprcu-text);
}

:where(.dprcu-style-theme) .share-modal .btn-link-copy,
:where(.dprcu-style-theme) .share-modal .btn-download-image {
	background: var(--dprcu-accent);
	border-color: var(--dprcu-accent);
	color: #fff;
	border-radius: 2px;
	font-family: inherit;
	letter-spacing: .06em;
	text-transform: uppercase;
	font-size: 13px;
}

/* Social buttons in their brand colors were a rainbow: outlined instead. */
:where(.dprcu-style-theme) .share-modal .share-btn {
	background: #fff;
	border: 1px solid var(--dprcu-border);
	color: var(--dprcu-accent);
	border-radius: 2px;
	font-family: inherit;
	font-size: 14px;
}
:where(.dprcu-style-theme) .share-modal .share-btn:hover { border-color: var(--dprcu-accent); }

:where(.dprcu-style-theme) .share-modal #share-link-input {
	font-family: inherit;
	font-size: 14px;
	border: 1px solid var(--dprcu-border);
	border-radius: 2px;
	min-width: 0;
}

@media (max-width: 767px) {
	:where(.dprcu-style-theme) .share-modal-content,
	:where(.dprcu-style-theme) .help-modal-content {
		max-width: calc(100vw - 24px);
		max-height: 88vh;
	}
	:where(.dprcu-style-theme) .help-modal-body kbd,
	:where(.dprcu-style-theme) .help-modal-body .shortcut-keys { display: none; }
	:where(.dprcu-style-theme) .share-modal .share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* =============================================================================
   Elementor widgets (includes/elementor.php): the same parts on their own
   ============================================================================= */
.dprcu-viewer #canvas-container { height: 480px; } /* the widget's Height control overrides it */
/* The viewer takes the width of its column, like Elementor's Video or Google Maps widgets. The
   renderer sizes the canvas from its container: if the canvas could size the viewer in turn, the
   first width ever drawn would stick, and in a row (Elementor's "Grow" does not shrink) it pushed
   the next column out of the frame. */
.dprcu-viewer { min-width: 0; contain: inline-size; }
/* The options panel fills its column: the base #sidebar is the fixed 420px panel of the app layout. */
#sidebar.dprcu-options { width: auto; min-width: 0; max-width: none; height: auto; }
:where(.dprcu-style-theme) .dprcu-viewer {
	border: 1px solid var(--dprcu-border);
	border-radius: 4px;
	overflow: hidden;
	background: var(--dprcu-viewer);
}
:where(.dprcu-style-theme) .dprcu-viewer--plain { border: 0; border-radius: 0; }
:where(.dprcu-style-theme) .dprcu-viewer .dprcu-model-switcher {
	margin: 0;
	padding: 14px 16px;
	border-bottom: 1px solid var(--dprcu-border);
}
.dprcu-elementor-placeholder {
	padding: 24px;
	text-align: center;
	font-size: 13px;
	color: #666;
	background: rgba(0, 0, 0, .04);
}
/* Option links (markCurrentOptions): the current one wears the ring of the swatches. */
.dprcu-option-link[aria-current="true"] {
	outline: var(--dprcu-ring-width, 3px) solid var(--dprcu-highlight, #096dd9);
	outline-offset: calc(0px - var(--dprcu-ring-width, 3px)); /* over the border: the swatch keeps its size */
}

/* =============================================================================
   Model switcher ([dprcu-customizer ids="…"])
   ============================================================================= */
.dprcu-model-switcher {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 36px;
    margin: 0 0 22px;
}
.dprcu-model-switcher__label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dprcu-text, #333);
}
.dprcu-model-switcher__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.dprcu-model-switcher__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 122px;
    min-height: 62px;
    padding: 0 18px;
    border: 2px solid var(--dprcu-accent, #096dd9);
    border-radius: 10px;
    color: var(--dprcu-text, #333);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .05em;
    text-decoration: none;
    transition: border-color .15s ease;
}
.dprcu-model-switcher__item:hover,
.dprcu-model-switcher__item:focus-visible,
.dprcu-model-switcher__item.is-active {
    border-color: var(--dprcu-highlight, #096dd9);
    outline: none;
}
.dprcu-model-switcher__item.is-active { color: var(--dprcu-accent, #096dd9); }
/* Links elsewhere on the page that switch the model (initModelSwitcher): the current one gets the
   highlight colour drawn over its own border, whatever the theme styles the link with. */
.dprcu-model-link[aria-current="true"]:not(.dprcu-model-switcher__item) {
    outline: 2px solid var(--dprcu-highlight, #096dd9);
    outline-offset: -2px;
}
@media (max-width: 560px) {
    .dprcu-model-switcher { gap: 8px; }
    .dprcu-model-switcher__list { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .dprcu-model-switcher__item { min-width: 0; min-height: 46px; padding: 0 4px; font-size: 12px; letter-spacing: .02em; border-radius: 8px; }
}
