.kyc-verification-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kyc-verification-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.kyc-step {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.kyc-step h3 {
    color: #2196F3;
    margin-bottom: 15px;
    font-size: 20px;
}

/* Photo Capture Sections */
.photo-capture-section {
    margin: 30px 0;
    padding: 25px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #2196F3;
}

.photo-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

.photo-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #2196F3;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
}

.photo-instruction {
    color: #666;
    font-size: 16px;
    margin-bottom: 20px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 5px;
    text-align: center;
}

.webcam-container {
    margin: 20px auto;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.webcam-container video {
    max-width: 100%;
    width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.camera-status {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 10;
}

.camera-status.success {
    background: #4CAF50;
    color: white;
}

.camera-error {
    padding: 20px;
    background: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
    color: #c62828;
    font-weight: bold;
    text-align: center;
}

.photo-preview {
    margin-top: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.captured-photo {
    max-width: 400px;
    width: 100%;
    border: 3px solid #4CAF50;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.capture-success {
    color: #4CAF50;
    font-weight: bold;
    margin: 10px 0;
    font-size: 16px;
}

/* Photos Summary */
.photos-summary {
    margin: 30px 0;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.summary-item {
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.summary-item p {
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.summary-item img {
    width: 100%;
    max-width: 250px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.kyc-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    margin-top: 15px;
}

.kyc-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.kyc-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.capture-btn {
    margin: 15px auto;
    display: block;
}

.retake-btn {
    background: #ff9800;
}

.retake-btn:hover {
    background: #f57c00;
}

.next-photo-btn {
    background: #2196F3;
}

.next-photo-btn:hover {
    background: #1976D2;
}

.document-upload {
    margin: 20px 0;
}

#id-document {
    display: none;
}

.upload-label {
    display: inline-block;
    padding: 12px 30px;
    background: #2196F3;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-label:hover {
    background: #0b7dda;
}

#document-preview {
    margin-top: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.document-photo {
    max-width: 300px;
    border: 2px solid #2196F3;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.kyc-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2196F3;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.kyc-loader p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

.verification-success {
    text-align: center;
    padding: 30px;
    background: #e8f5e9;
    border: 2px solid #4CAF50;
    border-radius: 8px;
}

.success-icon {
    font-size: 60px;
    color: #4CAF50;
    margin-bottom: 15px;
}

.verification-success h3 {
    color: #2e7d32;
    margin-bottom: 10px;
}

.verification-success p {
    color: #333;
    font-size: 16px;
    margin: 10px 0;
}

#countdown {
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.verification-failed {
    text-align: center;
    padding: 30px;
    background: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
}

.failed-icon {
    font-size: 60px;
    color: #f44336;
    margin-bottom: 15px;
}

.verification-failed h3 {
    color: #c62828;
    margin-bottom: 10px;
}

.verification-failed p {
    color: #333;
    font-size: 16px;
    margin: 10px 0;
}

#retry-btn {
    background: #f44336;
    margin-top: 20px;
}

#retry-btn:hover {
    background: #da190b;
}

/* Responsive */
@media (max-width: 768px) {
    .kyc-verification-container {
        padding: 20px;
        margin: 20px;
    }
    
    .kyc-verification-container h2 {
        font-size: 24px;
    }
    
    .photo-capture-section {
        padding: 15px;
    }
    
    .photo-section-title {
        font-size: 18px;
    }
    
    .photo-number {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .captured-photo,
    .document-photo,
    .summary-item img {
        max-width: 100% !important;
    }
    
    .kyc-btn {
        width: 100%;
        margin: 10px 0;
    }
}


/* ══════════════════════════════════════════════════════════════════
   LIVENESS CHALLENGE  –  Clignement & Rotation de tête
   Moteur : face-api.js  |  Détection 100% automatique
   ══════════════════════════════════════════════════════════════════ */

.liveness-panel {
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px 24px;
    box-shadow: 0 4px 18px rgba(0,0,0,.1);
    margin: 24px 0;
    animation: fadeIn 0.4s ease;
}

.liveness-title {
    text-align: center;
    color: #1a1a2e;
    font-size: 22px;
    margin-bottom: 6px;
}

.liveness-subtitle {
    text-align: center;
    color: #666;
    font-size: 15px;
    margin-bottom: 22px;
}

/* ── Progress steps ────────────────────────────────────────────── */
.liveness-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.liveness-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    border-radius: 10px;
    background: #f0f4f8;
    border: 2px solid #dde3ea;
    opacity: 0.5;
    transition: all 0.4s ease;
    min-width: 110px;
}
.liveness-progress-step .lp-icon  { font-size: 24px; }
.liveness-progress-step .lp-label { font-size: 12px; color: #555; font-weight: 600; }

.liveness-progress-step.active {
    opacity: 1;
    background: #e3f2fd;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33,150,243,.2);
}
.liveness-progress-step.done {
    opacity: 1;
    background: #e8f5e9;
    border-color: #4CAF50;
}

.liveness-progress-arrow { font-size: 20px; color: #bbb; font-weight: bold; }

/* ── Instruction box ───────────────────────────────────────────── */
.liveness-instruction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 16px;
    color: #333;
    margin-bottom: 16px;
    text-align: center;
}
.liveness-instruction span:first-child { font-size: 30px; }

.liveness-instruction.blink-anim  { background: #e3f2fd; border: 2px solid #2196F3; }
.liveness-instruction.turn-anim   { background: #fff3e0; border: 2px solid #ff9800; }
.liveness-instruction.success-anim {
    background: #e8f5e9;
    border: 2px solid #4CAF50;
    animation: pulse-green 1s ease 2;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0   rgba(76,175,80,.4); }
    50%       { box-shadow: 0 0 0 10px rgba(76,175,80,0); }
}

/* ── Indicateur de rotation de tête ───────────────────────────── */
.turn-indicator {
    margin: 0 auto 16px;
    max-width: 420px;
    padding: 14px 18px;
    background: #fff8e1;
    border: 2px solid #ffb300;
    border-radius: 10px;
}

.turn-track {
    display: flex;
    align-items: center;
    gap: 10px;
}

.turn-label-right,
.turn-label-left {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    white-space: nowrap;
    min-width: 38px;
}
.turn-label-right { text-align: right; }
.turn-label-left  { text-align: left; }

.turn-bar-wrap {
    flex: 1;
    position: relative;
    height: 14px;
    background: #e0e0e0;
    border-radius: 7px;
    overflow: hidden;
    display: flex;
}

/* Moitié droite / moitié gauche — chacune coloriée indépendamment */
.turn-bar-right,
.turn-bar-left {
    flex: 1;
    height: 100%;
    background: #e0e0e0;
    transition: background 0.2s;
}
.turn-bar-right { border-radius: 7px 0 0 7px; }
.turn-bar-left  { border-radius: 0 7px 7px 0; }

/* Aiguille centrale */
.turn-needle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: #1a1a2e;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
    transition: left 0.08s linear;
    z-index: 2;
}

.turn-phase-label {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #e65100;
    margin-top: 8px;
}

/* ── Conteneur vidéo + canvas overlay ─────────────────────────── */
.liveness-video-wrap {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    /* ratio 4:3 */
    aspect-ratio: 4 / 3;
}

#liveness-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transform: scaleX(-1); /* miroir */
}

/* Canvas des landmarks dessiné par-dessus la vidéo */
.liveness-overlay-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Le canvas est en coordonnées natives — on le scale via CSS */
    transform: scaleX(-1); /* même miroir que la vidéo */
}

/* Message overlay centré */
#liveness-overlay-msg {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}
.liveness-overlay-warning {
    display: inline-block;
    background: rgba(230,81,0,.85);
    color: #fff;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ── Barre de feedback clignement ─────────────────────────────── */
.liveness-blink-bar-wrap {
    max-width: 500px;
    margin: 0 auto 14px;
    padding: 12px 16px;
    background: #f9fbe7;
    border: 2px solid #c5e1a5;
    border-radius: 10px;
}

.liveness-bbl-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.liveness-blink-phase-txt {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
}

.liveness-bbl-track {
    position: relative;
    height: 16px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.liveness-bbl-fill {
    height: 100%;
    width: 100%;
    background: #4CAF50;
    border-radius: 8px;
    transition: width 0.05s linear, background 0.2s;
    /* Dégradé de gauche (fermé=rouge) à droite (ouvert=vert) */
    background: linear-gradient(to right, #f44336, #4CAF50);
    background-size: 200% 100%;
}

.liveness-bbl-marker {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(0,0,0,.25);
    z-index: 2;
}

/* ── Barre de statut ───────────────────────────────────────────── */
.liveness-status {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    min-height: 30px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.3s;
}
.liveness-status-success { color: #2e7d32; background: #f1f8f1; }
.liveness-status-warning { color: #e65100; background: #fff8f0; }
.liveness-status-error   { color: #c62828; background: #fff0f0; }
.liveness-status-info    { color: #1565c0; background: #f0f4ff; }

/* ── Barre EAR debug (cachée par défaut) ───────────────────────── */
.liveness-ear-bar {
    font-family: monospace;
    font-size: 12px;
    color: #555;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px auto;
    max-width: 500px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .liveness-progress { gap: 4px; }
    .liveness-progress-step { min-width: 80px; padding: 8px 10px; }
    .liveness-progress-step .lp-label { font-size: 10px; }
    .liveness-title { font-size: 18px; }
    .liveness-instruction { font-size: 14px; }
    .turn-indicator { padding: 10px 12px; }
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.photo-capture-section,
.photos-summary {
    animation: fadeIn 0.5s ease-in-out;
}

/* ── Sélecteur type de document ───────────────────────────────────────────── */
.doc-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 4px;
}

.doc-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
    position: relative;
    text-align: center;
    user-select: none;
}

.doc-type-card:hover {
    border-color: #2196F3;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33,150,243,.15);
}

.doc-type-card.selected {
    border-color: #1976D2;
    background: #e3f2fd;
    box-shadow: 0 4px 14px rgba(25,118,210,.2);
}

.doc-type-icon {
    font-size: 30px;
    line-height: 1;
}

.doc-type-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.doc-type-check {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    background: #1976D2;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
}

.doc-type-card.selected .doc-type-check {
    display: flex;
}

/* Instructions document */
.doc-instructions {
    background: #fffde7;
    border: 1px solid #fff176;
    border-left: 4px solid #f9a825;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.doc-instructions ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.doc-instructions ul li {
    font-size: 13px;
    color: #555;
    padding: 3px 0;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .doc-type-grid { grid-template-columns: 1fr; }
}
