/* ============================================================
   CNIC Face Verification – Styles
   ============================================================ */

/* ── Utility ── */
.cnicv-hidden-field-row { display: none !important; }
.cnicv-submit-disabled  { opacity: 0.5; cursor: not-allowed !important; }

/* ── Wrapper ── */
.cnicv-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 16px 0 24px;
    color: #1f2937;
}

/* ── Status bar ── */
.cnicv-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: background 0.3s;
}
.cnicv-status-icon { font-size: 18px; flex-shrink: 0; }

/* ── CNIC preview ── */
.cnicv-cnic-preview {
    position: relative;
    display: inline-block;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.cnicv-cnic-preview img {
    display: block;
    max-width: 320px;
    max-height: 200px;
    width: 100%;
    height: auto;
}
.cnicv-cnic-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(4px);
}

/* ── Camera container ── */
.cnicv-cam-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    border-radius: 14px;
    overflow: hidden;
    background: #111827;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    margin-bottom: 14px;
    aspect-ratio: 4/3;
}

#cnicv-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);   /* mirror for selfie feel */
    display: block;
}

#cnicv-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1);   /* mirror to match video */
}

/* ── Direction arrows ── */
.cnicv-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 42px;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 0 12px rgba(0,0,0,0.6);
    animation: cnicv-pulse 0.9s ease-in-out infinite alternate;
    pointer-events: none;
    user-select: none;
}
.cnicv-arrow-left  { left:  10px; }
.cnicv-arrow-right { right: 10px; }

@keyframes cnicv-pulse {
    from { opacity: 0.4; transform: translateY(-50%) scale(0.95); }
    to   { opacity: 1.0; transform: translateY(-50%) scale(1.05); }
}

/* ── Instruction label ── */
.cnicv-instruction {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.55);
    color: #fff;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    pointer-events: none;
    line-height: 1.4;
}
.cnicv-instruction strong { display: block; font-size: 11px; opacity: 0.7; }

/* ── Timer ring ── */
.cnicv-timer {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    pointer-events: none;
}
.cnicv-timer-svg {
    width: 44px;
    height: 44px;
    transform: rotate(-90deg);
}
.cnicv-timer-track {
    fill: none;
    stroke: rgba(255,255,255,0.15);
    stroke-width: 4;
}
.cnicv-timer-progress {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 113.1;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s linear, stroke 0.4s;
}
.cnicv-timer-progress.green  { stroke: #22c55e; }
.cnicv-timer-progress.orange { stroke: #f59e0b; }
.cnicv-timer-progress.red    { stroke: #ef4444; }

.cnicv-timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

/* ── Step indicators ── */
.cnicv-steps {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.cnicv-step {
    flex: 1;
    min-width: 80px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    text-align: center;
    font-size: 13px;
    position: relative;
    transition: border-color 0.25s, background 0.25s;
}
.cnicv-step-icon  { font-size: 22px; margin-bottom: 4px; }
.cnicv-step-label { color: #6b7280; line-height: 1.2; }
.cnicv-step-check {
    display: none;
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 12px;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.cnicv-step.active {
    border-color: #3b82f6;
    background: #eff6ff;
}
.cnicv-step.active .cnicv-step-icon {
    animation: cnicv-bounce 0.6s ease-in-out infinite alternate;
}
@keyframes cnicv-bounce {
    from { transform: scale(1); }
    to   { transform: scale(1.2); }
}

.cnicv-step.done {
    border-color: #22c55e;
    background: #f0fdf4;
}
.cnicv-step.done .cnicv-step-check { display: flex; }
.cnicv-step.done .cnicv-step-label { color: #16a34a; }

/* ── Start / Retry button ── */
.cnicv-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-bottom: 14px;
}
.cnicv-btn:hover  { background: #1d4ed8; transform: translateY(-1px); }
.cnicv-btn:active { transform: translateY(0); }

/* ── Result card ── */
.cnicv-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 24px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 12px;
    animation: cnicv-fadein 0.4s ease;
}
@keyframes cnicv-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cnicv-result.pass { background: #f0fdf4; border: 2px solid #22c55e; }
.cnicv-result.fail { background: #fef2f2; border: 2px solid #ef4444; }

.cnicv-result-icon  { font-size: 36px; }
.cnicv-result-msg   { font-size: 16px; font-weight: 600; }
.cnicv-result-score { font-size: 13px; color: #6b7280; }

.cnicv-result.pass .cnicv-result-msg  { color: #15803d; }
.cnicv-result.fail .cnicv-result-msg  { color: #b91c1c; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .cnicv-cam-container { max-width: 100%; }
    .cnicv-cnic-preview img { max-width: 100%; }
    .cnicv-steps { gap: 6px; }
    .cnicv-step  { min-width: 70px; padding: 8px 4px; font-size: 11px; }
    .cnicv-step-icon { font-size: 18px; }
    .cnicv-btn { width: 100%; justify-content: center; }
}
