/* ── MyPhotobooth · devis.php — Base CSS (indépendant du thème) ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    overflow-x: hidden;
    width: 100%;
    /* Évite la scrollbar due aux vw vs % */
    scrollbar-gutter: stable both-edges;
}
img, video, svg, canvas, iframe { max-width: 100%; height: auto; }
input, select, textarea, button { max-width: 100%; }


body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', system-ui, sans-serif;
    min-height: 100vh;
    padding: 0;
    min-height: 100vh;
}
body::before {
    content: '';
    position: fixed; inset: 0;
    background: var(--body-gradient, none);
    pointer-events: none;
}

/* ── Layout ── */
.wrap {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 16px 80px; /* 16px au lieu de 20px sur mobile */
    box-sizing: border-box;
    overflow-x: hidden;
}
.page-eyebrow {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 11px; font-weight: 600; letter-spacing: .18em;
    text-transform: uppercase; color: var(--gold); margin-bottom: 18px;
}
.page-eyebrow::before {
    content: ''; flex: none; width: 24px; height: 1px;
    background: var(--gold-brd);
}
h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(26px, 5vw, 40px);
    font-weight: 700; color: var(--text);
    letter-spacing: -.02em; line-height: 1.15; margin-bottom: 10px;
    text-align: center;
}
.page-desc { font-size: 15px; color: var(--muted); line-height: 1.6; margin-bottom: 36px; text-align: center; }

/* ── Form card ── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 32px; }
.form-section-title {
    font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--gold);
    margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--gold-brd);
}
.form-section-title:first-child { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }

/* ── Inputs ── */
label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
label .req { color: var(--gold); margin-left: 2px; }
input, select, textarea {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 11px 14px; font-size: 14px;
    font-family: inherit; color: var(--text); outline: none;
    transition: border-color .15s; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-lt); }
select option { background: var(--surface2); color: var(--text); }
textarea { resize: vertical; min-height: 100px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ── Distance ── */
.distance-wrap { position: relative; }
.distance-spinner { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); }
.distance-result { margin-top: 5px; font-size: 12.5px; color: var(--muted); min-height: 16px; }
.distance-result.ok  { color: var(--success); }
.distance-result.err { color: var(--error); }

/* ── Templates ── */
.templates-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.template-opt { position: relative; cursor: pointer; }
.template-opt input[type=radio] { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; overflow: hidden; margin: 0; padding: 0; border: 0; }
.template-card {
    border: 2px solid var(--border); border-radius: 9px; overflow: hidden;
    transition: border-color .15s, transform .1s; background: var(--surface2);
}
.template-card img { width: 100%; max-width: 100%; display: block; aspect-ratio: 3/2; object-fit: cover; }
.template-label { padding: 6px 8px; font-size: 11.5px; font-weight: 600; color: var(--text); text-align: center; border-top: 1px solid var(--border); }
.template-opt input:checked ~ .template-card { border-color: var(--gold); }
.template-opt input:checked ~ .template-card .template-label { color: var(--gold); }
.template-opt:hover .template-card { border-color: var(--gold-brd); transform: translateY(-2px); }
.btn-voir-plus {
    background: transparent; border: 1px solid var(--gold-brd); color: var(--gold);
    border-radius: 8px; padding: 8px 20px; font-size: 13px; cursor: pointer;
    margin-top: 16px; transition: background .15s;
}
.btn-voir-plus:hover { background: var(--gold-lt); }

