/* ============================================
   LOGIN - MEDITEURS
   Écran de connexion : repris du style MProject (aurora + carte verre),
   adapté à la palette carmin de MEditeurs et au formulaire email/mot de passe.
   ============================================ */

:root {
    --primary: #E63950;
    --primary-hover: #B4293D;
    --bg-base: #fdf4f5;
    --card-bg: rgba(255, 255, 255, 0.72);
    --card-border: rgba(255, 255, 255, 0.6);
    --text-main: #26080d;
    --text-muted: #6b7280;
    --input-bg: rgba(255, 255, 255, 0.55);
    --input-border: rgba(38, 8, 13, 0.12);
    --error-bg: #fee2e2;
    --error-text: #b91c1c;
    --success-bg: #dcfce7;
    --success-text: #15803d;
    --shadow-color: rgba(38, 8, 13, 0.18);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-base: #14040a;
        --card-bg: rgba(51, 16, 25, 0.55);
        --card-border: rgba(255, 255, 255, 0.08);
        --text-main: #f1f5f9;
        --text-muted: #c9aab0;
        --input-bg: rgba(255, 255, 255, 0.05);
        --input-border: rgba(255, 255, 255, 0.12);
        --error-bg: rgba(239, 68, 68, 0.14);
        --error-text: #fca5a5;
        --success-bg: rgba(34, 197, 94, 0.14);
        --success-text: #86efac;
        --shadow-color: rgba(0, 0, 0, 0.55);
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; }

html, body { height: 100%; }

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-base);
    padding: 20px;
    overflow-x: hidden;
}

/* --- Fond animé "aurora" --- */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.aurora .blob {
    position: absolute;
    width: 46vw;
    height: 46vw;
    min-width: 420px;
    min-height: 420px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    will-change: transform;
}

.aurora .blob-1 {
    top: -12%; left: -10%;
    background: radial-gradient(circle at 30% 30%, #ef6b7c, transparent 70%);
    animation: drift1 22s ease-in-out infinite alternate;
}

.aurora .blob-2 {
    bottom: -18%; right: -8%;
    background: radial-gradient(circle at 60% 60%, #7c2848, transparent 70%);
    animation: drift2 26s ease-in-out infinite alternate;
}

.aurora .blob-3 {
    top: 30%; right: 20%;
    background: radial-gradient(circle at 50% 50%, #f2a6b8, transparent 70%);
    opacity: 0.4;
    animation: drift3 30s ease-in-out infinite alternate;
}

@keyframes drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(6%, 8%) scale(1.1); } }
@keyframes drift2 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-6%, -6%) scale(1.15); } }
@keyframes drift3 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-8%, 6%) scale(0.9); } }

.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.035;
    mix-blend-mode: overlay;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
    .aurora .blob, .login-card { animation: none !important; }
}

/* --- Carte de connexion --- */
.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 2.75rem 2.5rem;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    animation: cardIn 0.6s cubic-bezier(.16,1,.3,1);
}

@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }

.login-header { text-align: center; margin-bottom: 1.75rem; }

.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 20px;
    border-radius: 18px;
    box-shadow: 0 8px 20px -6px rgba(38, 8, 13, 0.18);
    margin-bottom: 1.25rem;
}

.logo-badge img { display: block; max-width: 170px; }

.login-header .tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.error-box, .success-box {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.error-box { background: var(--error-bg); color: var(--error-text); border-left: 3px solid var(--error-text); }
.success-box { background: var(--success-bg); color: var(--success-text); border-left: 3px solid var(--success-text); }

.form-group { position: relative; margin-bottom: 1.4rem; }

.input-wrapper { position: relative; }

.input-wrapper .prefix-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.9rem; transition: color 0.2s; pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    height: 54px;
    padding: 22px 44px 8px 44px;
    border: 1.5px solid var(--input-border);
    border-radius: 14px;
    font-size: 0.95rem;
    color: var(--text-main);
    background: var(--input-bg);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-wrapper input::placeholder { color: transparent; }

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(230, 57, 80, 0.15);
}

.input-wrapper input:focus ~ .prefix-icon { color: var(--primary); }

.input-wrapper label {
    position: absolute; left: 44px; top: 50%; transform: translateY(-50%);
    font-size: 0.95rem; color: var(--text-muted);
    pointer-events: none; transition: all 0.18s ease;
}

.input-wrapper input:focus ~ label,
.input-wrapper input:not(:placeholder-shown) ~ label {
    top: 11px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--primary);
    transform: translateY(0);
}

.password-toggle {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    cursor: pointer; color: var(--text-muted); padding: 5px;
}

.login-button {
    width: 100%;
    height: 52px;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 20px -6px rgba(230, 57, 80, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 45%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.login-button:hover::before { transform: translateX(100%); }
.login-button:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -6px rgba(230, 57, 80, 0.6); }
.login-button:active { transform: translateY(0); }
.login-button span, .login-button > i { position: relative; z-index: 1; transition: transform 0.2s ease; }
.login-button:hover > i { transform: translateX(3px); }
.login-button:disabled { opacity: 0.8; cursor: default; pointer-events: none; }

.secure-hint {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.02em;
}

.auth-links {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover { text-decoration: underline; }

.help-text {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.help-text a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.help-text a:hover { text-decoration: underline; }

.otp-instructions {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.otp-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.otp-box {
    width: 46px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    border: 1.5px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.otp-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(230, 57, 80, 0.15);
}

@media (max-width: 480px) {
    .otp-box { width: 38px; height: 48px; font-size: 1.2rem; }
    .otp-boxes { gap: 6px; }
}

@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile */
@media (max-width: 480px) {
    .login-card { padding: 2rem 1.5rem; border-radius: 0; position: fixed; inset: 0; max-width: none; display: flex; flex-direction: column; justify-content: center; }
}
