:root {
    --primary: #FF7A00;
    --primary-dark: #FF8000;
    --secondary: #FF6584;
    --dark: #2E2E48;
    --light: #F9FAFF;
    --success: #4CC9F0;
    --error: #F72585;
    --warning: #F8961E;
    --gray: #A3A3C2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

body {
    background-color: var(--light);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at 10% 20%, rgba(108, 99, 255, 0.05) 0%, transparent 20%);
}

.form-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(108, 99, 255, 0.15);
    overflow: hidden;
    margin: 2rem;
    animation: fadeIn 0.8s ease-out;
}

.form-hero {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 3rem;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.form-hero::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    top: -100px;
    right: -100px;
}

.form-hero::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    bottom: -50px;
    right: -50px;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white;
}

.hero-logo {
    width: 120px;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.hero-features {
    margin-top: 2rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.feature-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.feature-text h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.feature-text p {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.5;
}

.form-content {
    flex: 1.5;
    padding: 3rem;
    position: relative;
}

.form-header {
    margin-bottom: 2.5rem;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.form-logo {
    height: 50px;
    margin-bottom: 1.5rem;
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.form-subtitle {
    color: var(--gray);
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.progress-container {
    width: 100%;
    margin-bottom: 2.5rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 1.5rem;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: #EDF2F7;
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 2px;
}

.progress-bar {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    transform: translateY(-50%);
    z-index: 2;
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ================ SYSTÈME DE NOTIFICATIONS ================ */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
}

.notification {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    border-left: 6px solid;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.notification.error {
    border-left-color: #F72585;
    background: #fff5f7;
    color: #b5174b;
}

.notification.success {
    border-left-color: #4CC9F0;
    background: #f0fbfe;
    color: #0096c7;
}

.notification.warning {
    border-left-color: #F8961E;
    background: #fff4e5;
    color: #b85e00;
}

.notification.info {
    border-left-color: var(--primary);
    background: #fff2e5;
    color: #b84300;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.notification-close:hover {
    color: #333;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
        display: none;
    }
}

/* ================ GESTION DES ERREURS ================ */
.global-error-container {
    background: rgba(247, 37, 133, 0.1);
    border: 1px solid #F72585;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    color: #b5174b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease;
}

.global-error-container i {
    font-size: 20px;
}

.field-error {
    color: #F72585;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-control.error {
    border-color: #F72585 !important;
    background: #fff5f7 !important;
    box-shadow: 0 0 0 3px rgba(247, 37, 133, 0.1) !important;
}

.form-control.valid {
    border-color: #4CC9F0 !important;
    background: rgba(76, 201, 240, 0.05) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

/* ================ LOADING SPINNER ================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

.submit-btn.loading {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
}

/* ================ SUGGESTION DE CONNEXION ================ */
.login-suggestion {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid #5a67d8;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    color: white;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInUp 0.5s ease;
}

.login-suggestion a {
    background: white;
    color: #667eea;
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
}

.login-suggestion a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

/* ================ ÉTATS D'ERREUR CNI ================ */
.cni-side.error {
    border-color: #F72585 !important;
    background: rgba(247, 37, 133, 0.05) !important;
    animation: shake 0.5s ease;
}

/* ================ ANIMATIONS DE TRANSITION ================ */
@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-step.active {
    animation: stepFadeIn 0.6s ease-out;
}

/* ================ STYLES POUR LES NOTIFICATIONS BIOMÉTRIQUES ================ */
.biometric-status {
    transition: all 0.3s ease;
}

.biometric-status.status-available {
    background: rgba(76, 201, 240, 0.2);
    color: #0096c7;
}

.biometric-status.status-unavailable {
    background: rgba(247, 37, 133, 0.1);
    color: #b5174b;
}

/* ================ AMÉLIORATIONS RESPONSIVE ================ */
@media (max-width: 768px) {
    #notification-container {
        max-width: 90%;
        right: 5%;
        left: 5%;
    }
    
    .notification {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .login-suggestion {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .login-suggestion a {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .notification {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .field-error {
        font-size: 11px;
    }
}

/* ================ STYLES POUR LES CHAMPS VALIDÉS ================ */
.form-group.valid .form-control {
    border-color: var(--success);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234CC9F0'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 20px;
    padding-right: 45px;
}

/* ================ OVERRIDES POUR LES BOUTONS SUCCESS ================ */
.btn-success {
    background: #75b504;
    color: white;
    border: none;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(76, 201, 240, 0.3);
}

.step-indicator {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #EDF2F7;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: var(--gray);
    position: relative;
    z-index: 3;
    transition: all 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.step-indicator.active {
    background: linear-gradient(to bottom right, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 10px 20px rgba(108, 99, 255, 0.3);
    transform: scale(1.1);
}

.step-indicator.completed {
    background: var(--success);
    color: white;
}

.step-label {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--gray);
    white-space: nowrap;
    font-weight: 500;
    transition: all 0.3s ease;
}

.step-indicator.active .step-label,
.step-indicator.completed .step-label {
    color: var(--dark);
    font-weight: 600;
}

.form-step {
    display: none;
    animation: fadeIn 0.6s ease-out forwards;
}

.form-step.active {
    display: block;
}

.form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-group label.required::after {
    content: ' *';
    color: var(--error);
}

.form-control {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid #EDF2F7;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #F9FAFF;
    color: var(--dark);
}

.form-control:focus {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
    outline: none;
}

.form-control.has-error {
    border-color: var(--error);
}

.error-message {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 0.6rem;
    display: none;
    animation: fadeIn 0.3s ease;
}

.input-icon {
    position: absolute;
    right: 18px;
    top: 44px;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-icon:hover {
    color: var(--primary);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
}

.btn {
    padding: 15px 30px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.65, 0, 0.35, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn i {
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.btn:hover i {
    transform: translateX(3px);
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 10px 20px rgba(108, 99, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(108, 99, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(108, 99, 255, 0.05);
    transform: translateY(-2px);
}

.password-strength {
    margin-top: 0.8rem;
}

.strength-meter {
    height: 6px;
    background: #EDF2F7;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.6s ease, background 0.6s ease;
    border-radius: 3px;
}

.strength-text {
    font-size: 0.8rem;
    color: var(--gray);
    font-weight: 500;
}

.file-upload {
    border: 2px dashed #EDF2F7;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #F9FAFF;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.03);
}

.file-upload i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: block;
}

.file-upload p {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

.file-upload .hint {
    font-size: 0.8rem;
    color: var(--gray);
}

.cni-capture-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cni-side {
    border: 2px dashed #EDF2F7;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    background: #F9FAFF;
    transition: all 0.3s ease;
}

.cni-side.active {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.03);
}

.cni-side h3 {
    margin-bottom: 1rem;
    color: var(--dark);
}

.camera-preview {
    width: 100%;
    max-width: 300px;
    height: 200px;
    background: var(--dark);
    border-radius: 8px;
    margin: 0 auto 1rem;
    overflow: hidden;
    position: relative;
}

#cni-video, #cni-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.capture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
}

.captured-image {
    width: 100%;
    max-width: 300px;
    height: 200px;
    border-radius: 8px;
    margin: 0 auto;
    object-fit: cover;
    border: 2px solid var(--success);
    display: none;
}

.biometric-container {
    background: rgba(76, 201, 240, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    text-align: center;
    border: 2px solid var(--success);
}

.biometric-icon {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.biometric-message {
    color: var(--dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

.biometric-hint {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 1.5rem;
}

.biometric-status {
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
}

.status-available {
    background: rgba(76, 201, 240, 0.2);
    color: var(--success);
}

.status-unavailable {
    background: rgba(247, 37, 133, 0.1);
    color: var(--error);
}

.terms-checkbox {
    display: flex;
    align-items: flex-start;
    margin-top: 2rem;
}

.terms-checkbox input {
    margin-right: 12px;
    margin-top: 3px;
    accent-color: var(--primary);
}

.terms-checkbox label {
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

.terms-checkbox a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-link {
    text-align: center;
    margin-top: 2.5rem;
    color: var(--gray);
    font-size: 0.95rem;
}

.login-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.login-link a:hover {
    text-decoration: underline;
}

/* Animation pour les champs valides */
.form-group.valid .form-control {
    border-color: var(--success);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234CC9F0'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 20px;
    padding-right: 45px;
}

/* Responsive */
@media (min-width: 992px) {
    .form-hero {
        display: flex;
    }
}

@media (max-width: 768px) {
    .form-container {
        flex-direction: column;
        margin: 1rem;
        border-radius: 16px;
    }
    
    .form-content {
        padding: 2rem;
    }
    
    .step-label {
        display: none;
    }
    
    .btn {
        padding: 12px 20px;
    }
    
    .cni-capture-container {
        flex-direction: column;
    }
}