/**
 * BluSky Product Configurator — Stylesheet
 * Compatible with: WordPress, WooCommerce, Flatsome theme, Formidable Forms
 *
 * Architecture:
 *   .bpc-launch-wrap        Launch button wrapper
 *   .bpc-modal              Full-screen overlay
 *   .bpc-modal__dialog      Scrollable inner container
 *   .bpc-modal__body        Side-by-side panels (left = tools, right = preview)
 *   .bpc-panel--left        Colour wheel + inputs + swatch gallery
 *   .bpc-panel--right       Product image + multiply overlay
 *   .bpc-modal__form-section  Formidable Form section below the panels
 */

/* ── Reset / base ─────────────────────────────────────────────────────────── */
.bpc-launch-wrap *,
.bpc-modal * {
    box-sizing: border-box;
}


/* ── Modal overlay ────────────────────────────────────────────────────────── */
.bpc-configurator {
    display: block;
    width: 100%;
}

.bpc-configurator__inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.bpc-modal[hidden] {
    display: none !important;
}

/* Backdrop */
.bpc-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
}

/* Dialog container */



/* ── Modal body — two-column layout ──────────────────────────────────────── */
.bpc-modal__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 480px;
}


/* ── Swatch Sample Preview heading ──────────────────────────────────── */
.bpc-swatch-preview-heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--bpc-text, #1a1a1a);
}

/* ── Panels ───────────────────────────────────────────────────────────────── */
.bpc-panel {
    padding: 28px;
}

.bpc-panel--left {
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.bpc-panel--right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    gap: 12px;
}

/* ── Colour wheel canvas ──────────────────────────────────────────────────── */
.bpc-wheel-wrap {
    display: flex;
    justify-content: center;
}

.bpc-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
    border-radius: 50%;
}

.bpc-canvas:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 4px;
}

/* ── HEX + Pantone input row ─────────────────────────────────────────────── */
.bpc-inputs-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 10px;
}

.bpc-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bpc-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
}

.bpc-hex-input,
.bpc-pantone-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: 'Courier New', Courier, monospace;
    border: 1.5px solid #ddd;
    border-radius: 4px;
    color: #1a1a1a;
    background: #fff;
    transition: border-color 0.2s;
}

.bpc-hex-input:focus,
.bpc-pantone-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.bpc-hex-input.bpc-input--error,
.bpc-pantone-input.bpc-input--error {
    border-color: #cc0000;
}

.bpc-pantone-hint {
    margin: 4px 0 0;
    font-size: 11px;
    color: #cc0000;
    line-height: 1.4;
}

/* Live preview swatch between the two inputs */
.bpc-preview-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 9px; /* aligns swatch bottom with input field bottom */
}

.bpc-preview-swatch__inner {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1.5px solid #ccc;
    background: #fff;
    transition: background 0.2s;
    flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.bpc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
    border: 2px solid transparent;
    white-space: nowrap;
}

.bpc-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

.bpc-btn:active {
    transform: scale(0.98);
}

.bpc-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Apply Colour to Swatch */
.bpc-btn--apply {
    width: 100%;
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.bpc-btn--apply:hover,
.bpc-btn--apply:focus-visible {
    background: #005f8a;
    border-color: #005f8a;
}

/* Save Current Swatch */
.bpc-btn--save {
    width: 100%;
    background: #fff;
    color: #1a1a1a;
    border-color: #ccc;
}

.bpc-btn--save:hover,
.bpc-btn--save:focus-visible {
    background: #f0f0f0;
    border-color: #1a1a1a;
}

/* Add to Enquiry */
.bpc-btn--enquiry {
    flex: 1;
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.bpc-btn--enquiry:hover,
.bpc-btn--enquiry:focus-visible {
    background: #333;
    border-color: #333;
}

/* Clear All gallery */
.bpc-btn--clear-gallery {
    background: transparent;
    color: #888;
    border-color: #ddd;
    font-weight: 500;
    padding: 10px 14px;
}

.bpc-btn--clear-gallery:hover,
.bpc-btn--clear-gallery:focus-visible {
    border-color: #cc0000;
    color: #cc0000;
}

/* Apply row / save row */
.bpc-apply-row,
.bpc-save-row {
    display: flex;
}

/* ── Saved swatch gallery ────────────────────────────────────────────────── */
.bpc-gallery {
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    background: #fafafa;
}

.bpc-gallery__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.bpc-gallery__title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #333;
}

.bpc-gallery__hint {
    font-size: 11px;
    color: #999;
}

.bpc-gallery__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    min-height: 48px;
}

/* Individual saved swatch tile */
.bpc-swatch-tile {
    position: relative;
    width: 52px;
    cursor: pointer;
    transition: transform 0.15s;
}

.bpc-swatch-tile:hover {
    transform: scale(1.08);
}

.bpc-swatch-tile__colour {
    width: 52px;
    height: 52px;
    border-radius: 5px;
    border: 2px solid #ccc;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.bpc-swatch-tile.is-selected .bpc-swatch-tile__colour {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

.bpc-swatch-tile__label {
    display: block;
    margin-top: 3px;
    font-size: 9px;
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 52px;
}

/* Remove button on each tile */
.bpc-swatch-tile__remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 1.5px solid #ccc;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: #888;
    font-size: 11px;
    line-height: 1;
    transition: border-color 0.15s, color 0.15s;
}

.bpc-swatch-tile__remove svg {
    width: 9px;
    height: 9px;
}

.bpc-swatch-tile:hover .bpc-swatch-tile__remove {
    display: flex;
}

.bpc-swatch-tile__remove:hover {
    border-color: #cc0000;
    color: #cc0000;
}

.bpc-gallery__select-all-row {
    margin-bottom: 10px;
}

