/**
 * Vloerkleed in de ruimte - wizard styling.
 *
 * Palette and fonts mirror huiswonen/src/scss/_variables.scss so the modal
 * reads as part of the shop. Everything is scoped under .ds-room-preview
 * (plus the launch block) so it cannot leak into the theme.
 */

.ds-room-preview,
.ds-room-preview-launch {
    --ds-rp-accent: #ff6700;
    --ds-rp-accent-dark: #cc5200;
    --ds-rp-heading: #2e2950;
    --ds-rp-text: #252525;
    --ds-rp-muted: #8f8f8f;
    --ds-rp-border: #ececec;
    --ds-rp-surface: #f6f6f6;
    --ds-rp-font: 'Avenir Next', sans-serif;
    --ds-rp-font-heading: 'FilsonSoftW03', 'Filson Soft', sans-serif;
}

/* ------------------------------------------------------ launch button
 *
 * The button sits right under "Plaats in winkelwagen" in the summary column
 * and wears the theme's own .button.button--inverted, so colour, radius,
 * typography and the arrow icon all come from the theme. Only the things the
 * theme does not give a secondary CTA are set here.
 */

.ds-room-preview-launch {
    width: 100%;
    margin: 20px 0 0;
    font-family: var(--ds-rp-font);
}

.ds-room-preview-launch__button {
    width: 100%;
    gap: .6rem;
    /* .button fixes a 56px height; the Dutch label wraps in the narrow
       summary column, so let it grow instead of clipping. */
    height: auto;
    min-height: 56px;
    line-height: 1.2;
}

/* WooCommerce's own `.woocommerce button.button` outranks the theme's
   .button--inverted, so the secondary CTA would render solid like the
   add-to-cart button. Re-assert the outline with a selector that wins. */
.woocommerce div.product .ds-room-preview-launch button.ds-room-preview-launch__button {
    background: transparent;
    color: var(--ds-rp-accent);
    border: 1px solid var(--ds-rp-accent);
}

.woocommerce div.product .ds-room-preview-launch button.ds-room-preview-launch__button:hover,
.woocommerce div.product .ds-room-preview-launch button.ds-room-preview-launch__button:focus {
    background: var(--ds-rp-accent);
    color: #fff;
}

.ds-room-preview-launch__note {
    display: block;
    margin-top: .5rem;
    color: var(--ds-rp-muted);
    font-size: .8125rem;
}

body.ds-room-preview-open {
    overflow: hidden;
}

/* ------------------------------------------------------------- shell */

.ds-room-preview {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--ds-rp-text);
    font-family: var(--ds-rp-font);
}

/**
 * The wizard hides everything through the `hidden` attribute, but the browser
 * default for it is a bare attribute selector - any class below that sets
 * `display` would silently win. This keeps `hidden` authoritative.
 */
.ds-room-preview[hidden],
.ds-room-preview [hidden] {
    display: none !important;
}

.ds-room-preview__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(46, 41, 80, .65);
}

.ds-room-preview__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(46, 41, 80, .35);
    overflow: hidden;
}

.ds-room-preview__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ds-rp-border);
}

/**
 * Double-scoped on purpose: WooCommerce ships
 * `.woocommerce-page img { height: auto; max-width: 100% }`, which outranks a
 * single class and would let the logo render at its native 327x44.
 */
.ds-room-preview .ds-room-preview__logo {
    flex: 0 0 auto;
    /* Both axes auto with a max on each: the browser then scales the logo
       down to fit while keeping its aspect ratio. Setting an explicit height
       alongside a max-width squashes it instead, because the max-width clamps
       the computed width without adjusting the height. */
    width: auto;
    height: auto;
    max-width: 150px;
    max-height: 26px;
}

.ds-room-preview__title {
    flex: 1 1 auto;
    margin: 0;
    color: var(--ds-rp-heading);
    font-family: var(--ds-rp-font-heading);
    font-size: 1.05rem;
    font-weight: normal;
    line-height: 1.2;
}

.ds-room-preview__close {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ds-rp-surface);
    color: var(--ds-rp-heading);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.ds-room-preview__close:hover {
    background: var(--ds-rp-accent);
    color: #fff;
}

.ds-room-preview__body {
    padding: 1.25rem;
    overflow-y: auto;
}

/* ------------------------------------------------------------- steps */

.ds-room-preview__steps {
    display: flex;
    gap: .25rem;
    margin: 0;
    padding: .75rem 1.25rem;
    list-style: none;
    border-bottom: 1px solid var(--ds-rp-border);
    background: var(--ds-rp-surface);
    font-size: .8125rem;
}

