/* ============================================
   login.css
   PAGE DE CONNEXION - DESIGN MODERNISÉ
   ============================================ */

/* --- LAYOUT PRINCIPAL --- */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

/* Fond avec effet de grille subtile */
.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 70%);
}

/* Orbes de lumière animés */
.login-page::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    animation: float 12s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-30px, 20px) scale(1.05);
    }

    66% {
        transform: translate(20px, -10px) scale(0.95);
    }
}

/* Seconde orbe */
.login-card::after {
    content: '';
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation: float 15s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: -1;
}

/* --- LOGIN CARD --- */
.login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 100px -20px rgba(59, 130, 246, 0.2);
    z-index: 1;
    animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Bordure supérieure dégradée animée */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
            var(--accent-primary) 0%,
            #8b5cf6 25%,
            #ec4899 50%,
            #8b5cf6 75%,
            var(--accent-primary) 100%);
    background-size: 200% 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- HEADER --- */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 130px;
    height: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.3));
    animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    from {
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.2));
    }

    to {
        filter: drop-shadow(0 0 35px rgba(59, 130, 246, 0.4));
    }
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- INFO BOX --- */
.login-info {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    position: relative;
    overflow: hidden;
}

.login-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #8b5cf6);
    border-radius: 3px 0 0 3px;
}

.login-info a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.login-info a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* --- FORM --- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-form .btn--primary {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-form .btn--primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #6366f1, var(--accent-primary));
    opacity: 0;
    transition: opacity 0.3s;
}

.login-form .btn--primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 20px -5px rgba(59, 130, 246, 0.4),
        0 0 40px -10px rgba(99, 102, 241, 0.4);
}

.login-form .btn--primary:hover::before {
    opacity: 1;
}

.login-form .btn--primary span {
    position: relative;
    z-index: 1;
}

/* État loading */
.login-form .btn--primary.loading {
    pointer-events: none;
    opacity: 0.85;
}

.login-form .btn--primary.loading::after {
    content: '';
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    margin-left: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- FOOTER LINKS --- */
.login-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.login-footer .separator {
    color: var(--text-tertiary);
    font-size: 0.5rem;
    opacity: 0.5;
}

.login-footer .form-link {
    position: relative;
    padding: 0.25rem 0;
}

.login-footer .form-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-primary);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-footer .form-link:hover::after {
    width: 100%;
}

.login-footer .form-link:hover {
    text-decoration: none;
}

/* --- BRAND FOOTER --- */
.login-brand {
    margin-top: 2.5rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-align: center;
    z-index: 1;
    opacity: 0.7;
}

/* ============================================
   MODAL MOT DE PASSE OUBLIÉ
   ============================================ */

/* Utilitaire pour masquer les éléments */
.hidden {
    display: none !important;
}

.login-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-modal.active {
    opacity: 1;
    visibility: visible;
}

.login-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.login-modal__content {
    position: relative;
    width: 90%;
    max-width: 420px;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 25px 60px -15px rgba(0, 0, 0, 0.6);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-modal.active .login-modal__content {
    transform: scale(1) translateY(0);
}

.login-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.login-modal__close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.login-modal__close:hover svg {
    fill: var(--error);
}

.login-modal__close svg {
    width: 18px;
    height: 18px;
    fill: var(--text-secondary);
    transition: fill 0.2s;
}

.login-modal__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-modal__title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-modal__subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Success state */
.login-modal__success {
    text-align: center;
    padding: 1rem 0;
}

.login-modal__success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.login-modal__success-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--success);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: checkDraw 0.4s ease-out 0.2s both;
}

@keyframes checkDraw {
    from {
        stroke-dasharray: 100;
        stroke-dashoffset: 100;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.login-card::before {
    left: 10px;
    /* Décalage gauche */
    right: 10px;
    /* Décalage droite */
    top: 0;
    /* Reste collé en haut */
    width: auto;
    /* S'adapte aux marges left/right */
    border-radius: 0 0 4px 4px;
    /* Petits arrondis en bas de la barre pour le style */
}

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

@media (max-width: 480px) {
    .login-page {
        padding: 1rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-logo {
        width: 110px;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .login-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .login-footer .separator {
        display: none;
    }

    .login-modal__content {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

/* Animation réduite si préférence utilisateur */
@media (prefers-reduced-motion: reduce) {

    .login-card,
    .login-modal__content,
    .login-modal__success-icon,
    .login-modal__success-icon svg {
        animation: none;
    }

    .login-card::before {
        animation: none;
        background: linear-gradient(90deg, var(--accent-primary), #8b5cf6);
    }

    .login-page::after,
    .login-card::after {
        animation: none;
    }
}