/* Reset et configuration de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Dégradés */
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* Mode sombre */
body.dark-mode {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --background: #111827;
    --white: #1f2937;
    --border-color: #374151;
    --gradient-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-bottom: 80px;
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

/* Contrôles (thème et langue) */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: translateY(0);
}

.lang-text {
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}

/* Animation de l'arrière-plan */
.background-animation {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    top: -250px;
    left: -250px;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    bottom: -200px;
    right: -200px;
    animation-delay: 7s;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 14s;
}

body.dark-mode .shape-1 {
    background: linear-gradient(135deg, #312e81, #1e1b4b);
}

body.dark-mode .shape-2 {
    background: linear-gradient(135deg, #7c2d12, #991b1b);
}

body.dark-mode .shape-3 {
    background: linear-gradient(135deg, #0c4a6e, #164e63);
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Container */
.container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

/* Boxes de formulaire */
.login-box, .register-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 48px 40px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease, border 0.3s ease;
}

body.dark-mode .login-box,
body.dark-mode .register-box {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 36px;
}

.logo {
    margin-bottom: 20px;
}

.logo img {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05) rotate(5deg);
}

.logo svg {
    color: var(--primary-color);
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.3));
}

.header h1 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    transition: color 0.3s ease;
}

/* Input groups */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.input-group label svg {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    background: var(--white);
    color: var(--text-primary);
}

body.dark-mode .input-group input {
    background: #374151;
    border-color: #4b5563;
}

.input-group input::placeholder {
    color: #9ca3af;
}

body.dark-mode .input-group input::placeholder {
    color: #6b7280;
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.input-group input:hover:not(:focus) {
    border-color: #d1d5db;
}

body.dark-mode .input-group input:hover:not(:focus) {
    border-color: #6b7280;
}

/* Buttons */
.button-group {
    margin-top: 32px;
}

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

body.dark-mode .btn-primary {
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary svg {
    transition: transform 0.3s ease;
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

/* Form footer */
.form-footer {
    margin-top: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.btn-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.separator {
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

/* Messages */
.message {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background-color: #d1fae5;
    color: #065f46;
    border-color: var(--success-color);
}

body.dark-mode .message.success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: var(--error-color);
}

body.dark-mode .message.error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Footer fixe */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    z-index: 50;
    transition: background 0.3s ease, border 0.3s ease;
}

body.dark-mode .footer {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 400;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.footer-content strong {
    font-weight: 700;
    color: white;
}

/* Responsive */
@media (max-width: 480px) {
    .controls {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    .control-btn {
        width: 42px;
        height: 42px;
        font-size: 12px;
    }

    .login-box, .register-box {
        padding: 36px 28px;
    }

    .header h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 14px;
    }

    .logo img {
        width: 64px;
        height: 64px;
    }

    .form-footer {
        flex-direction: column;
        gap: 8px;
    }

    .separator {
        display: none;
    }

    .footer-content p {
        font-size: 12px;
    }

    body {
        padding-bottom: 70px;
    }
}

/* Animations supplémentaires */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Amélioration de l'accessibilité */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* États de chargement */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

body.dark-mode .btn.loading::after {
    border-top-color: #ffffff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
