/**
 * Maison Claude — Page de connexion (auth) responsive premium
 */

:root {
    --auth-primary: #244cfd;
    --auth-secondary: #0481f7;
    --auth-bg: #f8fafc;
    --auth-glass: rgba(255, 255, 255, 0.82);
    --auth-border: rgba(0, 0, 0, 0.06);
    --auth-text: #1e293b;
    --auth-muted: #64748b;
    --auth-radius-card: clamp(22px, 4vw, 35px);
    --auth-safe-top: env(safe-area-inset-top, 0px);
    --auth-safe-right: env(safe-area-inset-right, 0px);
    --auth-safe-bottom: env(safe-area-inset-bottom, 0px);
    --auth-safe-left: env(safe-area-inset-left, 0px);
}

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

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

body.authentication-bg {
    background: var(--auth-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(36, 76, 253, 0.06) 0, transparent 52%),
        radial-gradient(at 100% 100%, rgba(4, 129, 247, 0.06) 0, transparent 52%);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding:
        var(--auth-safe-top)
        var(--auth-safe-right)
        var(--auth-safe-bottom)
        var(--auth-safe-left);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    color: var(--auth-text);
}

.decoration {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.14;
    pointer-events: none;
}

.shape-1 {
    width: min(400px, 85vw);
    height: min(400px, 85vw);
    background: var(--auth-primary);
    top: -15%;
    left: -20%;
}

.shape-2 {
    width: min(350px, 80vw);
    height: min(350px, 80vw);
    background: var(--auth-secondary);
    bottom: -15%;
    right: -20%;
}

/* ─── Page shell ─── */
.auth-page {
    position: relative;
    z-index: 1;
    min-height: calc(100dvh - var(--auth-safe-top) - var(--auth-safe-bottom));
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 32px);
}

.auth-topbar {
    flex-shrink: 0;
    margin-bottom: clamp(20px, 4vw, 40px);
}

.logo-container {
    display: inline-flex;
    align-items: center;
    background: #fff;
    padding: clamp(10px, 2.5vw, 15px) clamp(18px, 4vw, 30px);
    border-radius: clamp(14px, 2.5vw, 20px);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
    line-height: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logo-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.08);
}