.ds-room-preview__steps-item {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: .4rem;
    color: var(--ds-rp-muted);
}

.ds-room-preview__steps-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #e2e0e6;
    color: var(--ds-rp-heading);
    font-size: .75rem;
}

.ds-room-preview__steps-item.is-active {
    color: var(--ds-rp-heading);
    font-weight: 600;
}

.ds-room-preview__steps-item.is-active span {
    background: var(--ds-rp-accent);
    color: #fff;
}

.ds-room-preview__steps-item.is-done span {
    background: var(--ds-rp-heading);
    color: #fff;
}

/* ------------------------------------------------------------ upload */

.ds-room-preview__dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: 2.5rem 1.25rem;
    border: 2px dashed #d5d3dc;
    border-radius: 6px;
    color: var(--ds-rp-muted);
    text-align: center;
    cursor: pointer;
    transition: border-color .25s ease-in-out, background .25s ease-in-out;
}

.ds-room-preview__dropzone:hover,
.ds-room-preview__dropzone.is-dragging {
    border-color: var(--ds-rp-accent);
    background: var(--ds-rp-surface);
}

.ds-room-preview__dropzone strong {
    color: var(--ds-rp-heading);
    font-family: var(--ds-rp-font-heading);
    font-size: 1rem;
}

.ds-room-preview__file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ds-room-preview__tip {
    margin: .85rem 0 0;
    color: var(--ds-rp-muted);
    font-size: .8125rem;
}

.ds-room-preview__working {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .85rem 0 0;
    color: var(--ds-rp-heading);
    font-size: .875rem;
}

/* ------------------------------------------------------------- sizes */

.ds-room-preview__sizes {
    margin-bottom: 1rem;
}

.ds-room-preview__sizes-label {
    display: block;
    margin-bottom: .4rem;
    color: var(--ds-rp-heading);
    font-size: .875rem;
    font-weight: 600;
}

.ds-room-preview__sizes-options {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.ds-room-preview__size {
    padding: .4rem .8rem;
    border: 1px solid var(--ds-rp-border);
    border-radius: 3px;
    background: #fff;
    color: var(--ds-rp-text);
    font-family: var(--ds-rp-font);
    font-size: .8125rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color .25s ease-in-out, color .25s ease-in-out;
}

.ds-room-preview__size:hover {
    border-color: var(--ds-rp-accent);
    color: var(--ds-rp-accent);
}

.ds-room-preview__size.is-active {
    border-color: var(--ds-rp-accent);
    background: var(--ds-rp-accent);
    color: #fff;
}

.ds-room-preview__custom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-top: .6rem;
    font-size: .8125rem;
}

.ds-room-preview__custom label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.ds-room-preview__custom input {
    width: 5rem;
    padding: .35rem .5rem;
    border: 1px solid #d5d3dc;
    border-radius: 3px;
    font-family: var(--ds-rp-font);
    font-size: .875rem;
}

.ds-room-preview__custom input:focus {
    border-color: var(--ds-rp-accent);
    outline: none;
}

.ds-room-preview__custom-max {
    color: var(--ds-rp-muted);
}

/* ------------------------------------------------------------- modes */

.ds-room-preview__modes {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .9rem;
}

.ds-room-preview__mode {
    padding: .45rem .9rem;
    border: 1px solid var(--ds-rp-border);
    border-radius: 3px;
    background: #fff;
    color: var(--ds-rp-text);
    font-family: var(--ds-rp-font);
    font-size: .875rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color .25s ease-in-out, color .25s ease-in-out;
}

.ds-room-preview__mode:hover {
    border-color: var(--ds-rp-accent);
    color: var(--ds-rp-accent);
}

.ds-room-preview__mode.is-active {
    border-color: var(--ds-rp-accent);
    background: var(--ds-rp-accent);
    color: #fff;
}

/* ------------------------------------------------------------- point */

.ds-room-preview__hint {
    margin: 0 0 .85rem;
    font-size: .9375rem;
}

.ds-room-preview__hint strong {
    color: var(--ds-rp-heading);
}

.ds-room-preview__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 55vh;
    background: var(--ds-rp-surface);
    border-radius: 4px;
    overflow: hidden;
    cursor: crosshair;
}

.ds-room-preview__photo {
    display: block;
    max-width: 100%;
    max-height: 55vh;
    height: auto;
    -webkit-user-select: none;
    user-select: none;
}

/**
 * The footprint overlay. The svg itself ignores pointer events so a click on
 * bare floor still seeds a rug; the shape and its handles opt back in so they
 * can be dragged.
 */
