/* ====================================================================
 * Personnalisation produit — CTA, popup split, aperçu zone
 * ================================================================== */

.psp__perso-row {
    margin-top: 16px;
    padding-top: 4px;
}

.psp__perso-row.is-perso-blocked .psp__perso-cta {
    display: none;
}

.psp__perso-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0b0b0b;
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 48%, #fff7ed 100%);
    border: 1px solid rgba(15, 15, 15, 0.1);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.psp__perso-cta:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.14);
}

.psp__perso-cta:disabled,
.psp__perso-cta.is-locked {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.psp__perso-cta-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
    text-align: center;
}

.psp__perso-cta-hint:empty,
.psp__perso-cta-hint[hidden] {
    display: none;
}

.psp__perso-cta-icon {
    font-size: 18px;
}

.psp__perso-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid rgba(22, 163, 74, 0.22);
    border-radius: 14px;
}

.psp__perso-summary[hidden],
.psp__perso-cta[hidden] {
    display: none !important;
}

.psp__perso-summary-title {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #15803d;
}

.psp__perso-summary-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #14532d;
}

.psp__perso-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.psp__perso-summary-edit,
.psp__perso-summary-remove {
    padding: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ------------------------------------------------------------------
 * Modal plein écran — image gauche / options droite
 * ---------------------------------------------------------------- */
.psp-perso-modal {
    --psp-perso-accent: #4f46e5;
    --psp-perso-accent-soft: #eef2ff;
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

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

body.psp-perso-modal-open {
    overflow: hidden;
}

.psp-perso-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 14, 0.52);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.psp-perso-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 1080px;
    height: min(90vh, 720px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    animation: pspPersoIn 440ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pspPersoIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.psp-perso-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 50%;
    cursor: pointer;
    color: #0b0b0b;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.psp-perso-modal__close svg {
    width: 18px;
    height: 18px;
}

.psp-perso-modal__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Colonne aperçu (fixe) */
.psp-perso-modal__preview-col {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: linear-gradient(160deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1px solid rgba(15, 15, 15, 0.06);
    padding: 20px;
    min-height: 0;
    overflow-y: auto;
}

/* Cadre 4/5 strict — même contrat que .primtee-perso-zone-editor__stage (admin) */
.psp-perso-preview__stage.primtee-perso-stage-ref {
    flex: 0 0 auto;
    width: 100% !important;
    max-width: 100%;
    aspect-ratio: 4 / 5;
    height: auto !important;
    max-height: none !important;
    min-height: 0;
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(15, 15, 15, 0.06);
}

.psp-perso-preview__zoom-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 160ms, background 160ms;
}

.psp-perso-preview__zoom-btn:hover {
    transform: scale(1.05);
    background: #fff;
}

.psp-perso-preview__zoom-btn svg {
    width: 20px;
    height: 20px;
}

/* Lightbox aperçu agrandi (sans cadre) */
.psp-perso-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.psp-perso-lightbox[hidden] {
    display: none !important;
}

body.psp-perso-lightbox-open {
    overflow: hidden;
}

.psp-perso-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 14, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.psp-perso-lightbox__dialog {
    position: relative;
    width: min(96vw, 920px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.psp-perso-lightbox__close {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.psp-perso-lightbox__close svg {
    width: 18px;
    height: 18px;
}

.psp-perso-lightbox__stage.primtee-perso-stage-ref {
    width: min(96vw, calc(min(92vh, 920px) * 4 / 5)) !important;
    max-width: 100%;
    aspect-ratio: 4 / 5;
    height: auto !important;
    max-height: min(92vh, 920px);
    margin: 0 auto;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.psp-perso-lightbox__overlay {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px 6px;
    overflow: visible;
    pointer-events: none;
}

.psp-perso-preview__zone-frame {
    border: 1px dashed rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
    transition: border-color 200ms, background 200ms;
}

.psp-perso-preview__zone-frame.is-overflow {
    border: 2px solid #dc2626;
    background: rgba(220, 38, 38, 0.12);
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.psp-perso-preview__overlay {
    pointer-events: none;
    z-index: 2;
}

.psp-perso-preview__stage.is-text-overflow {
    overflow: visible;
}

.psp-perso-preview__text {
    display: block;
    width: max-content;
    max-width: none;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex-shrink: 0;
    min-height: 0.9em;
}

.psp-perso-preview__text[data-role='preview-line1'] {
    order: 1;
}

.psp-perso-preview__text--line2 {
    order: 2;
}

.psp-perso-preview__text.is-sample {
    opacity: 0.42;
}

.psp-perso-preview__text--line2 {
    opacity: 0.92;
}

.psp-perso-preview__text.is-overflow {
    color: #dc2626 !important;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.9), 0 1px 4px rgba(220, 38, 38, 0.45) !important;
    opacity: 1;
    position: relative;
    z-index: 3;
}

.psp-perso-preview__mark-size {
    flex-shrink: 0;
    margin: 10px 0 0;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    text-align: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    line-height: 1.4;
}

.psp-perso-preview__mark-size[hidden] {
    display: none !important;
}

.psp-perso-preview__text.is-broderie {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 5px rgba(0, 0, 0, 0.4);
}

.psp-perso-preview__text.is-flocage {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.psp-perso-preview__color {
    flex-shrink: 0;
    margin: 12px 0 0;
    padding: 8px 12px;
    font-size: 12px;
    color: #475569;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

/* Colonne options */
.psp-perso-modal__options-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
}

.psp-perso-modal__options-col input,
.psp-perso-modal__options-col button,
.psp-perso-modal__options-col select,
.psp-perso-modal__options-col textarea {
    visibility: visible;
    opacity: 1;
    max-width: 100%;
}

.psp-perso-modal__options-col .psp-perso-field__input {
    display: block;
    width: 100%;
}

.psp-perso-modal__head {
    flex-shrink: 0;
    padding: 24px 24px 12px;
    padding-right: 52px;
}

.psp-perso-modal__eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    color: #64748b;
}

.psp-perso-modal__title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.15;
}

.psp-perso-modal__technique {
    display: inline-block;
    margin: 10px 0 0;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--psp-perso-accent);
    background: var(--psp-perso-accent-soft);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.psp-perso-modal__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 24px 16px;
    -webkit-overflow-scrolling: touch;
}

.psp-perso-fields__hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

.psp-perso-field {
    display: block;
    margin-bottom: 14px;
}

.psp-perso-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.psp-perso-field__input {
    width: 100%;
    padding: 13px 15px;
    font-family: inherit;
    font-size: 16px;
    border: 1px solid rgba(15, 15, 15, 0.1);
    border-radius: 12px;
    box-sizing: border-box;
    background: #fafafa;
    transition: border-color 200ms, box-shadow 200ms, background 200ms;
}

.psp-perso-field__input:focus {
    outline: none;
    background: #fff;
    border-color: var(--psp-perso-accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.psp-perso-section {
    margin-bottom: 18px;
}

.psp-perso-section__label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.psp-perso-section__hint {
    margin: 0 0 10px;
    font-size: 11px;
    color: #94a3b8;
}

.psp-perso-section--scale {
    padding: 14px 0 4px;
    border-top: 1px solid rgba(15, 15, 15, 0.06);
}

.psp-perso-scale-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.psp-perso-scale-head .psp-perso-section__label {
    margin: 0;
}

.psp-perso-scale-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--psp-perso-accent, #4f46e5);
    font-variant-numeric: tabular-nums;
}

.psp-perso-scale-value.is-overflow {
    color: #dc2626;
}

.psp-perso-scale-slider {
    width: 100%;
    margin: 8px 0 12px;
    accent-color: var(--psp-perso-accent, #4f46e5);
    cursor: pointer;
}

.psp-perso-scale-fit {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-align: center;
    background: #f8fafc;
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 200ms, background 200ms;
}

.psp-perso-scale-fit:hover {
    border-color: rgba(15, 15, 15, 0.16);
    background: #f1f5f9;
}

.psp-perso-scale-warn {
    margin: 10px 0 0;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #b91c1c;
    line-height: 1.4;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.psp-perso-scale-warn[hidden] {
    display: none !important;
}

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

.psp-perso-font {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    text-align: left;
    background: #f8fafc;
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 200ms, background 200ms, transform 160ms;
}

.psp-perso-font:hover {
    border-color: rgba(15, 15, 15, 0.16);
    transform: translateY(-1px);
}

.psp-perso-font.is-active {
    border-color: var(--psp-perso-accent);
    background: var(--psp-perso-accent-soft);
    color: #312e81;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.2);
}

.psp-perso-font__sample {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(15, 15, 15, 0.06);
}

.psp-perso-font__name {
    line-height: 1.2;
}

.psp-perso-weight {
    display: flex;
    gap: 8px;
}

.psp-perso-weight__btn {
    flex: 1;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    background: #f8fafc;
    border: 1px solid rgba(15, 15, 15, 0.08);
    border-radius: 12px;
    cursor: pointer;
}

.psp-perso-weight__btn.is-active {
    border-color: var(--psp-perso-accent);
    background: var(--psp-perso-accent-soft);
    color: #312e81;
    font-weight: 600;
}

.psp-perso-modal__hint {
    margin: 0;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.45;
}

.psp-perso-modal__error {
    margin: 12px 0 0;
    padding: 10px 12px;
    font-size: 13px;
    color: #b91c1c;
    background: #fef2f2;
    border-radius: 10px;
}

.psp-perso-modal__error[hidden] {
    display: none !important;
}

.psp-perso-modal__foot {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    padding: 16px 24px 22px;
    border-top: 1px solid rgba(15, 15, 15, 0.06);
    background: #fff;
}

.psp-perso-modal__btn {
    flex: 1;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
}

.psp-perso-modal__btn--ghost {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid rgba(15, 15, 15, 0.08);
}

.psp-perso-modal__btn--primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.psp-perso-modal__btn--primary:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

@media (max-width: 860px) {
    .psp-perso-modal {
        padding: 0;
        align-items: stretch;
    }

    .psp-perso-modal__dialog {
        max-width: none;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .psp-perso-modal__layout {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }

    .psp-perso-modal__preview-col {
        flex: 0 0 auto;
        max-height: none;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid rgba(15, 15, 15, 0.06);
        padding: 12px;
    }

    .psp-perso-preview__stage.primtee-perso-stage-ref {
        width: 100% !important;
        max-height: none !important;
        aspect-ratio: 4 / 5;
    }

    .psp-perso-modal__options-col {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }

    .psp-perso-modal__scroll {
        flex: 1 1 auto;
        min-height: 180px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .psp-perso-modal__head {
        padding: 16px 16px 8px;
        padding-right: 48px;
    }

    .psp-perso-modal__foot {
        padding: 12px 16px 16px;
    }

    .psp-perso-modal__close {
        top: 10px;
        right: 10px;
    }
}
