* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Inter, sans-serif;
}

body {

    background: #050505;

    color: white;

    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    overflow: hidden;

    position: relative;
    background-image:

        linear-gradient(rgba(255, 215, 0, .03) 1px, transparent 1px),

        linear-gradient(90deg, rgba(255, 215, 0, .03) 1px, transparent 1px);

    background-size: 60px 60px;


}

body::before {

    content: "";

    position: fixed;

    width: 900px;

    height: 650px;

    left: -220px;

    top: -180px;

    border-radius: 50%;

    background: #FFD54A;

    filter: blur(170px);

    opacity: .08;

    animation: glowMove 10s ease-in-out infinite alternate;

}

body::after {

    content: "";

    position: fixed;

    width: 500px;

    height: 500px;

    right: -180px;

    bottom: -150px;

    border-radius: 50%;

    background: #F4B400;

    filter: blur(150px);

    opacity: .06;

    animation: glowMove2 8s ease-in-out infinite alternate;

}

.container {

    width: 1400px;

    display: grid;

    grid-template-columns:
        1fr 600px;
}

.left {

    padding: 60px;
}

.left h2 {

    font-size: 72px;

    line-height: 1.2;
}

.left span {

    color: #D4AF37;
}

.desc {

    margin-top: 30px;

    color: #aaa;

    font-size: 22px;
}

.right {

    display: flex;

    justify-content: center;
    align-items: center;
}

.login-card {

    width: 100%;

    background: #0c0c0c;

    border: 1px solid #252525;

    border-radius: 30px;

    padding: 50px;
}

.login-card input {

    width: 100%;

    height: 60px;

    background: #151515;

    border: 1px solid #222;

    border-radius: 12px;

    padding: 0 20px;

    color: white;

    margin-top: 20px;
}

.login-card button {

    width: 100%;

    height: 60px;

    margin-top: 20px;

    background: #D4AF37;

    border: none;

    border-radius: 12px;

    font-size: 18px;

    font-weight: 700;

    cursor: pointer;
}

.google-btn {

    display: flex;

    justify-content: center;
    align-items: center;

    gap: 10px;

    height: 60px;

    margin-top: 20px;

    border: 1px solid #333;

    border-radius: 12px;

    color: white;

    text-decoration: none;
}

.auth-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-modal-box {
    width: 420px;
    max-width: 90%;
    background: #141414;
    border-radius: 24px;
    padding: 35px;
    text-align: center;
    color: #fff;
    border: 1px solid rgba(255, 215, 0, .12);
}

.modal-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.auth-modal-box.success .modal-icon {
    background: #12351f;
    color: #3dff86;
}

.auth-modal-box.error .modal-icon {
    background: #3a1111;
    color: #ff4d4d;
}

.login-links {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin: 15px 0 28px;

    font-size: 14px;

}

.login-links span {

    color: #999;

}

.login-links a {

    color: #FFD54A;

    text-decoration: none;

    font-weight: 600;

    transition: .3s;

}

.login-links a:hover {

    color: #fff;

    text-shadow: 0 0 12px rgba(255, 215, 0, .8);

}
.facebook-btn {
    width: 100%;
    min-height: 50px;
    margin-top: 12px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    background: #1877f2;
    color: #ffffff;

    border-radius: 10px;

    text-decoration: none;
    font-size: 15px;
    font-weight: 600;

    transition: 0.25s ease;
}

.facebook-btn:hover {
    background: #0d65d9;
    transform: translateY(-2px);
}