/* Select All / Deselect All toggle */
.bpc-btn--select-all {
    width: 100%;
    background: transparent;
    color: #0073aa;
    border-color: #0073aa;
    font-weight: 500;
    font-size: 13px;
    padding: 8px 16px;
}

.bpc-btn--select-all:hover,
.bpc-btn--select-all:focus-visible {
    background: #e3f2fd;
    border-color: #005f8a;
    color: #005f8a;
}

.bpc-gallery__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Status message ─────────────────────────────────────────────────────────*/
.bpc-status {
    margin: 0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.bpc-status--success {
    background: #e6f4ea;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.bpc-status--error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.bpc-status--info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* ── Right panel — product image preview ────────────────────────────────── */
.bpc-preview-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.bpc-preview-img {
    display: block;
    width: 100%;
    max-width: 440px;
    height: auto;
    border-radius: 6px;
    user-select: none;
}

/* Multiply colour overlay */
.bpc-colour-overlay {
    position: absolute;
    inset: 0;
    mix-blend-mode: multiply;
    background: transparent;
    border-radius: 6px;
    pointer-events: none;
    transition: background 0.35s ease;
}

.bpc-preview-label {
    margin: 0;
    font-size: 11px;
    color: #999;
    text-align: center;
    font-style: italic;
}

/* ── Formidable Form section ─────────────────────────────────────────────── */
.bpc-modal__form-section {
    border-top: 1px solid #e5e5e5;
    padding: 28px;
    background: #fafafa;
}

.bpc-form-header {
    margin-bottom: 20px;
}

.bpc-form-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.bpc-form-intro {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* Enquiry colour summary */
.bpc-enquiry-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 16px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 5px;
    font-size: 13px;
    color: #1565c0;
}

.bpc-enquiry-summary__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Small summary swatch chip */
.bpc-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 20px;
    background: #fff;
    border: 1.5px solid #90caf9;
    font-size: 11px;
    font-family: 'Courier New', Courier, monospace;
    color: #1a1a1a;
}

.bpc-summary-chip__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Post-submission: success message + close button ─────────────────────── */
.bpc-post-submit {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    margin-top: 16px;
    background: #e6f4ea;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    text-align: center;
}

.bpc-post-submit.is-visible {
    display: flex;
}

.bpc-post-submit__message {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2e7d32;
}

.bpc-post-submit__sub {
    margin: 0;
    font-size: 13px;
    color: #388e3c;
}

.bpc-btn--post-close {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
    padding: 12px 32px;
    font-size: 15px;
}

.bpc-btn--post-close:hover,
.bpc-btn--post-close:focus-visible {
    background: #333;
    border-color: #333;
}

/* Override FF form styles to fit inside modal */
.bpc-form-wrap .frm_forms {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.bpc-form-wrap .frm_submit button,
.bpc-form-wrap .frm_submit input[type="submit"] {
    background: #1a1a1a;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.bpc-form-wrap .frm_submit button:hover,
.bpc-form-wrap .frm_submit input[type="submit"]:hover {
    background: #333;
}

/* ── Flatsome theme overrides ────────────────────────────────────────────── */
.bpc-modal .ux-button,
.bpc-modal button.button {
    /* Reset any Flatsome global button styles inside modal */
    all: revert;
    box-sizing: border-box;
}


/*
 * Flatsome sticky header suppression.
 * When the modal is open, JS adds .bpc-modal-open to <body>.
 * We use this to lower the sticky header's z-index below the modal (999999).
 * Flatsome's header elements typically sit at z-index 100–1000.
 * Lowering them to z-index 1 while the modal is open is safe — the modal
 * backdrop covers the page anyway.
 *
 * These selectors cover Flatsome's known sticky header elements from the
 * HTML snapshot provided (header#header, .header-wrapper, #masthead,
 * .is-sticky-column, plus generic sticky/fixed positioned elements).
 */
body.bpc-modal-open header#header,
body.bpc-modal-open .header-wrapper,
body.bpc-modal-open #masthead,
body.bpc-modal-open .is-sticky-column,
body.bpc-modal-open [class*="sticky"],
body.bpc-modal-open .sticky-nav,
body.bpc-modal-open .sticky-header,
body.bpc-modal-open #top-bar {
    z-index: 1 !important;
}

/* WP admin bar — keep accessible above modal backdrop but below modal dialog */
body.bpc-modal-open #wpadminbar {
    z-index: 999998 !important;
}

/* ── Mobile — stacked layout ─────────────────────────────────────────────── */
@media (max-width: 768px) {

    .bpc-modal {
        padding: 12px 0;
        align-items: flex-start;
    }

    .bpc-modal__dialog {
        border-radius: 0;
        min-height: 100dvh;
        margin: 0;
    }

    .bpc-modal__header {
        padding: 16px 20px;
    }

    .bpc-modal__title {
        font-size: 17px;
    }

    /* Stack panels top / bottom on mobile */
    .bpc-modal__body {
        grid-template-columns: 1fr;
    }

    .bpc-panel--left {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        padding: 20px;
    }

    .bpc-panel--right {
        padding: 20px;
        min-height: 280px;
    }

    .bpc-inputs-row {
        grid-template-columns: 1fr auto 1fr;
    }

    .bpc-canvas {
        max-width: 280px;
    }

    .bpc-modal__form-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {

    .bpc-modal__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .bpc-modal__close {
        width: 100%;
        justify-content: center;
    }

    .bpc-inputs-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bpc-preview-swatch {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    .bpc-preview-swatch__inner {
        width: 28px;
        height: 28px;
    }

    .bpc-gallery__actions {
        flex-direction: column;
    }

    .bpc-btn--enquiry,
    .bpc-btn--clear-gallery {
        width: 100%;
    }
}
