@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Dancing+Script:wght@600&family=Fraunces:opsz,wght@9..144,600&family=Lobster&family=Outfit:wght@500;600&family=Pacifico&family=Playfair+Display:wght@600&display=swap');

/* Modal personnalisation — barre d'outils + aperçu circulaire */

.produit-actions-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    width: 100%;
}

.produit-actions-row .btn-add-panier {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

.produit-actions-row--single .btn-add-panier,
.produit-actions-row--single .btn-personnaliser {
    width: 100%;
}

.produit-cp-detail__hint {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--texte-fonce, #333);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.produit-cp-detail__hint i {
    color: var(--couleur-dominante, #E5488A);
    margin-top: 2px;
    flex-shrink: 0;
}

.btn-personnaliser {
    flex: 0 0 auto;
    padding: 14px 20px;
    border: 2px solid var(--couleur-dominante, #918a44);
    border-radius: 25px;
    background: #ffffff;
    color: var(--couleur-dominante, #918a44);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(145, 138, 68, 0.12);
}

.btn-personnaliser:hover,
.btn-personnaliser:focus-visible {
    background: rgba(145, 138, 68, 0.08);
    transform: translateY(-1px);
}

.btn-personnaliser.is-active {
    background: rgba(145, 138, 68, 0.12);
    border-color: #6b2f20;
}

.btn-add-cart.btn-personnaliser-card {
    background: #ffffff;
    color: var(--couleur-dominante, #918a44);
    border: 2px solid var(--couleur-dominante, #918a44);
    box-shadow: 0 2px 10px rgba(145, 138, 68, 0.15);
}

.btn-add-cart.btn-personnaliser-card:hover,
.btn-add-cart.btn-personnaliser-card:focus-visible {
    background: rgba(145, 138, 68, 0.1);
    transform: translateY(-1px);
}

.btn-add-cart.btn-personnaliser-card.is-active {
    background: rgba(145, 138, 68, 0.14);
    border-color: #6b2f20;
}

.produit-perso-promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(229, 72, 138, 0.1), rgba(145, 138, 68, 0.12));
    border: 1px solid rgba(229, 72, 138, 0.22);
    color: #6b2f20;
    font-size: 14px;
    line-height: 1.45;
    max-width: 100%;
    box-sizing: border-box;
}

.produit-perso-promo-badge strong {
    color: var(--couleur-dominante, #E5488A);
    font-weight: 800;
}

.produit-perso-promo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(229, 72, 138, 0.14);
    color: var(--couleur-dominante, #E5488A);
    flex-shrink: 0;
    animation: persoGiftPulse 1.4s ease-in-out infinite;
}

.produit-perso-promo-icon i {
    font-size: 16px;
}

@keyframes persoGiftPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    35% {
        transform: scale(1.12) rotate(-10deg);
    }
    70% {
        transform: scale(1.05) rotate(8deg);
    }
}

.produit-actions-row--cp {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.produit-cp-sans-perso-form {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    width: 100%;
}

.btn-commander-sans-perso {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid rgba(229, 72, 138, 0.35);
    border-radius: 25px;
    background: #ffffff;
    color: var(--couleur-dominante, #E5488A);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-commander-sans-perso:hover,
.btn-commander-sans-perso:focus-visible {
    background: rgba(229, 72, 138, 0.08);
    transform: translateY(-1px);
}

.produit-actions-row--cp .btn-personnaliser {
    width: 100%;
}

@media (min-width: 520px) {
    .produit-actions-row--cp {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .produit-actions-row--cp .btn-personnaliser,
    .produit-cp-sans-perso-form {
        flex: 1 1 calc(50% - 5px);
    }
}

.perso-status {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(145, 138, 68, 0.12);
    border: 1px solid rgba(145, 138, 68, 0.35);
    color: #6b2f20;
    font-size: 13px;
    font-weight: 600;
}

.perso-status.is-visible {
    display: flex;
}

.perso-status-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ——— Modal ——— */

.perso-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.perso-modal.is-open {
    display: flex;
}

.perso-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.perso-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1200px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #fff5f9 0%, #ffffff 45%, #fff0f6 100%);
    border: 2px solid rgba(229, 72, 138, 0.22);
    border-radius: 20px;
    padding: 22px 24px 20px;
    box-shadow: 0 24px 60px rgba(229, 72, 138, 0.22);
    animation: persoModalIn 0.28s ease;
}

@keyframes persoModalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.perso-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #333;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.perso-modal-close:hover {
    background: rgba(229, 72, 138, 0.15);
    color: var(--couleur-dominante, #E5488A);
}

.perso-modal-title {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 700;
    color: var(--couleur-dominante, #E5488A);
    font-family: 'Fraunces', serif;
    padding-right: 44px;
    flex-shrink: 0;
}

.perso-modal-layout {
    display: flex;
    gap: 24px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ——— Barre d'outils ——— */

.perso-toolbar {
    flex: 0 0 300px;
    width: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.perso-tool-section {
    background: rgba(229, 72, 138, 0.06);
    border: 1px solid rgba(229, 72, 138, 0.18);
    border-radius: 14px;
    padding: 14px;
}

.perso-tool-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--couleur-dominante, #E5488A);
    display: flex;
    align-items: center;
    gap: 8px;
}

.perso-upload-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 12px;
    border: 2px dashed rgba(229, 72, 138, 0.4);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.perso-upload-compact:hover,
.perso-upload-compact:focus-within {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.06);
}

.perso-upload-compact input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.perso-upload-compact-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(229, 72, 138, 0.12);
    color: var(--couleur-dominante, #E5488A);
    font-size: 18px;
}

.perso-upload-compact-text {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}

.perso-upload-compact-hint {
    font-size: 11px;
    color: #777;
}

.perso-upload-filename {
    font-size: 11px;
    color: #6b2f20;
    font-weight: 600;
    word-break: break-all;
}

.perso-dimension-field {
    margin-bottom: 10px;
}

.perso-paper-picker,
.perso-shape-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.perso-modal--cupcakes .perso-paper-picker,
.perso-modal--cupcakes .perso-shape-picker {
    grid-template-columns: repeat(2, 1fr);
}

.perso-modal--cupcakes .perso-preview-panel {
    overflow: visible;
    align-items: center;
    justify-content: center;
    padding: 16px 12px 20px;
}

.perso-modal--cupcakes .perso-preview-stage {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.perso-modal--cupcakes .perso-preview-viewport {
    width: min(340px, 100%);
    height: auto !important;
    aspect-ratio: 210 / 297;
    max-width: 100%;
    max-height: none;
    flex-shrink: 0;
}

@media (min-width: 901px) {
    .perso-modal--cupcakes .perso-preview-viewport {
        width: min(400px, 36vw);
    }
}

@media (min-width: 1200px) {
    .perso-modal--cupcakes .perso-preview-viewport {
        width: min(440px, 32vw);
    }
}

.perso-modal--cupcakes #cupcakes-preview-canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 210 / 297;
    display: block;
    cursor: default;
    background: #fff;
    box-shadow: 0 8px 28px rgba(42, 26, 34, 0.12);
    object-fit: contain;
}

@media (max-width: 900px) {
    .perso-modal--cupcakes .perso-preview-panel {
        position: relative !important;
        top: auto !important;
        overflow: visible;
        padding: 10px 12px 14px;
    }

    .perso-modal--cupcakes .perso-preview-viewport {
        width: min(260px, calc(100vw - 64px)) !important;
        height: auto !important;
        max-width: calc(100vw - 64px) !important;
        margin: 0 auto;
    }

    .perso-modal--cupcakes #cupcakes-preview-canvas {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 210 / 297;
    }
}

@media (max-width: 480px) {
    .perso-modal--cupcakes .perso-preview-viewport {
        width: min(220px, calc(100vw - 48px)) !important;
    }
}

/* Contours de gâteau — 3 bandes A3/A4 */
.perso-modal--contours .perso-paper-picker {
    grid-template-columns: repeat(2, 1fr);
}

.perso-modal--contours .perso-preview-panel {
    overflow: visible;
    align-items: center;
    justify-content: center;
    padding: 16px 12px 20px;
}

.perso-modal--contours .perso-preview-stage {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.perso-modal--contours .perso-preview-viewport {
    width: min(480px, 100%);
    height: auto !important;
    aspect-ratio: 297 / 210;
    max-width: 100%;
    max-height: none;
    flex-shrink: 0;
}

@media (min-width: 901px) {
    .perso-modal--contours .perso-preview-viewport {
        width: min(520px, 42vw);
    }
}

@media (min-width: 1200px) {
    .perso-modal--contours .perso-preview-viewport {
        width: min(560px, 38vw);
    }
}

.perso-modal--contours #contours-preview-canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 297 / 210;
    display: block;
    cursor: default;
    background: #fff;
    box-shadow: 0 8px 28px rgba(42, 26, 34, 0.12);
    object-fit: contain;
}

@media (max-width: 900px) {
    .perso-modal--contours .perso-preview-panel {
        position: relative !important;
        top: auto !important;
        overflow: visible;
        padding: 10px 12px 14px;
    }

    .perso-modal--contours .perso-preview-viewport {
        width: min(260px, calc(100vw - 64px)) !important;
        height: auto !important;
        max-width: calc(100vw - 64px) !important;
        margin: 0 auto;
    }

    .perso-modal--contours #contours-preview-canvas {
        width: 100% !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    .perso-modal--contours .perso-preview-viewport {
        width: min(220px, calc(100vw - 48px)) !important;
    }
}

.perso-image-mode-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.perso-image-mode-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    text-align: left;
    padding: 10px 12px;
    border: 2px solid rgba(229, 72, 138, 0.25);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.perso-image-mode-btn strong {
    font-size: 12px;
    color: #2a1a22;
}

.perso-image-mode-btn span {
    font-size: 11px;
    color: rgba(42, 26, 34, 0.65);
    line-height: 1.35;
}

.perso-image-mode-btn:hover {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.06);
}

.perso-image-mode-btn.is-active {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.1);
    box-shadow: 0 0 0 1px rgba(229, 72, 138, 0.2);
}

.perso-paper-btn,
.perso-shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border: 2px solid rgba(229, 72, 138, 0.25);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #444;
    transition: all 0.2s ease;
    text-align: center;
}

.perso-paper-btn:hover,
.perso-shape-btn:hover {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.06);
}

.perso-paper-btn.is-active,
.perso-shape-btn.is-active {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.14);
    color: #c23a72;
}

.perso-paper-btn__label {
    font-size: 13px;
    font-weight: 700;
}

.perso-paper-btn__size {
    font-size: 10px;
    font-weight: 500;
    color: #666;
    line-height: 1.3;
}

.perso-paper-info {
    margin: 0 0 10px;
    font-size: 11px;
    color: #666;
    line-height: 1.4;
}

.perso-shape-icon {
    display: block;
    width: 28px;
    height: 28px;
    border: 2px solid var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.12);
}

.perso-shape-icon--circle {
    border-radius: 50%;
}

.perso-shape-icon--square {
    border-radius: 4px;
}

.perso-shape-icon--heart {
    border: none;
    background: transparent;
    color: var(--couleur-dominante, #E5488A);
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.commande-perso-specs {
    margin: 6px 0 0;
    font-size: 12px;
    color: #555;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.commande-perso-specs i {
    color: var(--couleur-dominante, #E5488A);
    margin-top: 2px;
    flex-shrink: 0;
}

.commande-perso-specs--compact {
    font-size: 11px;
    margin-top: 4px;
}

.ckm-item__perso-specs {
    margin: 4px 0 0;
    font-size: 11px;
    color: #666;
}

.ckm-item__perso-specs i {
    color: var(--couleur-dominante, #E5488A);
    margin-right: 4px;
}

.perso-dimension-field:last-child {
    margin-bottom: 0;
}

.perso-dimension-field label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.perso-dimension-field input[type="range"] {
    width: 100%;
    accent-color: var(--couleur-dominante, #E5488A);
}

.perso-text-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(229, 72, 138, 0.3);
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
    resize: vertical;
    min-height: 72px;
    line-height: 1.45;
    font-family: inherit;
}

.perso-text-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.perso-text-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(229, 72, 138, 0.22);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.perso-text-item.is-active {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.1);
}

.perso-text-item-label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.perso-text-item-remove {
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 14px;
    line-height: 1;
}

.perso-text-item-remove:hover {
    color: #c26638;
}

.perso-text-add-btn {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px dashed rgba(229, 72, 138, 0.45);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--couleur-dominante, #E5488A);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.perso-text-add-btn:hover {
    background: rgba(229, 72, 138, 0.08);
}

.perso-text-input:focus {
    outline: none;
    border-color: var(--couleur-dominante, #E5488A);
    box-shadow: 0 0 0 3px rgba(229, 72, 138, 0.15);
}

.perso-text-controls {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(229, 72, 138, 0.22);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.perso-font-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    margin-top: 4px;
}

.perso-font-btn {
    padding: 8px 12px;
    border: 1px solid rgba(145, 138, 68, 0.25);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    font-size: 16px;
    text-align: left;
    transition: all 0.2s ease;
    color: #1a1a1a;
}

.perso-font-btn:hover {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.06);
}

.perso-font-btn.is-active {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.14);
    color: #c23a72;
}

.perso-color-field {
    margin-top: 4px;
    margin-bottom: 8px;
}

.perso-color-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.perso-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.perso-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.12);
    background: var(--swatch);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.perso-color-swatch:hover {
    transform: scale(1.08);
}

.perso-color-swatch.is-active {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--couleur-dominante, #E5488A);
    transform: scale(1.05);
}

.perso-color-custom {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px dashed rgba(229, 72, 138, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 12px;
    color: var(--couleur-dominante, #E5488A);
}

.perso-color-custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.perso-wrap-toggle {
    position: relative;
    margin-top: 8px;
}

.perso-wrap-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.perso-wrap-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(229, 72, 138, 0.28);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.perso-wrap-btn:hover:not(:disabled) {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.05);
}

.perso-wrap-btn.is-active {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.1);
}

.perso-wrap-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.perso-wrap-btn .perso-checkbox-box {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 2px solid var(--couleur-dominante, #E5488A);
    border-radius: 4px;
    background: #fff;
    position: relative;
}

.perso-wrap-btn.is-active .perso-checkbox-box {
    background: var(--couleur-dominante, #E5488A);
}

.perso-wrap-btn.is-active .perso-checkbox-box::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.perso-wrap-position {
    display: none;
    margin-top: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(229, 72, 138, 0.06);
    border: 1px solid rgba(229, 72, 138, 0.15);
}

.perso-text-controls.is-wrap-active .perso-wrap-position {
    display: block;
}

.perso-wrap-position-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--couleur-dominante, #E5488A);
    margin-bottom: 8px;
}

.perso-wrap-position-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.perso-wrap-pos-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border: 2px solid rgba(229, 72, 138, 0.25);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    transition: all 0.2s ease;
}

.perso-wrap-pos-btn:hover {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.06);
}

.perso-wrap-pos-btn.is-active {
    border-color: var(--couleur-dominante, #E5488A);
    background: rgba(229, 72, 138, 0.14);
    color: #c23a72;
}

.perso-checkbox-text {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    line-height: 1.4;
}

.perso-field-hint {
    margin: 4px 0 0;
    font-size: 11px;
    color: #888;
    line-height: 1.4;
}

.perso-text-controls.is-wrap-active .perso-dimension-field[data-hide-on-wrap="1"] {
    opacity: 0.45;
    pointer-events: none;
}

/* ——— Aperçu circulaire ——— */

.perso-preview-panel {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(229, 72, 138, 0.1) 0%, rgba(255, 240, 246, 0.95) 100%);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(229, 72, 138, 0.18);
}

.perso-preview-label {
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--couleur-dominante, #E5488A);
}

.perso-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.perso-preview-viewport {
    position: relative;
    width: min(400px, 100%);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    touch-action: none;
}

@media (min-width: 901px) {
    .perso-preview-viewport {
        width: min(480px, 44vw);
    }
}

@media (min-width: 1200px) {
    .perso-preview-viewport {
        width: min(520px, 42vw);
    }
}

#perso-preview-canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    touch-action: none;
    cursor: default;
}

