/* ============================================================
   POP'N'TOP v4 — Design system mobile-first (sans Bootstrap)
   Utilisé par : index.html, connexion.html (puis create.html…)
   ============================================================ */

:root {
    --v4-ink:      #00003C;   /* bleu marine — texte, boutons principaux */
    --v4-gold:     #8C713B;   /* brun doré — accents, rangs */
    --v4-gold-soft:#FBF1E2;   /* fond des pastilles d'icônes */
    --v4-ground:   #FFF8F0;   /* fond de page */
    --v4-surface:  #FFFFFF;
    --v4-line:     #EEE3D3;
    --v4-muted:    #5E5B70;   /* texte secondaire (contraste AA) */
    --v4-ok:       #2E6B4A;
    --v4-danger:   #B3261E;
    --v4-radius-s: 14px;
    --v4-radius-m: 20px;
    --v4-radius-l: 28px;
    --v4-tabbar-h: 76px;
    --v4-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body.v4 {
    margin: 0;
    font-family: var(--v4-font);
    background: var(--v4-ground);
    color: var(--v4-ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.5;
}
.v4 img { max-width: 100%; }
.v4 a { color: inherit; }
.v4 button { font: inherit; color: inherit; cursor: pointer; }
.v4 :focus-visible { outline: 3px solid var(--v4-gold); outline-offset: 2px; border-radius: 8px; }

.v4-icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none;
           stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.v4-sr { position: absolute !important; top: 0; left: 0; width: 1px; height: 1px; margin: -1px; padding: 0;
         overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
/* filet de sécurité : jamais de défilement horizontal de la page */
html, body.v4 { overflow-x: clip; }
/* [hidden] l'emporte toujours sur les display:flex/grid des composants */
.v4 [hidden] { display: none !important; }
/* Exposants (1re, 2e…) sans décaler la ligne */
.v4 sup { font-size: .62em; line-height: 0; position: relative; top: -.5em; vertical-align: baseline; margin-left: .02em; }

.v4-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ── En-tête ─────────────────────────────────────────────── */
.v4-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255, 248, 240, .94);
    backdrop-filter: saturate(1.4) blur(8px);
    -webkit-backdrop-filter: saturate(1.4) blur(8px);
}
.v4-header__inner { display: flex; align-items: center; justify-content: space-between;
                    gap: 12px; min-height: 64px; }
.v4-header__logo img { height: 30px; width: auto; display: block; }
.v4-header__nav { display: none; align-items: center; gap: 4px; }
.v4-header__nav a { text-decoration: none; font-weight: 500; font-size: 15px;
                    padding: 10px 14px; border-radius: 999px; }
.v4-header__nav a:hover { background: var(--v4-gold-soft); }
.v4 .v4-header__nav a.v4-btn--primary:hover { background: #12125a; }
.v4-header__nav a[aria-current="page"] { font-weight: 700; }

.v4-chip-btn {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 16px; border-radius: 999px;
    background: var(--v4-surface); border: 1px solid var(--v4-line);
    text-decoration: none; font-size: 14px; font-weight: 600;
}
.v4-chip-btn .v4-icon { width: 18px; height: 18px; }
.v4-avatar { width: 32px; height: 32px; border-radius: 999px; object-fit: cover;
             background: var(--v4-gold-soft); }

/* ── Boutons ─────────────────────────────────────────────── */
.v4-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 56px; padding: 0 24px; border-radius: var(--v4-radius-m);
    border: 0; text-decoration: none; font-size: 17px; font-weight: 700;
    transition: transform .15s ease, background-color .15s ease;
}
.v4-btn:active { transform: scale(.98); }
/* préfixe .v4 : doit l'emporter sur ".v4 a / .v4 button { color: inherit }" */
.v4 .v4-btn--primary, .v4 .v4-btn--primary:hover, .v4 .v4-btn--primary:visited { color: #fff; }
.v4 .v4-btn--primary { background: var(--v4-ink); }
.v4 .v4-btn--primary:hover { background: #12125a; }
.v4 .v4-btn--gold, .v4 .v4-btn--gold:hover, .v4 .v4-btn--gold:visited { color: #fff; }
.v4 .v4-btn--gold { background: var(--v4-gold); }
.v4 .v4-btn--gold:hover { background: #7a6231; }
.v4 .v4-btn--ghost { background: var(--v4-surface); color: var(--v4-ink); border: 1.5px solid var(--v4-line); }
.v4-btn--block { display: flex; width: 100%; }
.v4-btn--xl { min-height: 64px; font-size: 18px; }
.v4 .v4-btn[disabled] { background: #E8DCCB; color: #6E6B80; cursor: not-allowed; }

/* ── Sections ────────────────────────────────────────────── */
.v4-section { padding: 32px 0 8px; }
.v4-section__head { display: flex; align-items: center; justify-content: space-between;
                    gap: 12px; margin-bottom: 14px; }
.v4-h2 { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.25; }
.v4-more { display: inline-flex; align-items: center; gap: 2px; min-height: 44px;
           font-size: 14px; font-weight: 600; text-decoration: none; color: var(--v4-gold) !important; }
.v4-more .v4-icon { width: 18px; height: 18px; }

/* ── Hero accueil ────────────────────────────────────────── */
.v4-hero { padding: 24px 0 8px; display: flex; flex-direction: column; gap: 14px; }
.v4-eyebrow { margin: 0; display: inline-flex; align-items: center; gap: 8px;
              font-size: 13px; font-weight: 600; letter-spacing: .04em;
              text-transform: uppercase; color: var(--v4-gold); }
.v4-eyebrow img { width: 16px; height: 16px; }
.v4-hero h1 { margin: 0; font-size: clamp(34px, 9vw, 56px); line-height: 1.06;
              font-weight: 800; letter-spacing: -0.02em; }
.v4-hero__lead { margin: 0; font-size: 16px; color: var(--v4-muted); max-width: 36em; }
.v4-hero .v4-btn { margin-top: 8px; }

/* ── Grille catégories ───────────────────────────────────── */
.v4-cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
           list-style: none; margin: 0; padding: 0; }
.v4-cat {
    display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 0 14px;
    border-radius: 18px; background: var(--v4-surface); border: 1px solid var(--v4-line);
    text-decoration: none; transition: border-color .15s ease, transform .15s ease;
}
.v4-cat:hover { border-color: var(--v4-gold); }
.v4-cat:active { transform: scale(.98); }
.v4-cat__icon { flex: none; width: 44px; height: 44px; border-radius: 14px;
                background: var(--v4-gold-soft); display: flex; align-items: center; justify-content: center; }
.v4-cat__icon img { width: 26px; height: 26px; }
.v4-cat__label { font-size: 15px; font-weight: 600; line-height: 1.2; }

/* ── Cartes de tops (carrousel horizontal) ───────────────── */
.v4-hscroll { position: relative; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
              margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none;
              list-style: none; }
.v4-hscroll::-webkit-scrollbar { display: none; }
.v4-hscroll > li { flex: none; scroll-snap-align: start; }

.v4-topcard { width: 236px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.v4-topcard__media { position: relative; height: 300px; border-radius: 24px; overflow: hidden;
                     background: #2B2D5C; }
.v4-topcard__media img.v4-topcard__img { position: absolute; inset: 0; width: 100%; height: 100%;
                                         object-fit: cover; opacity: 0; transition: opacity .35s ease; }
.v4-topcard__media img.is-loaded { opacity: 1; }
.v4-topcard__cat { position: absolute; top: 12px; left: 12px; z-index: 2;
                   display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
                   border-radius: 999px; background: rgba(255,255,255,.94);
                   font-size: 12px; font-weight: 600; color: var(--v4-ink); }
.v4-topcard__cat img { width: 16px; height: 16px; }
.v4-topcard__caption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
                       padding: 40px 16px 16px; color: #fff;
                       background: linear-gradient(0deg, rgba(0,0,30,.82), rgba(0,0,30,0));
                       display: flex; flex-direction: column; gap: 4px; }
.v4-topcard__first { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
                     font-weight: 600; color: #F3DFB4; }
.v4-topcard__first img { width: 18px; height: 14px; filter: brightness(0) invert(.9) sepia(.4); }
.v4-topcard__title { font-size: 18px; font-weight: 700; line-height: 1.2;
                     display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.v4-topcard__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px;
                    padding: 0 4px; font-size: 13px; color: var(--v4-muted); }
.v4-topcard__meta strong { color: var(--v4-ink); font-weight: 600; }
.v4-topcard__likes { display: inline-flex; align-items: center; gap: 4px; }
.v4-topcard__likes .v4-icon { width: 16px; height: 16px; }

/* Squelette / chargement d'image */
.v4-shimmer { background: linear-gradient(90deg, #EFE4D4 0%, #F9F2E8 50%, #EFE4D4 100%);
              background-size: 200% 100%; animation: v4-shimmer 1.3s linear infinite; }
@keyframes v4-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.v4-topcard--skeleton .v4-topcard__media { background: none; }
.v4-skel-line { height: 14px; border-radius: 8px; width: 70%; }
@media (prefers-reduced-motion: reduce) { .v4-shimmer { animation: none; } }

/* ── Étapes "Comment ça marche" ──────────────────────────── */
.v4-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.v4-step { display: flex; align-items: center; gap: 14px; padding: 14px;
           border-radius: 18px; background: var(--v4-surface); border: 1px solid var(--v4-line); }
.v4-step__num { flex: none; width: 40px; height: 40px; border-radius: 999px; background: var(--v4-ink);
                color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.v4-step p { margin: 0; font-size: 15px; line-height: 1.4; }

.v4-prose { font-size: 15px; color: var(--v4-muted); }
.v4-prose p { margin: 0 0 12px; }

/* ── Pied de page ────────────────────────────────────────── */
.v4-footer { margin-top: 40px; padding: 28px 0 calc(var(--v4-tabbar-h) + 28px);
             border-top: 1px solid var(--v4-line); font-size: 14px; color: var(--v4-muted); }
.v4-footer__inner { display: flex; flex-direction: column; gap: 14px; }
.v4-footer nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.v4-footer a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.v4-footer a:hover { color: var(--v4-ink); }
.v4-footer img.v4-footer__logo { height: 24px; width: auto; }

/* ── Barre d'onglets (mobile) ────────────────────────────── */
.v4-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--v4-tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 6px 8px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--v4-surface); border-top: 1px solid var(--v4-line);
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
}
.v4-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px;
               min-height: 52px; justify-content: center;
               text-decoration: none; font-size: 11px; font-weight: 500; color: #6E6B80; }
.v4-tabbar a[aria-current="page"] { color: var(--v4-ink); font-weight: 600; }
.v4-tabbar .v4-icon { width: 24px; height: 24px; }
.v4 .v4-tabbar .v4-tabbar__create { justify-self: center; width: 56px; height: 56px; min-height: 56px;
                                margin-top: -26px; border-radius: 20px; background: var(--v4-gold); color: #fff;
                                box-shadow: 0 8px 20px rgba(140,113,59,.35); }
.v4-tabbar .v4-tabbar__create .v4-icon { width: 28px; height: 28px; stroke-width: 2.5; }

/* ── Formulaires (connexion) ─────────────────────────────── */
.v4-card { background: var(--v4-surface); border: 1px solid var(--v4-line);
           border-radius: var(--v4-radius-l); padding: 24px 20px; }
.v4-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.v4-field label { font-size: 14px; font-weight: 600; }
.v4-input, .v4-select {
    width: 100%; min-height: 54px; padding: 0 16px; border-radius: var(--v4-radius-s);
    border: 1.5px solid #E0D4C2; background: #fff; font: inherit; font-size: 16px; color: var(--v4-ink);
}
.v4-input:focus, .v4-select:focus { outline: none; border-color: var(--v4-ink); box-shadow: 0 0 0 3px rgba(0,0,60,.12); }
.v4-input.is-invalid { border-color: var(--v4-danger); }
.v4 .invalid-feedback { font-size: 13px; color: var(--v4-danger); }
.v4-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; font-size: 13px; color: var(--v4-muted); }
.v4-divider::before, .v4-divider::after { content: ""; flex: 1; height: 1px; background: var(--v4-line); }
.v4-link-btn { background: none; border: 0; padding: 0 4px; min-height: 44px; font-weight: 700;
               text-decoration: underline; color: var(--v4-ink); }

.password-criteria { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px;
                     font-size: 13px; color: var(--v4-muted); }
.password-criteria li { display: flex; align-items: center; gap: 8px; }
.password-criteria li i { display: none; }
.password-criteria li::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: #D5C7B2; }
.password-criteria li.met { color: var(--v4-ok); }
.password-criteria li.met::before { background: var(--v4-ok); }
.password-strength-bar { height: 6px; border-radius: 999px; background: var(--v4-line); overflow: hidden; }
.password-strength-fill { height: 100%; width: 0; transition: width .2s ease; }
.password-strength-label { font-size: 12px; font-weight: 600; }

/* Toasts (auth-firebase.js) */
.toast-container { position: fixed; top: 16px; left: 16px; right: 16px; z-index: 100;
                   display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast-container .toast { pointer-events: auto; max-width: 420px; width: 100%; display: flex; align-items: center; gap: 10px;
                          padding: 14px 16px; border-radius: 16px; background: var(--v4-ink); color: #fff;
                          font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,40,.25); }
.toast-container .toast.error { background: var(--v4-danger); }
.toast-container .toast.success { background: var(--v4-ok); }
.toast-container .toast i { display: none; }
@keyframes slideOut { to { opacity: 0; transform: translateY(-8px); } }

/* ── Desktop ─────────────────────────────────────────────── */
@media (min-width: 768px) {
    .v4-header__nav { display: flex; }
    .v4-tabbar { display: none; }
    .v4-footer { padding-bottom: 32px; }
    .v4-wrap { padding: 0 24px; }
    .v4-hscroll { margin: 0 -24px; padding: 0 24px 6px; }
    .v4-hero { padding: 56px 0 16px; max-width: 720px; }
    .v4-hero .v4-btn { align-self: flex-start; padding: 0 36px; }
    .v4-cats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .v4-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .v4-section { padding-top: 48px; }
}
