/* Variables CSS pour l'authentification */
:root {
    --auth-primary: #2E8B57;
    --auth-primary-dark: #1f6b47;
    --auth-secondary: #FF6B35;
    --auth-accent: #4ECDC4;
    --auth-background: #F7FAFC;
    --auth-white: #FFFFFF;
    --auth-text-dark: #2D3748;
    --auth-text-light: #718096;
    --auth-border: #E2E8F0;
    --auth-success: #38A169;
    --auth-danger: #E53E3E;
    --auth-warning: #DD6B20;
}

/* Reset et base pour l'authentification */
.auth-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-accent) 100%);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/auth-bg-pattern.svg') no-repeat center center;
    background-size: cover;
    opacity: 0.1;
}

/* Carte d'authentification */
.auth-card {
    background: var(--auth-white);
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    margin: 2rem auto;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--auth-text-dark);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-senegal {
    color: var(--auth-primary);
    -webkit-text-fill-color: var(--auth-primary);
}

.auth-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: var(--auth-text-dark);
    font-weight: 700;
}

.auth-header p {
    color: var(--auth-text-light);
    font-size: 1.1rem;
}

/* Formulaire d'authentification */
.auth-form {
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

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

/* CORRECTION : Ajustement du padding pour contenir les champs */
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--auth-white);
    color: var(--auth-text-dark);
    box-sizing: border-box; /* Ajout important */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.1);
    transform: translateY(-2px);
}

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

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-text-light);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

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

/* Options du formulaire */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--auth-text-dark);
}

.checkbox input {
    margin: 0;
    width: auto;
}

.forgot-password {
    color: var(--auth-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

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

/* Boutons */
.btn-block {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
    color: var(--auth-white);
    box-shadow: 0 4px 15px rgba(46, 139, 87, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 139, 87, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.btn:disabled .btn-text {
    opacity: 0;
}

.btn:disabled .btn-loading {
    display: block;
}

/* Sélection du rôle */
.role-selection {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(46, 139, 87, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(46, 139, 87, 0.1);
}

.role-selection label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--auth-text-dark);
}

.role-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.role-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--auth-border);
    background: var(--auth-white);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    font-weight: 500;
    color: var(--auth-text-light);
}

.role-btn.active {
    border-color: var(--auth-primary);
    background: var(--auth-primary);
    color: var(--auth-white);
    box-shadow: 0 4px 15px rgba(46, 139, 87, 0.2);
}

.role-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.role-option input {
    display: none;
}

.role-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    margin: 0;
    background: var(--auth-white);
}

.role-option input:checked + label {
    border-color: var(--auth-primary);
    background: linear-gradient(135deg, rgba(46, 139, 87, 0.1), rgba(78, 205, 196, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 139, 87, 0.15);
}

.role-option i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--auth-primary);
}

.role-option input:checked + label i {
    color: var(--auth-primary);
}

/* Champs spécifiques au rôle */
.role-fields {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(46, 139, 87, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(46, 139, 87, 0.1);
    animation: slideDown 0.3s ease;
}

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

/* Force du mot de passe */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 6px;
    background: var(--auth-border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.strength-bar::before {
    content: '';
    display: block;
    height: 100%;
    width: var(--strength-width, 0%);
    background: var(--strength-color, var(--auth-danger));
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Pied de page de l'authentification */
.auth-footer {
    text-align: center;
    border-top: 1px solid var(--auth-border);
    padding-top: 1.5rem;
    color: var(--auth-text-light);
}

.auth-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

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

/* Image d'authentification */
.auth-image {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.auth-image img {
    max-width: 80%;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.1));
    animation: float 6s ease-in-out infinite;
}

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

/* Messages */
.message {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
    text-align: center;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

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

.message.success {
    background: #C6F6D5;
    color: #22543D;
    border: 1px solid #9AE6B4;
}

.message.error {
    background: #FED7D7;
    color: #742A2A;
    border: 1px solid #FEB2B2;
}

/* Responsive */
@media (max-width: 1024px) {
    .auth-container {
        grid-template-columns: 1fr;
    }
    
    .auth-image {
        display: none;
    }
    
    .auth-card {
        margin: 1rem auto;
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
        width: auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .role-options {
        grid-template-columns: 1fr;
    }
    
    .role-buttons {
        flex-direction: column;
    }
    
    .auth-header h1 {
        font-size: 1.8rem;
    }
    
    .auth-header p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.875rem 0.875rem 0.875rem 2.5rem;
    }
    
    .input-icon {
        left: 0.875rem;
    }
}