/* ============================================================
   PECHE FRANCE - Authentification (connexion / inscription)
   Carte pleine page + modale, chargees sur tout le site.
   ============================================================ */

/* ══════════════════════════════════════════
   JETONS DE DESIGN
   La modale s'affiche aussi hors des pages communauté (détails, forum…)
   où body.community-ui n'est pas présent : on redéfinit les variables ici.
   ══════════════════════════════════════════ */
.pf-auth,
.pf-auth-modal,
.pf-auth-success {
    --pf-navy: #1e3a8a;
    --pf-navy-dark: #172554;
    --pf-navy-soft: #eff6ff;
    --pf-red: #dc2626;
    --pf-red-soft: #fef2f2;
    --pf-bg: #f8fafc;
    --pf-border: #e2e8f0;
    --pf-text: #0f172a;
    --pf-muted: #64748b;
}
.pf-auth-modal .pf-auth-card,
.pf-auth-modal-body {
    color: var(--pf-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ══════════════════════════════════════════
   AUTHENTIFICATION (connexion / inscription)
   Carte centrée façon modale, sur fond communautaire.
   ══════════════════════════════════════════ */
body.community-ui .pf-auth {
    padding: 38px 20px 54px;
    background:
        radial-gradient(900px 480px at 50% -12%, rgba(30, 58, 138, 0.10), transparent 70%),
        #f1f5f9;
    min-height: calc(100vh - 210px);
}
.pf-auth-inner { max-width: 960px; margin: 0 auto; }

.pf-auth-card {
    display: grid;
    grid-template-columns: 0.88fr 1fr;
    background: #fff;
    border: 1px solid var(--pf-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 34px 80px -46px rgba(15, 23, 42, 0.6), 0 2px 8px rgba(15, 23, 42, 0.04);
}

.pf-auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 36px 32px;
    background: linear-gradient(150deg, #172554 0%, #1e3a8a 55%, #1d4ed8 100%);
    color: #fff;
}
.pf-auth-aside::after {
    content: "";
    position: absolute;
    right: -90px; bottom: -110px;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.20);
    filter: blur(12px);
    pointer-events: none;
}
.pf-auth-aside > * { position: relative; z-index: 1; }
.pf-auth-badge {
    display: inline-flex; align-items: center; gap: 8px;
    align-self: flex-start;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: #dbeafe;
}
.pf-auth-aside h1 {
    margin: 6px 0 0;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 900;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: #fff;
}
.pf-auth-aside .pf-auth-lead {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.65;
    color: #cbd5e1;
}
.pf-auth-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 11px; }
.pf-auth-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; font-weight: 600; color: #e2e8f0; line-height: 1.45; }
.pf-auth-list i {
    flex-shrink: 0;
    width: 22px; height: 22px; margin-top: 1px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    color: #bfdbfe;
    display: grid; place-items: center;
    font-size: 9.5px;
}
.pf-auth-aside-foot {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: #93c5fd;
}

.pf-auth-body { padding: 34px 36px; display: flex; flex-direction: column; justify-content: center; }
.pf-auth-head h2 { margin: 0 0 4px; font-size: 1.55rem; font-weight: 900; letter-spacing: -0.02em; color: var(--pf-text); }
.pf-auth-head p { margin: 0 0 20px; font-size: 12.5px; color: var(--pf-muted); }

.pf-auth-alert {
    padding: 11px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.5;
}
.pf-auth-alert.is-error { background: var(--pf-red-soft); border-color: #fecaca; color: #991b1b; }
.pf-auth-alert.is-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

.pf-auth-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 44px;
    border: 1px solid var(--pf-border);
    border-radius: 12px;
    background: #fff;
    color: #334155;
    font-size: 13px; font-weight: 700;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.pf-auth-google:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--pf-text); }
