/* =========================
   Two-Factor Modern UI (Clean + Responsive)
   - No table/td layout
   - All devices friendly
========================= */

.two-factor,
.two-factor * {
    box-sizing: border-box;
}

.two-factor {
    min-height: 100vh;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
    color: #0f172a;
    background: #eaf0ff;
    position: relative;
    display: grid;
    place-items: center;
    padding: 18px 12px;
    overflow: hidden;
}

/* soft background layer */
.two-factor__bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(1200px 600px at 18% 10%, rgba(61, 101, 251, .18), transparent 60%),
        radial-gradient(900px 500px at 88% 14%, rgba(0, 174, 255, .14), transparent 55%),
        radial-gradient(1100px 650px at 50% 110%, rgba(61, 101, 251, .10), transparent 60%);
}

/* wrapper */
.two-factor__wrap {
    width: 100%;
    display: grid;
    place-items: center;
    position: relative;
    z-index: 1;
}

/* card */
.two-factor__card {
    width: 100%;
    max-width: 980px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(15, 23, 42, .12);
    box-shadow: 0 18px 60px rgba(2, 6, 23, .14);
    backdrop-filter: blur(10px);
    padding: 34px 26px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.two-factor__card:before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 14px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg,
            rgba(61, 101, 251, 0),
            rgba(61, 101, 251, .60),
            rgba(0, 174, 255, .45),
            rgba(61, 101, 251, 0));
    opacity: .45;
}

/* header */
.two-factor__header {
    display: grid;
    gap: 10px;
    place-items: center;
}

.two-factor__icon {
    width: 110px;
    height: 110px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(0, 174, 255, .10);
    border: 1px solid rgba(0, 174, 255, .18);
    box-shadow: 0 10px 30px rgba(2, 6, 23, .10);
    margin-bottom: 4px;
}

.two-factor__icon i.fa {
    font-size: 64px;
    color: #00aeff;
    line-height: 1;
}

.two-factor__title {
    margin: 0;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.two-factor__desc {
    margin: 0;
    max-width: 820px;
    font-size: 18px;
    line-height: 1.7;
    color: rgba(15, 23, 42, .70);
}

/* ===== ACTIONS (responsive grid) ===== */
.two-factor__actions {
    width: 100%;
    max-width: 720px;
    margin: 18px auto 0;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ===== BUTTONS ===== */
.two-factor__btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 40px;
    border-radius: 12px;

    font-size: 14px;
    font-weight: 800;
    text-decoration: none;

    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease;
    user-select: none;

    white-space: normal;
    /* matn sig‘masa tushadi */
    text-align: center;
    line-height: 1.2;
}

/* icons in buttons */
.two-factor__btn i.fa {
    font-size: 14px;
    line-height: 1;
    flex: 0 0 auto;
    opacity: .95;
}

/* primary (telegram bot) */
.two-factor__btn--primary {
    background: linear-gradient(180deg, #3d65fb, #2f55f5);
    color: #fff;
    border-color: rgba(61, 101, 251, .35);
    box-shadow: 0 14px 26px rgba(61, 101, 251, .20);
}

.two-factor__btn--primary:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

/* ghost (logout/reload) */
.two-factor__btn--ghost {
    background: #fff;
    color: rgba(15, 23, 42, .86);
    border-color: rgba(15, 23, 42, .14);
    box-shadow: 0 10px 18px rgba(2, 6, 23, .08);
}

.two-factor__btn--ghost:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(2, 6, 23, .10);
}

/* divider */
.two-factor__divider {
    height: 1px;
    width: min(860px, 92vw);
    margin: 22px auto 16px;
    background: linear-gradient(90deg, transparent, rgba(15, 23, 42, .14), transparent);
}

/* ===== OTP ===== */
.two-factor__otp-block {
    width: 100%;
    display: grid;
    gap: 12px;
    place-items: center;
}

.two-factor__otp-title {
    font-size: 16px;
    color: rgba(15, 23, 42, .85);
}

.two-factor__otp-row {
    width: 100%;
    max-width: 560px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.two-factor__input {
    width: min(180px, 92vw);
    /* ixcham + responsive */
    height: 36px;
    /* kichikroq */
    border-radius: 8px;

    border: 1px solid #ced4da;
    /* Bootstrap-like */
    background: #fff;
    outline: none;

    font-size: 14px;
    font-weight: 700;
    text-align: center;

    padding: 0 10px;
    letter-spacing: 0.25em;
    /* OTP uchun qulay */

    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    transition: border-color .15s ease, box-shadow .15s ease;
}

/* focus holati */
.two-factor__input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15);
}

/* placeholder */
.two-factor__input::placeholder {
    color: #adb5bd;
    letter-spacing: normal;
}

.two-factor__input:focus {
    border-color: rgba(61, 101, 251, .55);
    box-shadow: 0 0 0 4px rgba(61, 101, 251, .16), 0 12px 26px rgba(2, 6, 23, .12);
}