.perso-preview-hint {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.45;
    color: #888;
    text-align: center;
    max-width: 420px;
}

.perso-text-manipulator {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.perso-text-manipulator.is-visible .perso-text-manip-box {
    pointer-events: auto;
}

.perso-text-manip-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px dashed rgba(229, 72, 138, 0.9);
    background: rgba(229, 72, 138, 0.06);
    cursor: move;
    touch-action: none;
    transform-origin: center center;
}

.perso-text-manip-box.is-dragging {
    cursor: grabbing;
}

.perso-text-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    background: #ffffff;
    border: 2px solid var(--couleur-dominante, #E5488A);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    touch-action: none;
    pointer-events: auto;
}

.perso-text-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.perso-text-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.perso-text-handle--sw { left: 0; top: 100%; cursor: nesw-resize; }
.perso-text-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }
.perso-text-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.perso-text-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.perso-text-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.perso-text-handle--w { left: 0; top: 50%; cursor: ew-resize; }

.perso-text-handle--rotate {
    left: 50%;
    top: 0;
    margin-top: -28px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    cursor: grab;
    background: var(--couleur-dominante, #E5488A);
    border-color: #ffffff;
}

.perso-text-handle--rotate::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    width: 2px;
    height: 14px;
    margin-left: -1px;
    background: rgba(229, 72, 138, 0.55);
}

