/**
 * Стили для распознавания лиц
 */

/* Registration Overlay */
.face-registration-overlay,
.face-auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.face-reg-container,
.face-auth-container {
    background: #fff;
    border-radius: 24px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.face-reg-header,
.face-auth-header {
    text-align: center;
    margin-bottom: 20px;
}

.face-reg-header h2,
.face-auth-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 8px 0;
}

.face-reg-header p,
.face-auth-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Video Container */
.face-reg-video-container,
.face-auth-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}

.face-reg-video-container video,
.face-auth-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Зеркальное отображение для естественного вида */
}

.face-reg-video-container canvas,
.face-auth-video-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* Canvas тоже зеркально */
}

/* Face ID progress ring */
.face-id-progress-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(78%, 320px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    pointer-events: none;
    filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.55));
}

.face-id-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.face-id-ring-bg,
.face-id-ring-fill {
    fill: none;
    stroke-width: 5;
}

.face-id-ring-bg {
    stroke: rgba(255, 255, 255, 0.22);
}

.face-id-ring-fill {
    stroke: #22c55e;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 0.35s ease;
}

.face-id-percent {
    position: absolute;
    left: 50%;
    bottom: -34px;
    transform: translateX(-50%);
    color: #d1fae5;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(34, 197, 94, 0.7);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 18px;
    font-weight: 800;
}

.face-id-scan-container::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.22);
    clip-path: circle(39% at 50% 50%);
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
}

/* Scanning Animation */
.face-auth-scanning {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #006b3e, transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

/* Instruction */
.face-reg-instruction {
    background: linear-gradient(135deg, #006b3e, #008a4f);
    color: #fff;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.instruction-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.instruction-text {
    font-size: 16px;
    font-weight: 600;
}

/* Progress Steps */
.face-reg-progress {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.progress-step {
    text-align: center;
    padding: 12px 8px;
    background: #f3f4f6;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: linear-gradient(135deg, #006b3e, #008a4f);
    color: #fff;
    transform: scale(1.05);
}

.progress-step.completed {
    background: #d1fae5;
    color: #065f46;
}

.progress-step.completed .step-icon::after {
    content: ' ✓';
}

.step-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.step-label {
    font-size: 11px;
    font-weight: 600;
}

/* Auth Status */
.face-auth-status {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    padding: 16px;
    background: #f3f4f6;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* Cancel Buttons */
.face-reg-cancel,
.face-auth-cancel {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.face-reg-cancel:hover,
.face-auth-cancel:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.face-reg-cancel:active,
.face-auth-cancel:active {
    transform: scale(0.98);
}

/* Responsive */
@media (max-width: 480px) {
    .face-reg-container,
    .face-auth-container {
        padding: 20px;
    }

    .face-reg-overlay-circle {
        width: 200px;
        height: 200px;
    }

    .face-reg-progress {
        grid-template-columns: repeat(2, 1fr);
    }

    .instruction-icon {
        font-size: 36px;
    }

    .instruction-text {
        font-size: 14px;
    }
}

/* iOS safe-area */
@supports (padding: max(0px)) {
    .face-registration-overlay,
    .face-auth-overlay {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