/* submit button */
.two-factor__btn--submit {
    width: auto;
    min-width: 160px;
    background: linear-gradient(180deg, #3d65fb, #2f55f5);
    color: #fff;
    border-color: rgba(61, 101, 251, .35);
    box-shadow: 0 14px 26px rgba(61, 101, 251, .18);
}

.two-factor__btn--submit:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

/* ===== Face button ===== */
.two-factor__face {
    margin-top: 18px;
    display: grid;
    place-items: center;
}

.two-factor__btn--face {
    width: min(250px, 92vw);
    background: linear-gradient(180deg, #22c55e, #16a34a);
    color: #fff;
    border-color: rgba(22, 163, 74, .35);
    box-shadow: 0 16px 32px rgba(22, 163, 74, .18);
}

.two-factor__btn--face:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.two-factor__btn--face i.fa {
    font-size: 15px;
}

/* =========================
   MODAL
========================= */
.two-factor__modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .55);
    z-index: 9999;
    padding: 16px;
    align-items: center;
    justify-content: center;
}

.two-factor__modal-card {
    width: min(480px, 92vw);
    background: rgba(255, 255, 255, .95);
    border: 1px solid rgba(15, 23, 42, .14);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(2, 6, 23, .22);
    padding: 18px 16px 16px;
    position: relative;
    text-align: center;
}

.two-factor__modal-title {
    margin: 8px 0 14px;
    font-weight: 900;
}

.two-factor__modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, .06);
    border: 1px solid rgba(15, 23, 42, .10);
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.two-factor__modal-close:hover {
    background: rgba(2, 6, 23, .10);
}

.two-factor__camera {
    position: relative;
    width: min(280px, 72vw);
    height: min(280px, 72vw);
    margin: 0 auto 12px;
    overflow: hidden;
    border-radius: 50%;
}

/* camera circle & frozen canvas */
#camera,
#canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    transform: scaleX(-1);
    border: 6px solid rgba(61, 101, 251, .14) !important;
    box-shadow: 0 18px 40px rgba(2, 6, 23, .20) !important;
    background: #0b1220;
    z-index: 1;
    display: block;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 992px) {
    .two-factor__actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 640px;
    }
}

@media (max-width: 820px) {
    .two-factor__card {
        padding: 26px 16px 20px;
        border-radius: 16px;
    }

    .two-factor__title {
        font-size: 24px;
    }

    .two-factor__desc {
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .two-factor__actions {
        grid-template-columns: 1fr;
        max-width: 520px;
        gap: 12px;
    }

    .two-factor__otp-row {
        grid-template-columns: 1fr;
    }

    .two-factor__btn--submit {
        width: 100%;
        min-width: 0;
    }

    .two-factor__btn {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 38px;
    }

    .two-factor__btn i.fa {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .two-factor__btn {
        font-size: 12px;
        padding: 9px 10px;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .two-factor__input {
        width: min(180px, 92vw);
        height: 34px;
        font-size: 13px;
    }
}

.two-factor__camera::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;

    border: 3px solid transparent;
    border-top-color: #3d65fb;
    border-right-color: #00aeff;

    animation: scanRotate 1.8s linear infinite;
    opacity: .95;
}

.two-factor__camera.success::after {
    border-top-color: #22c55e;
    border-right-color: #16a34a;
}

.two-factor__camera.error::after {
    border-top-color: #ef4444;
    border-right-color: #b91c1c;
}

.two-factor__camera.paused::after {
    animation-play-state: paused !important;
}

.two-factor__camera.paused #bubbles .bubble {
    animation-play-state: paused !important;
}

@keyframes scanRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ✅ BUBBLES OVERLAY */
#bubbles {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    overflow: hidden;
    z-index: 2;
    pointer-events: none;
}

/* ✅ DEFAULT oq particle (harakatlanadi) */
#bubbles .bubble {
    position: absolute;
    left: var(--b-left);
    top: var(--b-top);
    width: var(--b-size);
    height: var(--b-size);
    border-radius: 50%;
    opacity: var(--b-opacity);

    background: rgba(255, 255, 255, .92);
    box-shadow: 0 0 10px rgba(255, 255, 255, .22);

    transform: translate(-50%, -50%);
    animation: bubbleFloat var(--b-duration) linear infinite;
    animation-delay: var(--b-delay);
    will-change: transform, opacity;
}

/* ✅ SUCCESS */
#bubbles.success .bubble {
    background: rgba(34, 197, 94, .88);
    box-shadow: 0 0 12px rgba(34, 197, 94, .25);
}

/* ✅ ERROR */
#bubbles.error .bubble {
    background: rgba(239, 68, 68, .88);
    box-shadow: 0 0 12px rgba(239, 68, 68, .25);
}