.perso-text-manip-box.is-wrap-mode .perso-text-handle--nw,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--ne,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--sw,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--se,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--n,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--s,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--e,
.perso-text-manip-box.is-wrap-mode .perso-text-handle--w {
    display: none;
}

.perso-image-hint {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: #777;
}

.perso-image-reset-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    border: 1px dashed rgba(152, 138, 68, 0.55);
    border-radius: 10px;
    background: rgba(145, 138, 68, 0.08);
    color: #6b2f20;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.perso-image-reset-btn:hover {
    background: rgba(145, 138, 68, 0.16);
    border-color: #918a44;
}

.perso-image-manipulator {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.perso-image-manipulator.is-visible .perso-image-manip-box,
.perso-image-manipulator:not([hidden]) .perso-image-manip-box {
    pointer-events: auto;
}

.perso-image-manip-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px dashed rgba(145, 138, 68, 0.95);
    background: rgba(145, 138, 68, 0.08);
    cursor: move;
    touch-action: none;
}

.perso-image-manip-box.is-dragging {
    cursor: grabbing;
}

.perso-image-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    background: #ffffff;
    border: 2px solid #918a44;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    touch-action: none;
    pointer-events: auto;
}

.perso-image-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.perso-image-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.perso-image-handle--sw { left: 0; top: 100%; cursor: nesw-resize; }
.perso-image-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }

.perso-manip-delete {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 6;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #c26638;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    touch-action: manipulation;
    pointer-events: auto;
}

.perso-manip-delete:hover {
    background: #6b2f20;
}

/* ——— Actions ——— */

.perso-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
    flex-shrink: 0;
}

.perso-btn {
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.perso-btn-secondary {
    background: #f2f2f2;
    color: #444;
}

.perso-btn-secondary:hover {
    background: #e8e8e8;
}

.perso-btn-primary {
    background: var(--couleur-dominante, #E5488A);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(229, 72, 138, 0.35);
}

.perso-btn-primary:hover:not(:disabled) {
    background: #c23a72;
}

.perso-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.perso-loading {
    display: none;
    font-size: 13px;
    color: #666;
    text-align: center;
    margin: 8px 0 0;
}

.perso-loading.is-visible {
    display: block;
}

/* ——— Responsive ——— */

@media (max-width: 1024px) {
    .perso-modal-dialog {
        width: min(800px, calc(100vw - 24px));
    }

    .perso-toolbar {
        flex: 0 0 260px;
        width: 260px;
    }

    .perso-preview-viewport {
        width: min(360px, calc(100vw - 64px));
    }
}

@media (max-width: 1024px) and (min-width: 901px) {
    .perso-preview-viewport {
        width: min(400px, 100%);
    }
}

@media (max-width: 900px) {
    .perso-modal-layout {
        flex: 1 1 auto;
        min-height: 0;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .perso-preview-panel {
        order: -1;
        position: sticky;
        top: 0;
        z-index: 3;
        flex-shrink: 0;
        padding: 12px 16px;
        min-height: auto;
        background: linear-gradient(180deg, #fff5f9 0%, #ffffff 85%);
        border-bottom: 1px solid rgba(229, 72, 138, 0.12);
    }

    .perso-preview-label {
        margin-bottom: 10px;
    }

    .perso-preview-viewport {
        width: min(380px, calc(100vw - 40px));
        margin: 0 auto;
    }

    .perso-toolbar {
        flex: none;
        width: 100%;
        max-height: none;
        padding-right: 0;
        order: 1;
    }
}

@media (max-width: 768px) {
    .produit-actions-row {
        flex-direction: column;
    }

    .btn-personnaliser {
        width: 100%;
    }

    .perso-modal {
        padding: 10px;
    }

    .perso-modal-dialog {
        width: calc(100vw - 20px);
        max-width: 100%;
        max-height: calc(100vh - 20px);
        padding: 16px 14px 14px;
        border-radius: 16px;
    }

    .perso-modal-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .perso-preview-viewport {
        width: min(340px, calc(100vw - 32px));
        max-height: min(340px, calc(100vw - 32px));
    }

    .perso-modal--cupcakes .perso-preview-viewport {
        width: min(240px, calc(100vw - 48px)) !important;
        max-height: none !important;
        height: auto !important;
        aspect-ratio: 210 / 297;
    }

    .perso-modal--cupcakes #cupcakes-preview-canvas {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        aspect-ratio: 210 / 297;
    }

    .perso-preview-panel {
        padding: 8px 10px;
    }

    .perso-preview-label {
        margin-bottom: 6px;
        font-size: 11px;
    }

    .perso-font-picker {
        max-height: 140px;
    }

    .perso-modal-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        margin-top: 12px;
    }

    .perso-btn {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        padding: 9px 10px;
        font-size: 12px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 480px) {
    .perso-modal-dialog {
        width: calc(100vw - 16px);
    }

    .perso-modal-actions {
        gap: 6px;
    }

    .perso-btn {
        padding: 8px 8px;
        font-size: 11px;
    }

    .perso-preview-viewport {
        width: min(320px, calc(100vw - 24px));
        max-height: min(320px, calc(100vw - 24px));
    }

    .perso-modal--cupcakes .perso-preview-viewport {
        width: min(200px, calc(100vw - 40px)) !important;
        max-height: none !important;
        height: auto !important;
        aspect-ratio: 210 / 297;
    }

    .perso-shape-picker {
        gap: 6px;
    }

    .perso-shape-btn {
        padding: 8px 4px;
        font-size: 10px;
    }
}

/* Aperçu personnalisation — commandes (admin / client) */

.commande-perso-preview {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(229, 72, 138, 0.25);
    border-radius: 12px;
    background: rgba(229, 72, 138, 0.04);
}

.commande-perso-preview--compact {
    margin-top: 8px;
    padding: 8px;
}

.commande-perso-preview__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.commande-perso-preview__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--couleur-dominante, #E5488A);
}

.commande-perso-preview__download {
    font-size: 12px;
    font-weight: 600;
    color: #6b2f20;
    text-decoration: none;
}

.commande-perso-preview__download:hover {
    text-decoration: underline;
}

.commande-perso-preview__link {
    display: block;
    width: fit-content;
    max-width: 100%;
}

.commande-perso-preview__img {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(229, 72, 138, 0.35);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.commande-perso-preview--compact .commande-perso-preview__img {
    width: 88px;
    height: 88px;
}

.produit-card-commande .commande-perso-preview {
    grid-column: 1 / -1;
}

.admin .commande-perso-preview__img {
    width: 140px;
    height: 140px;
}
