/* ==========================================================================
   Masira Panel — Login / Authentification
   CSS classique (sans framework)
   ========================================================================== */

:root {
    --dark: #0f0c29;
    --dark-2: #1e1b4b;
    --dark-3: #3b1c7a;
    --purple: #7c3aed;
    --purple-light: #a855f7;
    --indigo: #4f46e5;

    --text: #1e293b;
    --muted: #64748b;
    --hair: #e2e8f0;

    --white: #ffffff;
    --bg-soft: #f8fafc;

    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);

    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-lg: 0 25px 50px -12px rgba(76, 29, 149, 0.35);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.1);

    --transition: all 0.2s ease;
}

* { box-sizing: border-box; }

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

.login-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg-soft);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* ── Background décoratif ─────────────────────────────────────────────── */

.bg-blur {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.35), transparent 45%),
                radial-gradient(circle at 85% 75%, rgba(79, 70, 229, 0.3), transparent 45%),
                var(--bg-soft);
}

.bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
}

/* ── Layout général ────────────────────────────────────────────────────── */

.auth-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.auth-layout {
    display: flex;
    width: 100%;
    max-width: 1100px;
    min-height: 620px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* ── Panneau gauche (branding) ─────────────────────────────────────────── */

.side-left {
    flex: 1 1 45%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--dark) 0%, var(--dark-2) 45%, var(--dark-3) 100%);
    overflow: hidden;
}

.side-left::before,
.side-left::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.35;
    animation: blob 9s infinite ease-in-out;
}

.side-left::before {
    top: 10%;
    left: 10%;
    background: var(--purple);
}

.side-left::after {
    bottom: 5%;
    right: 10%;
    background: var(--indigo);
    animation-delay: 3s;
}

@keyframes blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(20px, -30px) scale(1.1); }
    66%      { transform: translate(-15px, 15px) scale(0.95); }
}

.brand-hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.4));
}

/* ── Panneau droit (formulaire) ────────────────────────────────────────── */

.side-right {
    flex: 1 1 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    padding: 40px 32px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card.glass {
    background: var(--white);
}

/* ── En-tête ───────────────────────────────────────────────────────────── */

.auth-head {
    margin-bottom: 24px;
    text-align: center;
}

.brand-text h1 {
    margin: 0 0 6px;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
}

.brand-text p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

/* ── Icône de succès (logout) ──────────────────────────────────────────── */

.success-check {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--indigo));
    color: var(--white);
    box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.4);
}

.success-check svg {
    width: 28px;
    height: 28px;
}

/* ── Redirection (logout) ─────────────────────────────────────────────── */

.redirect-wrapper {
    background: var(--bg-soft);
    border: 1px solid var(--hair);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.redirect-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.82rem;
    color: var(--muted);
}

.redirect-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.redirect-time {
    font-weight: 700;
    color: var(--purple);
}

.redirect-loader {
    height: 6px;
    border-radius: 999px;
    background: var(--hair);
    overflow: hidden;
}

.redirect-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--purple), var(--indigo));
    border-radius: 999px;
    transform-origin: left;
    animation: redirectShrink 5s linear forwards;
}

@keyframes redirectShrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--hair);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 20px;
}

.auth-tabs .tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.auth-tabs .tab:hover {
    color: var(--purple);
}

.auth-tabs .tab.active {
    background: var(--white);
    color: var(--purple);
    box-shadow: var(--shadow-md);
}

/* ── Alerte ────────────────────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ── Tab panels ────────────────────────────────────────────────────────── */

.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Champs ────────────────────────────────────────────────────────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.field label i {
    color: var(--purple);
}