/* ✅ sezilarli harakat */
@keyframes bubbleFloat {
    0% {
        transform: translate(-50%, -50%) translate3d(0, 0, 0) scale(.85);
        opacity: var(--b-opacity);
    }

    50% {
        transform: translate(-50%, -50%) translate3d(6px, -10px, 0) scale(1.25);
        opacity: calc(var(--b-opacity) + .15);
    }

    100% {
        transform: translate(-50%, -50%) translate3d(0, 0, 0) scale(.85);
        opacity: var(--b-opacity);
    }
}

/* =========================
   MOBILE FIX (Face modal)
   - camera doimo doira (1:1)
   - modal telefonga sig‘adi
========================= */

@media (max-width: 600px) {

    .two-factor__modal-card {
        width: min(520px, 94vw);
        padding: 14px 12px 16px;
        border-radius: 16px;
    }

    .two-factor__modal-title {
        font-size: 16px;
        margin: 6px 0 10px;
    }

    .two-factor__camera {
        width: min(84vw, 300px) !important;
        height: min(84vw, 300px) !important;
        aspect-ratio: 1 / 1 !important;
        flex-shrink: 0 !important;
        margin: 0 auto 10px;
        overflow: hidden !important;
        border-radius: 50% !important;
    }

    #camera,
    #canvas {
        width: 100% !important;
        height: 100% !important;
        border-width: 5px !important;
    }

    .two-factor__camera::after {
        inset: -6px;
        border-width: 3px;
    }

    #face-status {
        font-size: 13px !important;
        line-height: 1.35 !important;
        padding: 0 6px;
    }

    #face-retry {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .two-factor__camera {
        width: min(88vw, 260px);
    }

    .two-factor__camera::after {
        inset: -5px;
    }
}
.direction-arrow {
    position: absolute;
    z-index: 10;
    display: none;
    color: #00f2ff; /* Primary Neon Cyan */
    font-size: 38px;
    filter: drop-shadow(0 0 8px #00f2ff) drop-shadow(0 0 15px rgba(0, 242, 255, 0.6));
    animation: arrowGlow 1.5s infinite ease-in-out;
    pointer-events: none;
}
.direction-arrow.active {
    display: block;
}
/* Move arrows INSIDE the circle (15px from edge) */
.arrow-up { top: 15px; left: 50%; transform: translateX(-50%); }
.arrow-down { bottom: 15px; left: 50%; transform: translateX(-50%); }
.arrow-left { left: 15px; top: 50%; transform: translateY(-50%); }
.arrow-right { right: 15px; top: 50%; transform: translateY(-50%); }

@keyframes arrowGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.9); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); filter: drop-shadow(0 0 12px #00f2ff) drop-shadow(0 0 25px #00f2ff); }
}
/* Unique pulses per direction */
.arrow-up { animation-name: pulseUp; }
.arrow-down { animation-name: pulseDown; }
.arrow-left { animation-name: pulseLeft; }
.arrow-right { animation-name: pulseRight; }

@keyframes pulseUp { 0%, 100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 0.6; } 50% { transform: translateX(-50%) translateY(-6px) scale(1.2); opacity: 1; } }
@keyframes pulseDown { 0%, 100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 0.6; } 50% { transform: translateX(-50%) translateY(6px) scale(1.2); opacity: 1; } }
@keyframes pulseLeft { 0%, 100% { transform: translateY(-50%) translateX(0) scale(1); opacity: 0.6; } 50% { transform: translateY(-50%) translateX(-6px) scale(1.2); opacity: 1; } }
@keyframes pulseRight { 0%, 100% { transform: translateY(-50%) translateX(0) scale(1); opacity: 0.6; } 50% { transform: translateY(-50%) translateX(6px) scale(1.2); opacity: 1; } }
@keyframes pulseRight { 0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.6; } 50% { transform: translateY(-50%) translateX(10px); opacity: 1; } }

/* --- Visual Polish --- */
.two-factor__modal-card {
    overflow: hidden;
}
.two-factor__modal-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    transform: translateX(-100%);
    animation: cardShimmer 5s infinite linear;
    pointer-events: none;
    z-index: 0;
}
@keyframes cardShimmer {
    0% { transform: translateX(-100%) skewX(-15deg); }
    30%, 100% { transform: translateX(200%) skewX(-15deg); }
}

.camera-halo {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.4) 0%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease;
}
.camera-halo.flash {
    animation: haloFlash 0.8s ease-out;
}
@keyframes haloFlash {
    0% { opacity: 0; transform: scale(0.9); }
    30% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.15); }
}

.scan-line {
    position: absolute;
    left: 10%;
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00aeff, transparent);
    box-shadow: 0 0 15px #00aeff;
    z-index: 4;
    display: none;
    pointer-events: none;
}
.scan-line.active {
    display: block;
    animation: scanMove 2s infinite ease-in-out;
}
@keyframes scanMove {
    0% { top: 20%; opacity: 0; }
    10%, 90% { opacity: 1; }
    100% { top: 80%; opacity: 0; }
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: all 0.3s ease;
}
.dot.active {
    background: #3d65fb;
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(61, 101, 251, 0.5);
}
.dot.completed {
    background: #22c55e;
    transform: scale(1);
}