.logo-container img {
    height: clamp(44px, 10vw, 70px);
    width: auto;
    display: block;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.auth-container {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: clamp(32px, 6vw, 72px);
}

/* ─── Welcome panel ─── */
.auth-welcome {
    color: var(--auth-text);
}

.auth-welcome h1 {
    font-size: clamp(2rem, 6.5vw, 4.5rem);
    font-weight: 800;
    margin: 0 0 clamp(12px, 2.5vw, 15px);
    letter-spacing: clamp(-1px, -0.4vw, -3px);
    line-height: 1.05;
    background: linear-gradient(135deg, #0f172a 0%, var(--auth-primary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-underline {
    width: clamp(64px, 14vw, 100px);
    height: clamp(4px, 1vw, 6px);
    background: linear-gradient(90deg, var(--auth-primary), var(--auth-secondary));
    border-radius: 3px;
    margin-bottom: clamp(20px, 4vw, 35px);
}

.auth-welcome p {
    font-size: clamp(0.95rem, 2.4vw, 1.25rem);
    line-height: 1.65;
    color: var(--auth-muted);
    margin: 0 0 clamp(24px, 4vw, 40px);
    max-width: 32rem;
    font-weight: 500;
}

.btn-learn-more {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: clamp(12px, 2.5vw, 14px) clamp(24px, 5vw, 35px);
    border-radius: clamp(12px, 2vw, 15px);
    color: var(--auth-text);
    font-weight: 700;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, color 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
}

.btn-learn-more:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    color: var(--auth-primary);
}

/* Mobile welcome teaser (inside card area on small screens) */
.auth-welcome-mobile {
    display: none;
    text-align: center;
    margin-bottom: clamp(20px, 4vw, 28px);
    padding-bottom: clamp(16px, 3vw, 24px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.auth-welcome-mobile h3 {
    margin: 0 0 8px;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--auth-text);
}

.auth-welcome-mobile p {
    margin: 0;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    color: var(--auth-muted);
    line-height: 1.5;
}

/* ─── Login card ─── */
.auth-card {
    width: 100%;
    background: var(--auth-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-card);
    padding: clamp(28px, 5vw, 50px);
    box-shadow:
        0 25px 50px -14px rgba(0, 0, 0, 0.08),
        0 12px 24px -10px rgba(0, 0, 0, 0.04);
}

.auth-card h2 {
    color: var(--auth-text);
    text-align: center;
    font-size: clamp(1.5rem, 4.5vw, 2.2rem);
    font-weight: 800;
    margin: 0 0 clamp(22px, 4vw, 30px);
    letter-spacing: -0.5px;
}

.auth-form-group {
    margin-bottom: clamp(16px, 3vw, 22px);
}

.form-label {
    color: var(--auth-text);
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    font-size: clamp(0.875rem, 2.2vw, 0.95rem);
}

.form-control {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: clamp(12px, 2vw, 15px) !important;
    color: var(--auth-text) !important;
    padding: clamp(14px, 3vw, 16px) clamp(16px, 3.5vw, 20px) !important;
    width: 100% !important;
    font-size: 16px !important; /* évite zoom iOS */
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    margin-bottom: 0 !important;
    min-height: 48px;
}

.form-control:focus {
    border-color: var(--auth-primary) !important;
    box-shadow: 0 0 0 4px rgba(36, 76, 253, 0.12) !important;
    outline: none;
}

.form-control::placeholder {
    color: #94a3b8;
}

.btn-submit {
    width: 100%;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    border: none;
    padding: clamp(14px, 3vw, 18px);
    border-radius: clamp(14px, 2.5vw, 18px);
    color: #fff;
    font-weight: 800;
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    margin-top: clamp(8px, 2vw, 12px);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    min-height: 52px;
    box-shadow: 0 15px 30px -10px rgba(36, 76, 253, 0.45);
    -webkit-tap-highlight-color: transparent;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px -8px rgba(36, 76, 253, 0.55);
}

.btn-submit:active {
    transform: translateY(-1px);
}

.auth-footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    font-size: clamp(0.875rem, 2.2vw, 0.95rem);
    margin-top: clamp(24px, 4vw, 35px);
}

.auth-footer-links a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 700;
    padding: 6px 8px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

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

.auth-footer-links .auth-footer-sep {
    display: none;
}

/* SweetAlert */
.swal2-popup {
    border-radius: 20px !important;
    font-family: 'Inter', sans-serif !important;
    max-width: min(420px, calc(100vw - 32px)) !important;
}

/* ─── Tablette ─── */
@media (max-width: 991.98px) {
    .auth-container {
        grid-template-columns: 1fr;
        gap: clamp(24px, 5vw, 40px);
        max-width: 520px;
        margin: 0 auto;
    }

    .auth-welcome--desktop {
        display: none;
    }

    .auth-welcome-mobile {
        display: block;
    }

    .auth-topbar {
        text-align: center;
    }

    .logo-container {
        margin: 0 auto;
    }

    .auth-main {
        align-items: flex-start;
        padding-top: 8px;
    }
}

/* ─── Mobile ─── */
@media (max-width: 575.98px) {
    .auth-page {
        padding: 12px 14px 20px;
    }

    .auth-card {
        padding: 24px 20px;
    }

    .shape-1,
    .shape-2 {
        opacity: 0.08;
        filter: blur(70px);
    }
}

/* ─── Très petits écrans ─── */
@media (max-width: 359.98px) {
    .auth-footer-links a {
        width: 100%;
    }
}

/* ─── Paysage mobile ─── */
@media (max-height: 520px) and (orientation: landscape) {
    .auth-page {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .auth-topbar {
        margin-bottom: 12px;
    }

    .logo-container img {
        height: 40px;
    }

    .auth-main {
        align-items: flex-start;
    }

    .auth-card {
        padding: 20px 24px;
    }

    .auth-welcome-mobile {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
}

/* ─── Grand écran ─── */
@media (min-width: 1200px) {
    .auth-container {
        gap: 80px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-submit,
    .btn-learn-more,
    .logo-container {
        transition: none;
    }

    .btn-submit:hover,
    .btn-learn-more:hover,
    .logo-container:hover {
        transform: none;
    }
}