.facebook-btn i {
    font-size: 19px;
}
/* ==================================================
   MOBILE ONLY - giữ nguyên toàn bộ logic đăng nhập/modal
================================================== */
@media (max-width: 768px) {

    html,
    body {
        width: 100%;
        min-height: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body {
        display: block;
        padding: 20px 14px;
    }

    .container {
        width: 100%;
        min-height: calc(100dvh - 40px);
        display: block;
    }

    .left {
        display: none;
    }

    .right {
        width: 100%;
        min-height: calc(100dvh - 40px);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .login-card {
        width: 100%;
        max-width: 460px;
        padding: 28px 20px;
        border-radius: 22px;
    }

    .login-card input,
    .login-card button,
    .google-btn,
    .facebook-btn {
        min-height: 52px;
    }

    .login-links {
        gap: 12px;
        flex-wrap: wrap;
    }

    /* Modal chỉ thay đổi kích thước/khả năng cuộn, không đổi logic ẩn hiện */
    .auth-modal {
        padding: 18px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        align-items: center;
        justify-content: center;
    }

    .auth-modal-box {
        width: 100%;
        max-width: 390px;
        max-height: calc(100dvh - 36px);
        overflow-y: auto;
        padding: 26px 20px;
        border-radius: 20px;
        position: relative;
        z-index: 10000;
    }

    .auth-modal button,
    .auth-modal a,
    .auth-modal input {
        position: relative;
        z-index: 10001;
        pointer-events: auto;
        touch-action: manipulation;
    }
}

@media (max-width: 380px) {
    body {
        padding: 12px 10px;
    }

    .login-card {
        padding: 24px 16px;
    }

    .auth-modal {
        padding: 10px;
    }

    .auth-modal-box {
        max-height: calc(100dvh - 20px);
        padding: 22px 16px;
    }
}

/* FIX MOBILE: modal không chặn các ô nhập phía sau */
@media (max-width: 768px) {
    .login-card,
    .login-card form,
    .login-card input,
    .login-card button,
    .login-card a {
        position: relative;
        z-index: 2;
        pointer-events: auto;
    }

    .auth-modal {
        align-items: flex-start;
        justify-content: center;
        padding-top: max(14px, env(safe-area-inset-top));
        padding-left: 14px;
        padding-right: 14px;
        padding-bottom: 14px;
        background: transparent;
        pointer-events: none;
    }

    .auth-modal-box {
        max-height: 42dvh;
        overflow-y: auto;
        pointer-events: auto;
        box-shadow: 0 16px 50px rgba(0, 0, 0, .65);
    }
}

/* ==================================================
   MOBILE INPUT FIX V2
   Chỉ sửa giao diện/tương tác, không thay đổi logic
================================================== */
body::before,
body::after {
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    body {
        min-height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .right,
    .login-card,
    .login-card form {
        position: relative;
        z-index: 2;
    }

    .login-card input {
        position: relative;
        z-index: 3;
        display: block;
        pointer-events: auto !important;
        touch-action: manipulation;
        -webkit-user-select: text;
        user-select: text;
    }

    /* Modal dạng thông báo ở dưới, không đè lên ô email/mật khẩu */
    .auth-modal {
        inset: auto 0 0 0;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
        display: flex;
        align-items: flex-end;
        justify-content: center;
        background: transparent;
        overflow: visible;
        pointer-events: none;
    }

    .auth-modal-box {
        width: 100%;
        max-width: 460px;
        max-height: 46dvh;
        margin: 0;
        padding: 20px 18px;
        overflow-y: auto;
        border-radius: 18px;
        pointer-events: auto;
        z-index: 10000;
    }

    .modal-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 12px;
        font-size: 22px;
    }

    .auth-modal-box h3 {
        margin-bottom: 8px;
    }

    .auth-modal-box p {
        margin-bottom: 4px;
        line-height: 1.5;
    }

    .auth-modal-box button {
        height: 48px;
        margin-top: 14px;
        pointer-events: auto !important;
        touch-action: manipulation;
    }
}

/* ==================================================
   MOBILE HEADER FIX
   Giữ logo BFFTUNE, chỉ ẩn nội dung giới thiệu lớn
================================================== */
@media (max-width: 768px) {
    body {
        padding: 0 14px 20px;
    }

    .container {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .left {
        display: block;
        width: 100%;
        padding: calc(18px + env(safe-area-inset-top)) 4px 16px;
        flex: none;
        position: relative;
        z-index: 5;
    }

    .left > h2,
    .left > .desc {
        display: none;
    }

    .left .logo {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .left .logo h1 {
        margin: 0;
        color: #D4AF37;
        font-size: 25px;
        line-height: 1.1;
        font-weight: 800;
        letter-spacing: 2px;
    }

    .left .logo p {
        margin: 0;
        color: #8f8f8f;
        font-size: 9px;
        line-height: 1.4;
        letter-spacing: 1.3px;
    }

    .right {
        flex: 1;
        min-height: 0;
        width: 100%;
        align-items: flex-start;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .login-card {
        margin: 0 auto;
    }
}

@media (max-width: 380px) {
    .left {
        padding-top: calc(14px + env(safe-area-inset-top));
        padding-bottom: 12px;
    }

    .left .logo h1 {
        font-size: 22px;
    }
}

/* ==================================================
   MODAL CLOSE BUTTON - MODERN GOLD STYLE
   Chỉ thay đổi giao diện, giữ nguyên onclick/logic
================================================== */
.auth-modal-box > button[type="button"] {
    width: 100%;
    min-height: 50px;
    margin-top: 22px;
    padding: 0 22px;
    border: 1px solid rgba(255, 213, 74, .55);
    border-radius: 14px;
    background: linear-gradient(135deg, #FFD54A 0%, #D4AF37 55%, #B8860B 100%);
    color: #111;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .5px;
    cursor: pointer;
    box-shadow:
        0 10px 28px rgba(212, 175, 55, .22),
        inset 0 1px 0 rgba(255, 255, 255, .35);
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        filter .2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.auth-modal-box > button[type="button"]:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow:
        0 14px 34px rgba(212, 175, 55, .32),
        inset 0 1px 0 rgba(255, 255, 255, .4);
}

.auth-modal-box > button[type="button"]:active {
    transform: translateY(0) scale(.98);
    box-shadow:
        0 6px 16px rgba(212, 175, 55, .2),
        inset 0 2px 5px rgba(0, 0, 0, .18);
}

.auth-modal-box > button[type="button"]:focus-visible {
    outline: 3px solid rgba(255, 213, 74, .28);
    outline-offset: 3px;
}

/* Màu nút theo trạng thái modal */
.auth-modal-box.error > button[type="button"] {
    border-color: rgba(255, 91, 91, .55);
    background: linear-gradient(135deg, #ff6b6b, #e54848);
    color: #fff;
    box-shadow: 0 10px 28px rgba(229, 72, 72, .22);
}

@media (max-width: 768px) {
    .auth-modal-box > button[type="button"] {
        min-height: 52px;
        margin-top: 18px;
        border-radius: 13px;
        font-size: 15px;
    }
}
/* =========================================
   LOGIN 2FA OVERLAY
========================================= */

.twofa-login-overlay,
.twofa-login-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(0, 0, 0, 0.78);

    backdrop-filter:
        blur(12px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.twofa-login-overlay.show,
.twofa-login-result-overlay.show {
    opacity: 1;
    visibility: visible;
}


/* =========================================
   LOGIN 2FA MODAL
========================================= */

.twofa-login-modal {
    width: min(100%, 520px);

    overflow: hidden;

    background:
        linear-gradient(
            145deg,
            rgba(28, 28, 28, 0.99),
            rgba(8, 8, 8, 0.99)
        );

    border:
        1px solid
        rgba(212, 175, 55, 0.24);

    border-radius: 24px;

    box-shadow:
        0 35px 90px
        rgba(0, 0, 0, 0.72);

    transform:
        translateY(20px)
        scale(0.97);

    transition:
        transform 0.25s ease;
}

.twofa-login-overlay.show
.twofa-login-modal {
    transform:
        translateY(0)
        scale(1);
}


/* =========================================
   HEADER
========================================= */

.twofa-login-header {
    position: relative;

    display: flex;
    align-items: flex-start;

    gap: 16px;

    padding: 25px;

    background:
        radial-gradient(
            circle at top left,
            rgba(212, 175, 55, 0.14),
            transparent 48%
        );

    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.07);
}

.twofa-login-icon {
    flex: 0 0 50px;

    width: 50px;
    height: 50px;

    display: grid;
    place-items: center;

    color: #e6c65c;

    background:
        rgba(212, 175, 55, 0.12);

    border:
        1px solid
        rgba(212, 175, 55, 0.26);

    border-radius: 16px;

    font-size: 21px;
}

.twofa-login-label {
    display: block;

    margin-bottom: 7px;

    color: #d7b54f;

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 2px;
}

.twofa-login-header h2 {
    margin:
        0 45px 7px 0;

    color: #ffffff;

    font-size: 21px;
}

.twofa-login-header p {
    margin: 0;

    color: #929292;

    font-size: 13px;
    line-height: 1.55;
}

.twofa-login-close {
    position: absolute;

    top: 20px;
    right: 20px;

    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    color: #ababab;

    background:
        rgba(255, 255, 255, 0.05);

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    border-radius: 50%;

    cursor: pointer;

    transition: 0.2s ease;
}

.twofa-login-close:hover {
    color: #ffffff;

    background:
        rgba(255, 255, 255, 0.1);

    transform: rotate(90deg);
}


/* =========================================
   BODY
========================================= */

.twofa-login-body {
    padding: 26px;
}

.twofa-login-note {
    display: flex;
    align-items: flex-start;

    gap: 13px;

    margin-bottom: 24px;

    padding: 16px;

    background:
        rgba(212, 175, 55, 0.07);

    border:
        1px solid
        rgba(212, 175, 55, 0.16);

    border-radius: 14px;
}

.twofa-login-note > i {
    margin-top: 3px;

    color: #dfbc51;

    font-size: 20px;
}

.twofa-login-note strong {
    display: block;

    margin-bottom: 4px;

    color: #ffffff;

    font-size: 14px;
}

.twofa-login-note p {
    margin: 0;

    color: #999999;

    font-size: 12px;
    line-height: 1.5;
}


/* =========================================
   FORM
========================================= */

#loginTwoFAForm label {
    display: block;

    margin-bottom: 9px;

    color: #e5e5e5;

    font-size: 13px;
    font-weight: 650;
}

.twofa-login-input-box {
    display: flex;
    align-items: center;

    overflow: hidden;

    background: #101010;

    border:
        1px solid
        rgba(255, 255, 255, 0.1);

    border-radius: 13px;

    transition: 0.2s ease;
}

.twofa-login-input-box:focus-within {
    border-color:
        rgba(212, 175, 55, 0.7);

    box-shadow:
        0 0 0 3px
        rgba(212, 175, 55, 0.08);
}

.twofa-login-input-box > i {
    padding-left: 16px;

    color: #d8b84e;

    font-size: 15px;
}

.twofa-login-input-box input {
    flex: 1;
    min-width: 0;

    padding:
        15px 16px;

    color: #efcf66;

    background: transparent;

    border: none;
    outline: none;

    font-size: 27px;
    font-weight: 800;

    letter-spacing: 12px;
    text-align: center;
}

.twofa-login-input-box input::placeholder {
    color: #5f5430;
}

.twofa-login-help {
    display: block;

    margin-top: 8px;

    color: #777777;

    font-size: 11px;
    line-height: 1.5;
}


/* =========================================
   MESSAGE
========================================= */

.twofa-login-message {
    min-height: 21px;

    margin-top: 13px;

    font-size: 12px;
    line-height: 1.5;
}

.twofa-login-message.error {
    color: #ff7777;
}

.twofa-login-message.success {
    color: #63d98c;
}


/* =========================================
   ACTION BUTTONS
========================================= */

.twofa-login-actions {
    display: flex;
    justify-content: flex-end;

    gap: 11px;

    margin-top: 20px;
}

.twofa-login-back,
.twofa-login-submit {
    min-height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding:
        0 18px;

    border-radius: 11px;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;

    transition: 0.2s ease;
}

.twofa-login-back {
    color: #c4c4c4;

    background:
        rgba(255, 255, 255, 0.05);

    border:
        1px solid
        rgba(255, 255, 255, 0.09);
}

.twofa-login-back:hover {
    color: #ffffff;

    background:
        rgba(255, 255, 255, 0.09);
}

.twofa-login-submit {
    color: #111111;

    background:
        linear-gradient(
            135deg,
            #f0d36f,
            #c99c25
        );

    border: none;

    box-shadow:
        0 10px 25px
        rgba(212, 175, 55, 0.15);
}

.twofa-login-submit:hover {
    transform:
        translateY(-1px);

    box-shadow:
        0 12px 30px
        rgba(212, 175, 55, 0.24);
}

.twofa-login-submit:disabled {
    cursor: not-allowed;

    opacity: 0.65;

    transform: none;
}


/* =========================================
   BUTTON LOADING
========================================= */

.twofa-login-loading {
    display: none;
}

.twofa-login-submit.loading
.twofa-login-submit-text {
    display: none;
}

.twofa-login-submit.loading
.twofa-login-loading {
    display: inline-flex;
    align-items: center;

    gap: 7px;
}


/* =========================================
   RESULT MODAL
========================================= */

.twofa-login-result-modal {
    width: min(100%, 390px);

    padding:
        38px 28px;

    background:
        linear-gradient(
            145deg,
            #1b1b1b,
            #0b0b0b
        );

    border:
        1px solid
        rgba(212, 175, 55, 0.2);

    border-radius: 24px;

    box-shadow:
        0 30px 80px
        rgba(0, 0, 0, 0.7);

    text-align: center;

    transform:
        translateY(18px)
        scale(0.97);

    transition:
        transform 0.25s ease;
}

.twofa-login-result-overlay.show
.twofa-login-result-modal {
    transform:
        translateY(0)
        scale(1);
}

.twofa-login-result-icon {
    width: 76px;
    height: 76px;

    display: grid;
    place-items: center;

    margin:
        0 auto 18px;

    border-radius: 50%;

    font-size: 31px;
}

.twofa-login-result-icon.loading {
    color: #e2c15c;

    background:
        rgba(212, 175, 55, 0.12);

    border:
        1px solid
        rgba(212, 175, 55, 0.25);
}

.twofa-login-result-icon.success {
    color: #ffffff;

    background: #29b765;

    border:
        7px solid
        rgba(41, 183, 101, 0.18);

    box-shadow:
        0 0 35px
        rgba(41, 183, 101, 0.28);

    animation:
        loginTwoFASuccessPop
        0.35s ease;
}

@keyframes loginTwoFASuccessPop {
    0% {
        transform: scale(0.65);
    }

    70% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
    }
}

.twofa-login-result-modal h2 {
    margin:
        0 0 9px;

    color: #ffffff;

    font-size: 21px;
}

.twofa-login-result-modal p {
    margin: 0;

    color: #9c9c9c;

    font-size: 13px;
    line-height: 1.6;
}


/* =========================================
   BODY LOCK
========================================= */

body.modal-open {
    overflow: hidden;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 600px) {

    .twofa-login-overlay,
    .twofa-login-result-overlay {
        align-items: flex-end;

        padding: 10px;
    }

    .twofa-login-modal {
        width: 100%;

        max-height:
            calc(100vh - 20px);

        overflow-y: auto;

        border-radius:
            22px 22px 14px 14px;
    }

    .twofa-login-header {
        padding:
            20px 18px;
    }

    .twofa-login-icon {
        flex-basis: 43px;

        width: 43px;
        height: 43px;

        border-radius: 13px;

        font-size: 18px;
    }

    .twofa-login-header h2 {
        margin-right: 38px;

        font-size: 18px;
    }

    .twofa-login-header p {
        font-size: 12px;
    }

    .twofa-login-close {
        top: 17px;
        right: 15px;

        width: 34px;
        height: 34px;
    }

    .twofa-login-body {
        padding:
            20px 18px;
    }

    .twofa-login-note {
        padding: 14px;
    }

    .twofa-login-input-box input {
        padding:
            14px 8px;

        font-size: 23px;

        letter-spacing: 9px;
    }

    .twofa-login-actions {
        flex-direction: column-reverse;
    }

    .twofa-login-back,
    .twofa-login-submit {
        width: 100%;

        min-height: 47px;
    }

    .twofa-login-result-modal {
        width: 100%;

        padding:
            34px 22px;

        border-radius:
            22px 22px 14px 14px;
    }
}