/* ============================================================
   ONDD - STYLES OFFICIELS DE LA PAGE DE CONNEXION
   Charte: Bleu ONDD (#0F4C81), Vert ONDD (#78B82A), Drapeau Mali
   ============================================================ */

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

:root {
    /* Palette ONDD */
    --ondd-blue: #0f4c81;
    --ondd-blue-dark: #0a3356;
    --ondd-green: #78b82a;
    --ondd-green-hover: #65a121;
    --ondd-green-soft: rgba(120, 184, 42, 0.12);

    /* Textes & Fonds */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-primary: #f4f6f9;
    --bg-card: #ffffff;

    /* États */
    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --warning: #b45309;
    --warning-bg: #fffbe0;
    --warning-border: #fef08a;

    /* Shadows & Transitions */
    --shadow-md: 0 4px 20px -2px rgba(15, 76, 129, 0.08);
    --shadow-lg: 0 10px 30px -5px rgba(15, 76, 129, 0.15);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== CONTAINER PRINCIPAL ===== */
.login-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ===== SECTION CAROUSEL (GAUCHE) ===== */
.carousel-section {
    flex: 1.2;
    position: relative;
    overflow: hidden;
    background: var(--ondd-blue-dark);
}

/* Liseré Drapeau du Mali au sommet du carrousel */
.mali-flag-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    display: flex;
    z-index: 20;
}

.stripe-green { flex: 1; background-color: #10B981; }
.stripe-yellow { flex: 1; background-color: #F59E0B; }
.stripe-red { flex: 1; background-color: #EF4444; }

.carousel {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    will-change: opacity;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10, 51, 86, 0.75) 0%, rgba(15, 76, 129, 0.85) 100%);
}

.carousel-overlay-content {
    position: absolute;
    bottom: 80px;
    left: 60px;
    right: 60px;
    z-index: 10;
    color: white;
    max-width: 540px;
}

.carousel-badge-mali {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.carousel-badge-mali img {
    height: 18px;
    width: auto;
    border-radius: 3px;
}

.carousel-badge-mali span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.carousel-overlay-content h2 {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.carousel-overlay-content p {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.9;
}

/* Flèches de navigation */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.carousel-arrow:hover {
    background: var(--ondd-green);
    border-color: var(--ondd-green);
}

.carousel-prev { left: 24px; }
.carousel-next { right: 24px; }

/* Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 36px;
    left: 60px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: var(--transition);
}

.indicator.active {
    background: var(--ondd-green);
    width: 24px;
    border-radius: 4px;
}

/* ===== SECTION FORMULAIRE (DROITE) ===== */
.form-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-primary);
    overflow-y: auto;
}

.form-wrapper {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Liseré supérieur Drapeau du Mali sur le formulaire */
.mali-border-top {
    display: flex;
    height: 5px;
    width: 100%;
    position: absolute;
    top: 0; left: 0; right: 0;
}

.mali-border-top .b-green { flex: 1; background-color: #10B981; }
.mali-border-top .b-yellow { flex: 1; background-color: #F59E0B; }
.mali-border-top .b-red { flex: 1; background-color: #EF4444; }

/* Logo ONDD */
.login-logo {
    text-align: center;
    margin-bottom: 24px;
    margin-top: 8px;
}

.ondd-logo-img {
    height: 54px;
    width: auto;
    object-fit: contain;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

/* Blocage Rate Limiting */
.block-timer {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--error);
}

.block-timer-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.block-timer-title {
    font-size: 14px;
    font-weight: 700;
}

.block-timer-countdown {
    font-weight: 800;
    color: var(--error);
}

/* Vérification 2FA (OTP) */
.otp-step {
    background: rgba(15, 76, 129, 0.07);
    border: 1px solid rgba(15, 76, 129, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--ondd-blue-dark);
}

.otp-icon {
    font-size: 28px;
    margin-bottom: 6px;
    color: var(--ondd-blue);
}

.otp-title {
    font-size: 14px;
    font-weight: 700;
}

.otp-subtitle {
    font-size: 13px;
    margin-top: 4px;
    color: var(--text-secondary, #64748b);
}

.otp-input {
    letter-spacing: 4px;
    font-weight: 700;
    text-align: center;
}

.otp-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 13px;
}

.otp-resend {
    background: none;
    border: none;
    padding: 0;
    color: var(--ondd-blue);
    font-weight: 600;
    cursor: pointer;
}

.otp-resend:disabled {
    color: var(--text-secondary, #94a3b8);
    cursor: not-allowed;
}

.otp-back-link {
    color: var(--text-secondary, #64748b);
    text-decoration: none;
}

.otp-back-link:hover {
    text-decoration: underline;
}

/* Tentatives restreintes */
.attempts-info {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Form inputs */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 2;
}

.form-input {
    width: 100%;
    padding: 12px 42px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
    font-family: inherit;
    font-weight: 500;
}

.form-input:focus {
    border-color: var(--ondd-blue);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.1);
}

.form-input.error {
    border-color: var(--error);
    background: var(--error-bg);
}

.input-error {
    color: var(--error);
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    min-height: 18px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

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

/* Options (Remember / Forgot) */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 13px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    accent-color: var(--ondd-blue);
    width: 16px;
    height: 16px;
}

.forgot-password {
    color: var(--ondd-blue);
    text-decoration: none;
    font-weight: 700;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Bouton Se Connecter */
.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--ondd-blue) 0%, var(--ondd-blue-dark) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 76, 129, 0.35);
}

.login-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* Barre de progression */
.login-progress {
    width: 100%;
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
    display: none;
}

.login-progress-bar {
    height: 100%;
    background: var(--ondd-green);
    width: 0%;
    transition: width 0.3s ease;
}

.login-progress-bar.active {
    animation: progressFill 10s linear forwards;
}

@keyframes progressFill {
    0% { width: 0%; }
    50% { width: 60%; }
    100% { width: 95%; }
}

/* Alertes Messages */
.messages {
    margin-bottom: 16px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); }
.alert-success { background: rgba(120, 184, 42, 0.15); color: #4d8216; border: 1px solid rgba(120, 184, 42, 0.3); }

.forgot-success-view {
    text-align: center;
    padding: 10px 6px 4px;
}
.forgot-success-icon {
    font-size: 42px;
    color: #78b82a;
    margin-bottom: 14px;
    display: block;
}
.forgot-success-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary, #1e293b);
    margin: 0 0 8px;
}
.forgot-success-hint {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    margin: 0;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    margin-left: auto;
    font-size: 12px;
}

/* Footer Partenaires / Armoiries Mali */
.partner-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.partner-logo img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-ondd-small {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.logo-sim { font-size: 14px; font-weight: 800; color: var(--ondd-blue); letter-spacing: 1px; }
.logo-2063 { font-size: 16px; font-weight: 800; color: var(--ondd-green); }

/* MODAL FORGOT PASSWORD */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 440px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--ondd-blue);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header h3 i { color: var(--ondd-green); }

.modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
}

.modal-body { padding: 20px; font-size: 13px; color: var(--text-secondary); }
.modal-footer {
    padding: 14px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--ondd-blue); color: white; }
.btn-secondary { background: white; color: var(--text-primary); border: 1px solid var(--border-color); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .carousel-section { display: none !important; }
    .form-section { padding: 20px; }
    .form-wrapper { box-shadow: none; padding: 24px 16px; border: none; }
}