/* ============================================
   RESET ET VARIABLES GLOBALES
   ============================================ */
:root {
    --primary-color: #00d4ff;
    --primary-dark: #0099cc;
    --secondary-color: #ff006e;
    --background-dark: #0a0e1a;
    --background-darker: #050609;
    --text-light: #e0e6f0;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    
    --transition-short: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-long: 0.5s ease;
    
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   ANIMATIONS KEYFRAMES
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes gradientShift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, 30px) scale(1.1);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Fond animé */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(135deg, var(--background-darker) 0%, #0f1220 50%, var(--background-dark) 100%);
    overflow: hidden;
}

.gradient-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.circle-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--primary-color), #00a8cc);
    top: -100px;
    right: -100px;
    animation: gradientShift 15s ease-in-out infinite;
}

.circle-2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, var(--secondary-color), #ff4081);
    bottom: -50px;
    left: -50px;
    animation: gradientShift 20s ease-in-out infinite reverse;
}

.circle-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    top: 50%;
    left: 50%;
    animation: gradientShift 18s ease-in-out infinite;
}

/* Wrapper central */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.8s ease;
}

/* Boîte de connexion */
.login-box {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 60px rgba(0, 212, 255, 0.05);
    transition: var(--transition-medium);
}

.login-box:hover {
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
                0 0 80px rgba(0, 212, 255, 0.1);
}

/* ============================================
   EN-TÊTE DU FORMULAIRE
   ============================================ */
.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: slideInDown 0.6s ease;
}

.logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), #0099cc);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
    animation: float 3s ease-in-out infinite;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--text-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ============================================
   FORMULAIRE
   ============================================ */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    display: block;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: var(--transition-short);
}

.form-group input,
.form-group input:focus ~ .input-icon {
    color: var(--primary-color);
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.8rem;
    background: rgba(30, 41, 59, 0.5);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-size: 0.95rem;
    transition: var(--transition-short);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--primary-color);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: var(--error-color);
}

.form-group input:invalid:not(:placeholder-shown):focus {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

/* Toggle password button */
.toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-short);
}

.toggle-password:hover {
    color: var(--primary-color);
}

.toggle-password:active {
    transform: scale(0.95);
}

/* Messages d'erreur */
.error-message {
    font-size: 0.8rem;
    color: var(--error-color);
    display: none;
    animation: slideInDown 0.3s ease;
}

.error-message.show {
    display: block;
}

.error-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-color);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    animation: slideInDown 0.3s ease;
}

/* Messages d'erreur de champ (inline) */
.field-error {
    display: block;
    color: var(--error-color);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding-left: 0.25rem;
    animation: slideInDown 0.2s ease;
}

/* Messages de succès */
.success-alert {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-color);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    animation: slideInDown 0.3s ease;
    margin-top: 0.75rem;
}

/* ============================================
   OPTIONS DE FORMULAIRE
   ============================================ */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-short);
    font-weight: 500;
}

.forgot-password:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   BOUTON DE SOUMISSION
   ============================================ */
.login-button {
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), #0099cc);
    color: var(--background-dark);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-short);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.login-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: var(--transition-short);
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 212, 255, 0.4);
}

.login-button:hover::before {
    left: 100%;
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-text {
    transition: var(--transition-short);
}

.button-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    stroke: currentColor;
}

/* ============================================
   LIEN D'INSCRIPTION
   ============================================ */
.signup-link {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-short);
}

.signup-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   DIVIDER
   ============================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* ============================================
   AUTHENTIFICATION SOCIALE
   ============================================ */
.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.social-button {
    padding: 0.875rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-short);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
}

.social-button:hover {
    border-color: var(--primary-color);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
    transform: translateY(-2px);
}

.social-button svg {
    transition: var(--transition-short);
}

.social-button:hover svg {
    transform: scale(1.1);
}

/* ============================================
   INFORMATIONS DE SÉCURITÉ
   ============================================ */
.security-info {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.security-info p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.security-info svg {
    width: 16px;
    height: 16px;
    color: var(--success-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 480px) {
    .login-box {
        padding: 1.5rem 1.25rem;
    }

    .login-header {
        margin-bottom: 2rem;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    .logo {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .form-group {
        gap: 0.35rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-group input {
        font-size: 16px;
    }

    .social-login {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .security-info {
        margin-top: 1.5rem;
    }
}

@media (max-width: 768px) {
    .login-wrapper {
        max-width: 100%;
    }

    .circle-1 {
        width: 200px;
        height: 200px;
    }

    .circle-2 {
        width: 150px;
        height: 150px;
    }

    .circle-3 {
        width: 120px;
        height: 120px;
    }
}

/* ============================================
   MODE SOMBRE/CLAIR (préférence utilisateur)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   ACCESSIBILITÉ ET FOCUS VISIBLE
   ============================================ */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   IMPRESSION
   ============================================ */
@media print {
    .login-container {
        min-height: auto;
    }
    
    .animated-background {
        display: none;
    }
}
