/* ═══════════════════════════════════════════════════════════════
   ENVELOPE PREVIEW — Card Studio
═══════════════════════════════════════════════════════════════ */
.fp-envelope-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    padding: 20px;
}
.fp-env-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.fp-env-wrapper {
    position: relative;
    width: 360px;
    height: 260px;
    filter: drop-shadow(0 8px 24px rgba(58, 42, 28, 0.18)) drop-shadow(0 2px 6px rgba(58, 42, 28, 0.1));
    perspective: 800px;
    cursor: pointer;
}
.fp-env-body {
    position: relative;
    width: 100%;
    height: 100%;
    background: #f9d8cc;
    border-radius: 4px 4px 6px 6px;
    overflow: visible;
}
/* Left V-shape */
.fp-env-left-v {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 130px 0 0 180px;
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.06);
}
/* Right V-shape */
.fp-env-right-v {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 130px 180px 0 0;
    border-color: transparent rgba(0, 0, 0, 0.06) transparent transparent;
}
/* Bottom V-shape (center fold line) */
.fp-env-bottom-v {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 130px;
    background: rgba(0, 0, 0, 0.04);
    clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}
/* Top flap */
.fp-env-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 130px;
    background: #edab94;
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
    display: flex;
    align-items: 30%;
    justify-content: center;
    transform-origin: top center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}
.fp-env-flap.open {
    transform: rotateX(180deg);
}
.fp-env-monogram {
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Cormorant Garamond", serif;
    font-size: 1.2rem;
    letter-spacing: 0.12em;
    color: rgba(80, 40, 20, 0.75);
    white-space: nowrap;
    pointer-events: none;
}
.fp-env-hint {
    font-family: "Cormorant Garamond", serif;
    font-size: 0.78rem;
    color: rgba(58, 42, 28, 0.45);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.4s ease;
    margin-top: 8px;
}
.fp-env-preview-btn {
    font-size: 0.78rem;
    padding: 7px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.fp-env-share-btn {
    font-size: 0.78rem;
}
/* Envelope settings swatches */
.fp-env-color-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 6px;
}
.fp-env-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition:
        transform 0.15s,
        border-color 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.fp-env-swatch:hover {
    transform: scale(1.1);
}
.fp-env-swatch.active {
    border-color: var(--brown);
    transform: scale(1.15);
}
.fp-env-custom-color {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1.5px dashed rgba(58, 42, 28, 0.3);
    color: rgba(58, 42, 28, 0.5);
    position: relative;
    overflow: visible;
}
.fp-env-custom-color input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    /* Keep element in DOM at correct position so OS picker opens near the button */
}

/* ══════════════════════════════════════
   CARD STUDIO — ENVELOPE TAB
══════════════════════════════════════ */

/* Live badge (green dot + label) shown above envelope preview */
.fp-env-live-badge,
.fp-envoi-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(58, 42, 28, 0.5);
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 20px;
    padding: 3px 10px 3px 6px;
    margin-bottom: 10px;
}

/* Envelope tab: flex column containing badge + scene */
.fp-envelope-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto;
    padding: 24px 20px 16px;
    gap: 0;
}

/* Wrapper for envelope + rising card (overflow visible to allow card rise) */
.fp-env-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
}