/* ── Modale template ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.80);
    z-index: 1000; display: none; align-items: center; justify-content: center;
    padding: 24px; backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; max-width: 860px; width: 100%;
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1fr 340px;
    max-height: 88vh; margin: 0; /* centré par le flex parent */
}
.modal-photo-col {
    display: flex; align-items: center; justify-content: center;
    background: var(--modal-photo-bg, #111); padding: 36px; min-height: 320px;
}
.modal-frame { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.modal-photo-bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; }
.modal-img {
    position: relative; z-index: 2; display: block;
    max-width: 380px; max-height: 46vh; width: auto; height: auto;
    border-radius: 4px; box-shadow: 0 8px 32px rgba(0,0,0,.7);
}
.modal-content { padding: 32px 26px; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.modal-close {
    position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.55);
    border: none; color: #fff; cursor: pointer; font-size: 16px; z-index: 20;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.modal-close:hover { background: rgba(0,0,0,.85); }
.modal-name { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 10px; line-height: 1.2; }
.modal-desc { font-size: 14px; color: var(--muted); line-height: 1.6; flex: 1; }
.modal-select {
    margin-top: 22px; width: 100%; background: var(--gold); color: #fff;
    font-weight: 700; border: none; padding: 13px; border-radius: 10px;
    cursor: pointer; font-size: 15px; transition: opacity .15s;
}
.modal-select:hover { opacity: .88; }

/* ── Radio formule ── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-opt { display: block; cursor: pointer; }
.radio-opt input[type=radio] { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; overflow: hidden; margin: 0; padding: 0; border: 0; }
.radio-box {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    border: 1.5px solid var(--border); border-radius: 9px; background: var(--surface2); transition: border-color .15s;
}
.radio-box-icon {
    flex: none; width: 36px; height: 36px; border-radius: 8px;
    background: var(--radio-icon-bg, rgba(255,255,255,.05));
    display: flex; align-items: center; justify-content: center;
}
.radio-box-icon svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.radio-box-text { flex: 1; }
.radio-box-text strong { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.radio-box-text span { font-size: 12.5px; color: var(--muted); }
.radio-box-price { font-size: 18px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.radio-opt input:checked ~ .radio-box { border-color: var(--gold); background: var(--gold-lt); }
.radio-opt input:checked ~ .radio-box .radio-box-icon { background: var(--gold-lt); }
.radio-opt input:checked ~ .radio-box .radio-box-icon svg { stroke: var(--gold); }
.radio-opt:hover .radio-box { border-color: var(--gold-brd); }

/* ── Récap prix ── */
.price-summary { margin-top: 16px; background: var(--gold-lt); border: 1px solid var(--gold-brd); border-radius: 9px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.price-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
.price-row strong { color: var(--text); }
.price-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px solid var(--gold-brd); margin-top: 4px; }
.price-total-label { font-size: 14px; font-weight: 600; color: var(--text); }
.price-total-val { font-size: 22px; font-weight: 700; color: var(--gold); }
.price-note { font-size: 11.5px; color: var(--muted); font-style: italic; }

/* ── Submit ── */
.form-footer { margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.btn-submit {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--gold); color: #fff; font-size: 14px; font-weight: 700;
    padding: 13px 28px; border: none; border-radius: 8px; cursor: pointer; transition: opacity .15s;
}
.btn-submit:hover { opacity: .9; }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; }
.form-status { font-size: 13.5px; display: none; }
.form-status.ok  { display: block; color: var(--success); }
.form-status.err { display: block; color: var(--error); }

/* ── Succès ── */
.success-state { display: none; text-align: center; padding: 48px 24px; }
.success-state.show { display: block; }
.form-card.hidden { display: none; }
.success-icon {
    width: 64px; height: 64px; margin: 0 auto 20px;
    background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.25);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.success-icon svg { width: 28px; height: 28px; stroke: var(--success); fill: none; stroke-width: 2.5; }
.success-title { font-family: 'Playfair Display', serif; font-size: 26px; color: var(--text); margin-bottom: 10px; }
.success-text  { font-size: 15px; color: var(--muted); line-height: 1.6; }
.success-ref   { margin-top: 20px; display: inline-block; font-size: 12px; font-family: monospace; background: var(--surface2); padding: 6px 12px; border-radius: 6px; color: var(--gold); }

/* ── Responsive ── */
@media (max-width: 640px) {
    /* Bottom sheet */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-box {
        grid-template-columns: 1fr;
        border-radius: 20px 20px 0 0;
        max-height: 94vh;
        width: 100%;        /* pleine largeur en bottom sheet */
        max-width: 100%;
        overflow: hidden;
        margin: 0;          /* colle au bas de l'écran */
    }
    .modal-photo-col {
        padding: 20px;
        min-height: 0;
        justify-content: center;
        align-items: center;
    }
    /*
     * Principe : .modal-frame est inline-flex sans dimensions définies.
     * .modal-img (relative) pilote la taille du frame.
     * .modal-photo-bg-img (absolute inset:0) = exactement même taille.
     * On contraint .modal-frame à une largeur fixe = hauteur fixe via aspect-ratio.
     */
    .modal-photo-col {
        padding: 16px;
        background: var(--modal-photo-bg, #111);
        display: flex;
        justify-content: center;
        align-items: center;
    }
    /* Frame = taille fixe, petite, centrée */
    .modal-frame {
        width: calc(95vw - 32px); /* 98% de la modal (95vw), moins padding */
        max-width: 100%;
        aspect-ratio: 3 / 2;
        position: relative;
        flex-shrink: 0;
    }
    /* Photo : remplit exactement le frame */
    .modal-photo-bg-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 5px;
        display: block;
    }
    /* Template : par-dessus, même boîte */
    .modal-img {
        position: absolute;
        inset: 0;
        z-index: 2;
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 4px;
        box-shadow: 0 4px 16px rgba(0,0,0,.6);
    }
    .modal-content { padding: 16px 20px 24px; overflow-y: auto; max-height: 48vh; }
    .modal-name { font-size: 17px; }
}

@media (max-width: 480px) {
    .wrap { padding-left: 12px; padding-right: 12px; }
    .form-card { padding: 14px; }
}
@media (max-width: 580px) {
    .form-card { padding: 16px; }
    .form-row  { grid-template-columns: 1fr; }
    .templates-grid { grid-template-columns: 1fr; }
}
