/* =========================================================
   AIROBI — auth.css (login / register / forgot)
   Thème bleu SaaS · responsive complet
   Points de rupture : 480px (mobiles) · 360px (petits mobiles)
   · paysage bas · écrans tactiles · mouvement réduit
   ========================================================= */

:root {
    --bg-start: #f0f1f7; --bg-middle: #e4e5f0; --bg-end: #eceef5;
    --surface: #ffffff; --primary: #2563eb; --primary-dark: #1d4ed8;
    --text: #1a1a2e; --muted: #6b7280; --border: #e5e7eb; --input-bg: #faf9ff;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: linear-gradient(160deg, var(--bg-start) 0%, var(--bg-middle) 50%, var(--bg-end) 100%);
    background-attachment: fixed;          /* le dégradé ne bouge pas au scroll iOS */
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh;
    min-height: 100dvh;                    /* vraie hauteur mobile (barre d'adresse) */
    padding: clamp(12px, 3vw, 24px);       /* marge fluide selon l'écran */
    -webkit-font-smoothing: antialiased;
}

/* ---------- Carte ---------- */
.login-container {
    width: min(100%, 430px);
    border-radius: 28px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 25px 60px rgba(37, 99, 235, 0.08);
    animation: cardIn .45s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Illustration ---------- */
.illustration {
    position: relative; width: 100%; height: 220px;
    display: flex; justify-content: center; align-items: center;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.72), transparent 38%),
        linear-gradient(180deg, #dbeafe 0%, #bfdbfe 45%, #93c5fd 100%);
}
.logo-wrapper {
    width: 100px; height: 100px;
    display: flex; justify-content: center; align-items: center;
    padding: 15px; border-radius: 24px; background: var(--surface);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.12); z-index: 1;
}
.logo-wrapper img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Formulaire ---------- */
.form-section { padding: 34px 30px 30px; }

.brand-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 16px; border-radius: 20px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8; font-size: 10px; font-weight: 800;
    letter-spacing: 1.8px; text-transform: uppercase; margin-bottom: 16px;
}

h1 {
    /* taille fluide : jamais trop grande sur petit écran */
    font-size: clamp(23px, 5.5vw, 28px);
    font-weight: 800; line-height: 1.1; letter-spacing: -0.5px; margin-bottom: 8px;
    color: var(--text);
}

.subtitle {
    color: #90a4ae; font-size: 14px; font-weight: 500;
    line-height: 1.6; margin-bottom: 30px;
}

/* ---------- Champs ---------- */
.input-group { position: relative; margin-bottom: 16px; }
.input-group i {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: #b0bec5; font-size: 15px; pointer-events: none;
}
.input-group input {
    width: 100%;
    padding: 15px 16px 15px 44px;
    border: 2px solid var(--border); border-radius: 14px;
    background: var(--input-bg);
    font: inherit;
    font-size: 16px;          /* ⭐ 16px minimum : empêche le zoom auto iOS au focus */
    color: #37474f; outline: none; min-height: 52px;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.input-group input:focus {
    border-color: var(--primary); background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}
.input-group input:focus-visible { outline: none; }

/* Autofill Chrome : évite le fond jaune qui casse le design */
.input-group input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 60px var(--input-bg) inset;
    -webkit-text-fill-color: #37474f;
    transition: background-color 9999s ease-in-out 0s;
}

.forgot-link {
    display: block; text-align: right;
    color: var(--primary); font-size: 12px; font-weight: 600;
    text-decoration: none; margin-bottom: 20px;
}
.forgot-link:hover { text-decoration: underline; }

/* ---------- Bouton ---------- */
.btn-login {
    width: 100%; min-height: 54px; padding: 0 18px;
    border: none; border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font: 700 15px/1 'Plus Jakarta Sans', sans-serif;
    cursor: pointer; position: relative; overflow: hidden;
    box-shadow: 0 4px 18px rgba(29, 78, 216, 0.26);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn-login:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-login:active:not(:disabled) { transform: translateY(0); }
.btn-login:disabled { opacity: .7; cursor: wait; }

/* ---------- Inscription ---------- */
.register-section {
    margin-top: 26px; padding-top: 22px;
    border-top: 1px solid var(--border); text-align: center;
}
.register-section p { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.register-section a { color: var(--primary); font-weight: 700; text-decoration: none; font-size: 14px; }
.register-section a:hover { text-decoration: underline; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    /* safe-area : remonte au-dessus de la barre gesture iPhone */
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    padding: 14px 22px;
    background: linear-gradient(135deg, #1a1a2e, #1e3a8a);
    color: #fff; border-radius: 14px;
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 13.5px; font-weight: 600;
    box-shadow: 0 12px 40px rgba(26, 26, 46, 0.32);
    opacity: 0; pointer-events: none;
    transition: transform 0.35s ease, opacity 0.35s ease;
    z-index: 1000;
    max-width: calc(100% - 32px);
    text-align: center;
}
.toast.error { background: linear-gradient(135deg, #b00020, #e91414); }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.toast i { color: #66bb6a; font-size: 16px; }
.toast.error i { color: #fff; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* ---------- Smartphones (≤ 480px) ---------- */
@media (max-width: 480px) {
    .login-container { border-radius: 22px; }
    .illustration { height: 170px; }
    .logo-wrapper { width: 86px; height: 86px; padding: 12px; border-radius: 20px; }
    .form-section { padding: 26px 20px 24px; }
    .subtitle { margin-bottom: 24px; font-size: 13.5px; }
    .input-group { margin-bottom: 14px; }
    .input-group input { padding: 14px 14px 14px 42px; min-height: 50px; }
    .input-group i { left: 14px; font-size: 14px; }
    .btn-login { min-height: 52px; font-size: 15px; }
    .register-section { margin-top: 22px; padding-top: 18px; }
    .toast { font-size: 12.5px; padding: 12px 16px; border-radius: 12px; }
}

/* ---------- Très petits smartphones (≤ 360px) ---------- */
@media (max-width: 360px) {
    body { padding: 10px; }
    .login-container { border-radius: 18px; }
    .illustration { height: 150px; }
    .logo-wrapper { width: 76px; height: 76px; border-radius: 18px; }
    .form-section { padding: 22px 16px 20px; }
    h1 { font-size: 22px; }
    .brand-tag { letter-spacing: 1.2px; font-size: 9px; }
    .btn-login { min-height: 50px; font-size: 14.5px; }
}

/* ---------- Téléphone en paysage (peu de hauteur) ---------- */
/* La carte passe en haut + on compacte tout pour éviter de scroller */
@media (max-height: 560px) and (orientation: landscape) {
    body { align-items: flex-start; overflow-y: auto; }
    .illustration { height: 110px; }
    .logo-wrapper { width: 68px; height: 68px; padding: 10px; border-radius: 16px; }
    .form-section { padding: 18px 22px 20px; }
    .subtitle { margin-bottom: 14px; }
    .input-group { margin-bottom: 12px; }
    .input-group input { min-height: 46px; padding-top: 11px; padding-bottom: 11px; }
    .forgot-link { margin-bottom: 14px; }
    .btn-login { min-height: 48px; }
    .register-section { margin-top: 16px; padding-top: 14px; }
}

/* ---------- Écrans tactiles : zones de tap confortables ---------- */
@media (hover: none) {
    .forgot-link,
    .register-section a { padding: 6px 0; display: inline-block; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
    .login-container { animation: none; }
    .toast { transition: none; }
    .btn-login { transition: none; }
}