/* Card that slides up out of the envelope */
.fp-env-card-inside {
    width: 200px;
    height: 80px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(58, 42, 28, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(40px);
    transition:
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.4s ease;
    z-index: 1;
    position: relative;
    margin-bottom: -12px; /* sits just above envelope edge */
    pointer-events: none;
}
.fp-env-card-inside.rising {
    opacity: 1;
    transform: translateY(-72px);
    z-index: 15;
}
.fp-env-card-inner {
    text-align: center;
    padding: 10px 16px;
}
.fp-env-card-names {
    font-family: "Cormorant Garamond", serif;
    font-size: 0.9rem;
    color: var(--brown);
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.fp-env-card-line {
    width: 40px;
    height: 1px;
    background: var(--terra-ll);
    margin: 0 auto 4px;
}
.fp-env-card-date {
    font-size: 0.6rem;
    color: var(--txt-l);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ══════════════════════════════════════
   CARD STUDIO — ENVOI (SEND) TAB
══════════════════════════════════════ */

/* ── Envoi: sizing tokens (override per breakpoint) ── */
:root {
    --envoi-card-scale: 0.9;
    --envoi-card-w: 306px; /* 340 × 0.9 */
    --envoi-card-h: 432px; /* 480 × 0.9 */
    --envoi-env-w: 400px;
    --envoi-env-h: 280px;
    --envoi-stage-w: 440px;
    --envoi-stage-h: 580px;
    --envoi-scene-bottom: 70px;
    --envoi-scene-hidden: 220px; /* initial translateY to hide card in envelope */
}
@media (max-width: 960px) {
    :root {
        --envoi-card-scale: 0.78;
        --envoi-card-w: 265px;
        --envoi-card-h: 374px;
        --envoi-env-w: 330px;
        --envoi-env-h: 232px;
        --envoi-stage-w: 360px;
        --envoi-stage-h: 490px;
        --envoi-scene-bottom: 60px;
        --envoi-scene-hidden: 180px;
    }
}
@media (max-width: 700px) {
    :root {
        --envoi-card-scale: 0.62;
        --envoi-card-w: 211px;
        --envoi-card-h: 298px;
        --envoi-env-w: 260px;
        --envoi-env-h: 183px;
        --envoi-stage-w: 290px;
        --envoi-stage-h: 390px;
        --envoi-scene-bottom: 48px;
        --envoi-scene-hidden: 145px;
    }
}

/* Outer container */
.fp-envoi-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 16px 0 28px;
    gap: 12px;
    margin: auto;
}

/* ── Stage ── */
.fp-envoi-stage {
    position: relative;
    width: var(--envoi-stage-w);
    height: var(--envoi-stage-h);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* ── Envelope body ── */
.fp-envoi-envelope {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--envoi-env-w);
    height: var(--envoi-env-h);
    background: #f9d8cc;
    border-radius: 4px 4px 8px 8px;
    z-index: 10;
    filter: drop-shadow(0 10px 30px rgba(58, 42, 28, 0.22));
    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
    cursor: pointer;
}
.fp-envoi-envelope.done {
    opacity: 0;
    transform: translateX(-50%) translateY(28px) scale(0.94);
    pointer-events: none;
}
@keyframes envWiggle {
    0%,
    100% {
        transform: translateX(-50%) rotate(0deg) translateY(0);
    }
    18% {
        transform: translateX(-50%) rotate(-2deg) translateY(-4px);
    }
    36% {
        transform: translateX(-50%) rotate(2deg) translateY(-6px);
    }
    54% {
        transform: translateX(-50%) rotate(-1.2deg) translateY(-3px);
    }
    72% {
        transform: translateX(-50%) rotate(1.5deg) translateY(-5px);
    }
    90% {
        transform: translateX(-50%) rotate(-0.8deg) translateY(-2px);
    }
}
.fp-envoi-envelope.wiggle {
    animation: envWiggle 2s ease-in-out infinite;
}

/* Fold shapes — sized relative to envelope */
.fp-envoi-env-left-v {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(var(--envoi-env-h) * 0.5) 0 0 calc(var(--envoi-env-w) * 0.5);
    border-color: transparent transparent transparent rgba(0, 0, 0, 0.06);
}
.fp-envoi-env-right-v {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(var(--envoi-env-h) * 0.5) calc(var(--envoi-env-w) * 0.5) 0 0;
    border-color: transparent rgba(0, 0, 0, 0.06) transparent transparent;
}
.fp-envoi-env-bottom-v {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--envoi-env-h) * 0.5);
    background: rgba(0, 0, 0, 0.04);
    clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}
/* Flap */
.fp-envoi-env-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--envoi-env-h) * 0.52);
    background: #edab94;
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
    transform-origin: top center;
    transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    perspective: 800px;
}
.fp-envoi-env-flap.open {
    transform: rotateX(180deg);
}
.fp-envoi-env-mono {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(0.85rem, 1.1vw, 1.2rem);
    letter-spacing: 0.12em;
    color: rgba(80, 40, 20, 0.7);
    white-space: nowrap;
    pointer-events: none;
}

