/* ========================================================
   MARESO GATEKEEPER - MODAL STYLES (RESPONSIVE OPTIMIZED)
   ======================================================== */

.mx-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(15, 23, 42, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    box-sizing: border-box;
}

.mx-gate-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.mx-gate-dialog {
    background: #ffffff;
    width: 100%;
    border-radius: 20px;
    padding: 28px 24px;
    padding-top: 36px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    position: relative;
    transform: translate3d(0, 16px, 0) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.mx-gate-dialog-small { max-width: 420px; }
.mx-gate-dialog-medium { max-width: 520px; }

.mx-gate-overlay.is-active .mx-gate-dialog {
    transform: translate3d(0, 0, 0) scale(1);
}

.mx-gate-overlay .mx-gate-close {
    position: absolute;
    top: 0px;
    right: 0px;
    background: none;
    border: none;
    font-size: 26px;
    color: #f36d38;
    cursor: pointer;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.mx-gate-overlay .mx-gate-close:hover { 
    color: #94a3b8; 
    background: transparent !important; 
}

.mx-gate-icon {
    width: 52px;
    height: 52px;
    background: #fff4ed;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px auto;
    flex-shrink: 0;
}

.mx-gate-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f1f3d;
    margin: 0 0 8px 0;
    text-align: center;
    line-height: 1.3;
}

.mx-gate-desc {
    font-size: 13.5px;
    color: #64748b;
    margin: 0 0 20px 0;
    line-height: 1.55;
    text-align: center;
}

#mx-gate-passcode-input {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
#mx-gate-passcode-input:focus { border-color: #f36d38; }

#mx-gate-passcode-btn,
#mx-gate-login-btn,
#mx-gate-register-btn {
    width: 100%;
    margin-top: 14px;
    padding: 13px;
    background: #f36d38;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
}
#mx-gate-passcode-btn:hover,
#mx-gate-login-btn:hover,
#mx-gate-register-btn:hover { background: #d95825; }

/* Switch Links */
.mx-gate-switch-link {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    font-size: 13px;
    color: #64748b;
}
.mx-gate-overlay .mx-gate-switch-link button,
.mx-gate-overlay .mx-gate-back-link button {
    display: block;
    margin: 6px auto 0 auto;
    background: none;
    border: none;
    color: #f36d38;
    font-weight: 700;
    cursor: pointer;
    font-size: 13.5px;
    padding: 0;
}
.mx-gate-overlay .mx-gate-switch-link button:hover,
.mx-gate-overlay .mx-gate-back-link button:hover {
    text-decoration: underline;
}

.mx-gate-back-link {
    margin-top: 16px;
    text-align: center;
}

/* Tabs Nav */
#mx-gate-auth-modal .mx-gate-tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}
#mx-gate-auth-modal .mx-gate-tab-btn {
    flex: 1;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
#mx-gate-auth-modal .mx-gate-tab-btn.is-active {
    background: #0f1f3d;
    color: #ffffff;
    border-color: #0f1f3d;
}

#mx-gate-auth-modal .mx-gate-panel { display: none; }
#mx-gate-auth-modal .mx-gate-panel.is-active {
    display: block;
    animation: mxGateFade 0.22s ease forwards;
}

@keyframes mxGateFade {
    from { opacity: 0; transform: translate3d(0, 6px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

#mx-gate-auth-modal .mx-gate-group { margin-bottom: 12px; }
#mx-gate-auth-modal .mx-gate-group label,
#mx-gate-auth-modal .mx-gate-col label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
}
#mx-gate-auth-modal .mx-gate-group input,
#mx-gate-auth-modal .mx-gate-col input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
#mx-gate-auth-modal .mx-gate-group input:focus,
#mx-gate-auth-modal .mx-gate-col input:focus { border-color: #f36d38; }

#mx-gate-auth-modal .mx-gate-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
#mx-gate-auth-modal .mx-gate-col { flex: 1; }

.mx-gate-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    font-weight: 600;
}
.mx-gate-msg {
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
}
.mx-gate-msg.success { background: #dcfce7; color: #166534; }
.mx-gate-msg.error { background: #fee2e2; color: #991b1b; }

/* ========================================================
   RESPONSIVE BREAKPOINTS (MOBILE & TABLET)
   ======================================================== */

@media (max-width: 600px) {
    .mx-gate-overlay {
        padding: 12px;
    }

    .mx-gate-dialog {
        padding: 22px 16px;
        padding-top: 32px;
        border-radius: 16px;
        max-height: 92vh;
    }

    .mx-gate-title {
        font-size: 18px;
    }

    .mx-gate-desc {
        font-size: 12.5px;
        margin-bottom: 16px;
    }

    .mx-gate-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 10px;
    }

    /* Chuyển các trường trên cùng hàng thành 1 cột */
    #mx-gate-auth-modal .mx-gate-row {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }

    #mx-gate-passcode-input {
        padding: 11px 14px;
        font-size: 15px;
    }

    #mx-gate-passcode-btn,
    #mx-gate-login-btn,
    #mx-gate-register-btn {
        padding: 12px;
        font-size: 14px;
        margin-top: 10px;
    }

    #mx-gate-auth-modal .mx-gate-tab-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .mx-gate-overlay .mx-gate-switch-link button,
    .mx-gate-overlay .mx-gate-back-link button {
        font-size: 12.5px;
    }
}