.pf-auth-google .g { color: #ea4335; font-size: 15px; }

.pf-auth-sep {
    position: relative;
    margin: 18px 0;
    text-align: center;
    font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: var(--pf-muted);
}
.pf-auth-sep::before {
    content: "";
    position: absolute; left: 0; right: 0; top: 50%;
    height: 1px; background: #e2e8f0;
}
.pf-auth-sep span { position: relative; background: #fff; padding: 0 10px; }

.pf-auth-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 18px; background: #f1f5f9; border-radius: 12px; border: 0; }
.pf-auth-tabs .nav-item { flex: 1; }
.pf-auth-tabs .nav-link {
    width: 100%;
    padding: 8px 10px;
    border: 0; border-radius: 9px;
    background: transparent;
    color: #475569;
    font-size: 12px; font-weight: 800;
}
.pf-auth-tabs .nav-link:hover { background: #e2e8f0; color: var(--pf-text); }
.pf-auth-tabs .nav-link.active { background: #fff; color: var(--pf-navy); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14); }

.pf-auth-body .form-label { margin-bottom: 6px; font-size: 12px; font-weight: 800; color: #334155; }
.pf-auth-body .form-control {
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--pf-border);
    border-radius: 11px;
    background: #fff;
    color: var(--pf-text);
    font-size: 13.5px;
}
.pf-auth-body .form-control:focus { border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12); }
.pf-auth-body .mb-3 { margin-bottom: 14px !important; }
.pf-auth-body .form-text { font-size: 11.5px; color: var(--pf-muted); }
.pf-auth-code { height: 52px !important; font-size: 1.3rem !important; font-weight: 800 !important; letter-spacing: 8px; }

.pf-auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 14px; font-size: 12px; font-weight: 700; }
.pf-auth-links a, .pf-auth-foot a { color: #1e40af; text-decoration: underline; text-underline-offset: 2px; }
.pf-auth-links a:hover, .pf-auth-foot a:hover { color: #172554; }

.pf-auth-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 45px;
    border: 0; border-radius: 12px;
    background: var(--pf-navy);
    color: #fff;
    font-size: 13.5px; font-weight: 800;
    box-shadow: 0 12px 24px -16px rgba(30, 58, 138, 0.8);
    transition: background .15s;
}
.pf-auth-submit:hover { background: var(--pf-navy-dark); color: #fff; }

.pf-auth-foot { margin: 18px 0 0; text-align: center; font-size: 12.5px; color: var(--pf-muted); }

.pf-auth-success {
    max-width: 560px;
    margin: 0 auto;
    padding: 38px 32px;
    border: 1px solid var(--pf-border);
    border-radius: 24px;
    background: #fff;
    text-align: center;
    box-shadow: 0 30px 70px -44px rgba(15, 23, 42, 0.55);
}
.pf-auth-success-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: #eff6ff;
    color: var(--pf-navy);
    display: grid; place-items: center;
    font-size: 1.6rem;
}
.pf-auth-success-icon.is-error { background: var(--pf-red-soft); color: #b91c1c; }
.pf-auth-success-icon.is-info { background: #ecfeff; color: #0e7490; }
.pf-auth-success h2 { margin: 0 0 8px; font-size: 1.4rem; font-weight: 900; letter-spacing: -0.02em; }
.pf-auth-success-text { margin: 0 0 22px; font-size: 13px; line-height: 1.65; color: var(--pf-muted); }
.pf-auth-success .pf-auth-submit { max-width: 280px; margin: 0 auto; }

/* ── Modale connexion / inscription ── */
.pf-auth-modal {
    /* Toujours au-dessus des autres modales (lecteur d'article, publication…)
       et des éléments fixes du portail. */
    z-index: 20000;
}
.pf-auth-modal.show { opacity: 1; }
.pf-auth-modal .modal-dialog {
    max-width: 900px;
    margin: 1.25rem auto;
}
.pf-auth-modal .modal-content {
    position: relative;
    max-height: calc(100vh - 2.5rem);
    border: 0;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 40px 100px -40px rgba(2, 6, 23, 0.75), 0 0 0 1px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}
.pf-auth-modal-body {
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.pf-auth-modal-body .pf-auth-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100%;
}
.pf-auth-modal .pf-auth-head { padding-right: 46px; }

.pf-auth-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #334155;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10);
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.pf-auth-modal-close:hover { background: #f1f5f9; color: #172554; transform: rotate(90deg); }
.pf-auth-modal-close:focus-visible { outline: 3px solid rgba(30, 58, 138, 0.35); outline-offset: 2px; }

.pf-auth-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 420px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}
.pf-spinner {
    width: 30px;
    height: 30px;
    display: inline-block;
    border-radius: 50%;
    border: 3px solid #dbeafe;
    border-top-color: #1e3a8a;
    animation: pf-spin 0.7s linear infinite;
}
.pf-spinner--sm {
    width: 15px;
    height: 15px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

.pf-auth-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 380px;
    padding: 40px 26px;
    text-align: center;
}
.pf-auth-modal-error-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 1.4rem;
}
.pf-auth-modal-error h3 { margin: 4px 0 0; font-size: 1.1rem; font-weight: 900; color: #0f172a; }
.pf-auth-modal-error p { max-width: 380px; margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: #64748b; }
.pf-auth-modal-error .pf-auth-submit { max-width: 260px; }
.pf-auth-modal-fallback {
    font-size: 12px;
    font-weight: 700;
    color: #1e40af;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pf-auth-submit.is-busy { opacity: 0.85; cursor: progress; }
.pf-auth-submit:disabled { opacity: 0.85; }

@media (max-width: 900px) {
    .pf-auth-modal .modal-dialog { max-width: none; margin: 0.75rem; }
    .pf-auth-modal .modal-content { border-radius: 20px; }
    .pf-auth-modal .pf-auth-card { grid-template-columns: 1fr; }
    .pf-auth-modal .pf-auth-body { padding: 40px 22px 26px; }
    .pf-auth-modal-body { max-height: calc(100vh - 1.5rem); }
}

/* Fenêtre basse (laptop, zoom élevé) : on aligne la carte en haut pour que
   le haut et le bouton de fermeture restent toujours visibles. */
@media (max-height: 760px) {
    .pf-auth-modal .modal-dialog {
        align-items: flex-start;
        margin-top: 0.75rem;
        margin-bottom: 0.75rem;
    }
    .pf-auth-modal .modal-content { max-height: calc(100vh - 1.5rem); }
    .pf-auth-modal-body { max-height: calc(100vh - 1.5rem); }
}

@media (max-width: 575.98px) {
    .pf-auth-modal .modal-dialog { margin: 0.5rem; }
    .pf-auth-modal .modal-content { max-height: calc(100vh - 1rem); border-radius: 18px; min-height: 0; }
    .pf-auth-modal-body { max-height: calc(100vh - 1rem); }
    .pf-auth-modal .pf-auth-body { padding: 38px 20px 24px; }
}

@media (max-width: 900px) {
    body.community-ui .pf-auth { padding: 20px 12px 40px; }
    .pf-auth-card { grid-template-columns: 1fr; border-radius: 20px; }
    .pf-auth-aside { display: none; }
    .pf-auth-body { padding: 26px 20px; }
    .pf-auth-head h2 { font-size: 1.4rem; }
    .pf-auth-success { padding: 30px 20px; border-radius: 20px; }
}