.field input {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.field input:focus {
    outline: none;
    border-color: var(--purple);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.hint {
    font-size: 0.75rem;
    color: var(--muted);
}

/* Message de disponibilité asynchrone (identifiant / email / nom de radio) */

.availability-msg {
    display: block;
    font-size: 0.75rem;
    margin-top: 2px;
}

.availability-msg[hidden] {
    display: none;
}

.availability-msg.is-checking {
    color: var(--muted);
}

.availability-msg.is-available {
    color: #16a34a;
}

.availability-msg.is-taken {
    color: var(--danger);
}

/* Champ mot de passe */

.pw-wrap {
    position: relative;
}

.pw-wrap input {
    padding-right: 42px;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.pw-toggle:hover {
    color: var(--purple);
    background: var(--hair);
}

/* Jauge de force du mot de passe (zxcvbn) — onglets Inscription / Rejoindre */

.pw-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.pw-strength[hidden] {
    display: none;
}

.pw-strength-track {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: var(--hair);
    overflow: hidden;
}

.pw-strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--danger);
    transition: width 0.2s ease, background-color 0.2s ease;
}

.pw-strength[data-level="0"] .pw-strength-fill { width: 10%; background: #dc2626; }
.pw-strength[data-level="1"] .pw-strength-fill { width: 30%; background: #ea580c; }
.pw-strength[data-level="2"] .pw-strength-fill { width: 55%; background: #eab308; }
.pw-strength[data-level="3"] .pw-strength-fill { width: 80%; background: #84cc16; }
.pw-strength[data-level="4"] .pw-strength-fill { width: 100%; background: #16a34a; }

.pw-strength-text {
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
}

.pw-strength[data-level="0"] .pw-strength-text { color: #dc2626; }
.pw-strength[data-level="1"] .pw-strength-text { color: #ea580c; }
.pw-strength[data-level="2"] .pw-strength-text { color: #b45309; }
.pw-strength[data-level="3"] .pw-strength-text { color: #4d7c0f; }
.pw-strength[data-level="4"] .pw-strength-text { color: #16a34a; }

/* Honeypot anti-bot (champ invisible) */

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ── Lignes utilitaires ────────────────────────────────────────────────── */

.row {
    display: flex;
    align-items: center;
}

.row.between {
    justify-content: space-between;
}

.row.gap {
    gap: 12px;
    flex-wrap: wrap;
}

/* Checkbox custom */

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--purple);
    cursor: pointer;
}

.link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--purple);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* ── Boutons ───────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn.full {
    width: 100%;
}

.btn.primary {
    color: var(--white);
    background: linear-gradient(90deg, var(--purple), var(--indigo));
    box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.4);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px -6px rgba(124, 58, 237, 0.5);
}

.btn.ghost {
    background: var(--bg-soft);
    color: var(--muted);
    border-color: var(--hair);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 9px 14px;
}

.btn.ghost:hover {
    color: var(--purple);
    border-color: var(--purple);
}

/* ── Séparateur ────────────────────────────────────────────────────────── */

.sep {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.sep::before,
.sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hair);
}

.sep span {
    padding: 0 12px;
}

/* ── Réseaux sociaux ───────────────────────────────────────────────────── */

.social-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-social-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--hair);
    color: var(--muted);
    background: var(--bg-soft);
    font-size: 1.05rem;
    text-decoration: none;
    transition: var(--transition);
}

.btn-social-icon:hover {
    color: var(--purple);
    border-color: var(--purple);
    transform: translateY(-2px);
}

/* ── 2FA ───────────────────────────────────────────────────────────────── */

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-soft);
    border: 1px solid var(--hair);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.user-badge i {
    color: var(--purple);
    font-size: 1.05rem;
}

.user-badge strong {
    color: var(--text);
}

.code-input {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    text-indent: 0.5em;
}

.tfa-tips {
    margin-top: 20px;
    background: var(--bg-soft);
    border: 1px solid var(--hair);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 0.8rem;
    color: var(--muted);
}

.tfa-tips strong {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.tfa-tips strong i {
    color: var(--purple);
}

.tfa-tips ul {
    margin: 0;
    padding-left: 18px;
}

.tfa-tips li {
    margin-bottom: 4px;
}

.tfa-tips li:last-child {
    margin-bottom: 0;
}

/* ── Recaptcha ─────────────────────────────────────────────────────────── */

.recaptcha-container {
    display: flex;
    justify-content: center;
}

/* ── Footer de la carte ────────────────────────────────────────────────── */

.auth-foot {
    margin-top: 24px;
    text-align: center;
}

.auth-foot small {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── Footer de page ────────────────────────────────────────────────────── */

.site-footer {
    padding: 20px 32px;
    background: var(--dark);
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.footer-left p {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-left p a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: underline;
}

.footer-left p a:hover {
    color: #fff;
}

.footer-right {
    display: flex;
    gap: 16px;
}

.footer-right a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    text-decoration: none;
    transition: var(--transition);
}

.footer-right a:hover {
    color: var(--purple-light);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .side-left {
        display: none;
    }

    .auth-layout {
        min-height: unset;
        box-shadow: none;
    }

    .side-right {
        padding: 24px 16px;
    }
}

@media (max-width: 480px) {
    .auth-wrap {
        padding: 16px 8px;
    }

    .auth-card {
        max-width: 100%;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}