/* Hint text */
.fp-envoi-hint {
    font-family: "Cormorant Garamond", serif;
    font-size: 0.82rem;
    color: rgba(58, 42, 28, 0.45);
    letter-spacing: 0.06em;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.fp-envoi-hint.visible {
    opacity: 1;
}

/* ── Card scene ── */
.fp-envoi-card-scene {
    position: absolute;
    bottom: var(--envoi-scene-bottom);
    left: 50%;
    transform: translateX(-50%) translateY(var(--envoi-scene-hidden));
    opacity: 0;
    z-index: 5;
    transition:
        transform 0.78s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.55s ease;
}
.fp-envoi-card-scene.risen {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    z-index: 20;
}

/* 3D flipper */
.fp-envoi-card-flipper {
    width: var(--envoi-card-w);
    height: var(--envoi-card-h);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
    perspective: 1400px;
}
.fp-envoi-card-flipper.flipped {
    transform: rotateY(180deg);
}

.fp-envoi-card-face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 4px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow:
        0 16px 50px rgba(58, 42, 28, 0.3),
        0 4px 14px rgba(58, 42, 28, 0.14);
}
.fp-envoi-face-back {
    transform: rotateY(180deg);
}

/* Cloned card: scaled to match flipper dimensions */
.fp-envoi-card-face .qr-invitation-card {
    transform-origin: top left !important;
    transform: scale(var(--envoi-card-scale)) !important;
    width: 340px !important;
    min-height: 480px !important;
    zoom: unset !important;
    box-shadow: none !important;
    animation: none !important;
    transition: none !important;
    pointer-events: none !important;
}

/* Flip button */
.fp-envoi-flip-btn {
    position: absolute;
    bottom: -42px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--brown);
    color: var(--cream);
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 0.74rem;
    font-family: inherit;
    letter-spacing: 0.06em;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.4s ease,
        background 0.15s;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(44, 32, 22, 0.22);
}
.fp-envoi-flip-btn:hover {
    background: var(--brown-l);
}
.fp-envoi-flip-btn.visible {
    opacity: 1;
}

/* Envoi 4th tab button — subtle send icon tint */
.fp-envoi-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.fp-envoi-tab svg {
    opacity: 0.75;
    flex-shrink: 0;
}

/* ══════════════════════════════════════
   CARD STUDIO — ENVOI RIGHT PANEL
══════════════════════════════════════ */

/* Green success banner at top of envoi settings */
.fp-env-success-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.22);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.fp-env-success-banner svg {
    flex-shrink: 0;
    color: #16a34a;
    margin-top: 1px;
}
.fp-env-success-banner strong {
    display: block;
    font-size: 0.82rem;
    color: var(--brown);
    margin-bottom: 2px;
}
.fp-env-success-banner span {
    font-size: 0.72rem;
    color: var(--txt-m);
    opacity: 0.7;
}

/* Share buttons block */
.fp-env-share-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

/* Individual share button base */
.fp-env-share-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 8px;
    transition:
        transform 0.15s,
        box-shadow 0.15s,
        opacity 0.15s;
    border: none;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.fp-env-share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(58, 42, 28, 0.15);
}
.fp-env-share-btn:active {
    transform: translateY(0);
}

/* WhatsApp — green */
.fp-env-share-whatsapp {
    background: #25d366;
    color: #fff;
}
.fp-env-share-whatsapp:hover {
    background: #1ebe5d;
}

/* Email — terra brand */
.fp-env-share-email {
    background: var(--terra);
    color: #fff;
}
.fp-env-share-email:hover {
    background: var(--terra-l);
}

/* Copy — outlined */
.fp-env-share-copy {
    background: transparent;
    color: var(--brown);
    border: 1.5px solid rgba(58, 42, 28, 0.2);
}
.fp-env-share-copy:hover {
    background: rgba(58, 42, 28, 0.04);
    border-color: rgba(58, 42, 28, 0.4);
}

/* "Ouvrir dans un nouvel onglet" link */
.fp-env-open-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--txt-l);
    text-decoration: none;
    border-bottom: 1px solid rgba(58, 42, 28, 0.15);
    padding-bottom: 1px;
    transition:
        color 0.15s,
        border-color 0.15s;
}
.fp-env-open-link:hover {
    color: var(--terra);
    border-color: var(--terra);
}

