/* ===== Site mariage — styles mobile-first ===== */

:root {
    --bg: #2b2118;
    --bg-soft: #3a2d20;
    --card: #fffdf8;
    --ink: #2b2118;
    --gold: #c9a24b;
    --gold-dark: #a8842f;
    --rose: #d98c8c;
    --green: #4caf7d;
    --red: #d9534f;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

/* L'attribut HTML `hidden` doit toujours l'emporter, même sur les éléments
   stylés en display:flex/inline-block (sinon overlay & boutons restent visibles). */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Boutons génériques ---------- */
.btn {
    display: inline-block;
    border: none;
    border-radius: 999px;
    padding: 15px 28px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--gold); color: #fff; }
.btn--primary:hover { background: var(--gold-dark); }
.btn--send { background: var(--green); color: #fff; }

.alert {
    border-radius: 12px;
    padding: 11px 14px;
    margin: 10px 0;
    font-size: .95rem;
}
.alert--error { background: #fdecea; color: #a4221c; }
.alert--success { background: #e7f6ee; color: #1c7a4d; }

/* ===================== ACCUEIL ===================== */
.welcome {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 500px at 50% -10%, #4a3826 0%, transparent 70%),
        var(--bg);
}
.welcome__card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 26px 26px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.welcome__mark { color: var(--gold); display: inline-block; }
.welcome__card h1 {
    margin: 10px 0 4px;
    font-size: 1.7rem;
    font-weight: 600;
    letter-spacing: .3px;
}
.welcome__lead { color: #5b4d3e; line-height: 1.5; font-size: 1rem; }
.welcome__form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; text-align: left; }
.welcome__form label { font-weight: 600; font-size: .9rem; }
.welcome__form input {
    border: 2px solid #e6dcc8;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1.05rem;
    outline: none;
}
.welcome__form input:focus { border-color: var(--gold); }
.welcome__hint { color: #9b8d79; font-size: .8rem; margin-top: 14px; }

/* ===================== APPAREIL PHOTO ===================== */
.screen-camera { background: #000; }
.camera {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    color: #fff;
}
.camera__topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(env(safe-area-inset-top) + 12px) 18px 12px;
    font-size: .95rem;
    background: linear-gradient(#000a, transparent);
    z-index: 5;
}
.camera__counter {
    background: #ffffff22;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}
.camera__counter.pulse { animation: pulse .5s ease; }
@keyframes pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); background: var(--green); }
    100% { transform: scale(1); }
}

.camera__stage {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.camera__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera__notice {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    color: #eee;
    background: var(--bg-soft);
    line-height: 1.5;
}

.camera__overlay {
    position: absolute;
    inset: 0;
    background: #000b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
}
.spinner {
    width: 52px;
    height: 52px;
    border: 5px solid #ffffff33;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.camera__success {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: var(--green);
    background: #000a;
    z-index: 11;
    opacity: 0;
}
.camera__success.show { animation: pop .9s ease; }
@keyframes pop {
    0% { opacity: 0; transform: scale(.4); }
    30% { opacity: 1; transform: scale(1.1); }
    70% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1); }
}

/* Tiroir des photos en attente */
.camera__tray {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    background: #000a;
}
.tray__item {
    position: relative;
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
}
.tray__item img { width: 100%; height: 100%; object-fit: cover; }
.tray__del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: #000c;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

/* Barre de contrôles */
.camera__controls {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 16px 24px calc(env(safe-area-inset-bottom) + 16px);
    background: linear-gradient(transparent, #000a);
}
.ctrl {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #fff;
}
.ctrl--icon {
    width: 54px;
    height: 54px;
    font-size: 1.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ffffff22;
}
.ctrl--shutter {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    box-shadow: 0 0 0 4px #ffffff55;
}
.ctrl--shutter .ctrl__ring {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 3px solid #000;
}
.ctrl--shutter.flash { background: var(--gold); }
.ctrl--shutter-fallback { background: var(--gold); }
.ctrl--shutter-fallback .ctrl__ring { border-color: #fff; }

.btn--send {
    margin: 0 18px calc(env(safe-area-inset-bottom) + 16px);
}
.camera__flashmsg {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 120px);
    transform: translateX(-50%);
    background: #000c;
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: .9rem;
    z-index: 20;
    max-width: 90%;
    text-align: center;
}

/* ===================== ADMIN ===================== */
.screen-admin { background: #f4efe6; }
.admin {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 18px 60px;
    color: var(--ink);
}
.admin__header h1 { margin: 0 0 4px; }
.admin__total { color: #7a6c58; margin: 0 0 18px; }
.admin__export {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.admin__exportstatus { flex: 1; min-width: 220px; }
.admin__exportstatus p { margin: 4px 0; }
.admin__hint { color: #9b8d79; font-size: .9rem; }

.admin__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.thumb {
    margin: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,.07);
}
.thumb img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
}
.thumb figcaption {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.thumb__guest { font-weight: 600; font-size: .85rem; }
.thumb__date { color: #9b8d79; font-size: .75rem; }
.admin__empty, .admin__grid > p { color: #9b8d79; grid-column: 1 / -1; }

/* Pagination */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
}
.pager__btn {
    text-decoration: none;
    color: var(--ink);
    background: #fff;
    border: 1px solid #e6dcc8;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.pager__btn--off { color: #c3b8a4; background: #f3eee4; box-shadow: none; cursor: default; }
.pager__pages { display: flex; align-items: center; gap: 4px; }
.pager__num {
    text-decoration: none;
    color: var(--ink);
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 10px;
    font-size: .9rem;
}
.pager__num:hover { background: #efe7d8; }
.pager__num--current { background: var(--gold); color: #fff; font-weight: 700; }
.pager__gap { color: #9b8d79; padding: 0 2px; }