.ds-room-preview__quad {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.ds-room-preview__quad polygon {
    fill: rgba(255, 103, 0, .28);
    stroke: #fff;
    stroke-width: 2;
    stroke-dasharray: 7 5;
    pointer-events: auto;
    cursor: move;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .45));
}

.ds-room-preview__handle {
    fill: var(--ds-rp-accent);
    stroke: #fff;
    stroke-width: 3;
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .45));
}

.ds-room-preview__handle:active {
    cursor: grabbing;
}

/* ------------------------------------------------------------- email */

.ds-room-preview__field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-width: 22rem;
    margin-bottom: 1rem;
}

.ds-room-preview__field label {
    color: var(--ds-rp-heading);
    font-size: .875rem;
    font-weight: 600;
}

.ds-room-preview__field input {
    padding: .6rem .75rem;
    border: 1px solid #d5d3dc;
    border-radius: 3px;
    font-family: var(--ds-rp-font);
    font-size: 1rem;
}

.ds-room-preview__field input:focus {
    border-color: var(--ds-rp-accent);
    outline: none;
}

.ds-room-preview__captcha {
    margin-bottom: 1rem;
}

.ds-room-preview__privacy {
    margin: 0 0 1rem;
    color: var(--ds-rp-muted);
    font-size: .8125rem;
    line-height: 1.5;
}

/* ------------------------------------------------------------ result */

.ds-room-preview__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--ds-rp-muted);
}

.ds-room-preview__loading strong {
    color: var(--ds-rp-heading);
    font-family: var(--ds-rp-font-heading);
    font-size: 1rem;
    font-weight: normal;
}

.ds-room-preview__spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid var(--ds-rp-border);
    border-top-color: var(--ds-rp-accent);
    border-radius: 50%;
    animation: ds-room-preview-spin 1s linear infinite;
}

.ds-room-preview__spinner--small {
    width: 1.1rem;
    height: 1.1rem;
    border-width: 2px;
}

@keyframes ds-room-preview-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ds-room-preview__spinner {
        animation-duration: 3s;
    }
}

.ds-room-preview__result .ds-room-preview__photo {
    width: 100%;
    max-height: 55vh;
    object-fit: contain;
    border-radius: 4px;
    background: var(--ds-rp-surface);
}

.ds-room-preview__mailed {
    margin: .75rem 0 0;
    color: var(--ds-rp-heading);
    font-size: .875rem;
}

.ds-room-preview__disclaimer {
    margin: .35rem 0 0;
    color: var(--ds-rp-muted);
    font-size: .75rem;
}

/* ----------------------------------------------------------- actions */

.ds-room-preview__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.ds-room-preview__action {
    padding: .65rem 1.3rem;
    border: 1px solid #d5d3dc;
    border-radius: 3px;
    background: #fff;
    color: var(--ds-rp-text);
    font-family: var(--ds-rp-font);
    font-size: .9375rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background .25s ease-in-out, color .25s ease-in-out, border-color .25s ease-in-out;
}

.ds-room-preview__action:hover {
    border-color: var(--ds-rp-accent);
    color: var(--ds-rp-accent);
    text-decoration: none;
}

.ds-room-preview__action--primary {
    border-color: var(--ds-rp-accent);
    background: var(--ds-rp-accent);
    color: #fff;
}

.ds-room-preview__action--primary:hover {
    border-color: var(--ds-rp-accent-dark);
    background: var(--ds-rp-accent-dark);
    color: #fff;
}

.ds-room-preview__action[disabled] {
    opacity: .4;
    cursor: not-allowed;
}

.ds-room-preview__action[disabled]:hover {
    border-color: #d5d3dc;
    background: #fff;
    color: var(--ds-rp-text);
}

.ds-room-preview__action--primary[disabled]:hover {
    border-color: var(--ds-rp-accent);
    background: var(--ds-rp-accent);
    color: #fff;
}

.ds-room-preview__error {
    margin: .85rem 0 0;
    padding: .6rem .75rem;
    border-radius: 3px;
    background: #fdecea;
    color: #932420;
    font-size: .875rem;
}

@media (max-width: 600px) {
    .ds-room-preview {
        padding: 0;
    }

    .ds-room-preview__dialog {
        max-width: none;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .ds-room-preview .ds-room-preview__logo {
        max-width: 110px;
        max-height: 20px;
    }

    .ds-room-preview__steps-item {
        font-size: .6875rem;
    }

    .ds-room-preview__mode {
        flex: 1 1 auto;
        font-size: .8125rem;
    }
}
