/* ==================================================
   AUTH LAYOUT
   ================================================== */

.mf-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f141c;
    font-family: system-ui, sans-serif;
    color: #e6edf3;
    padding: 24px 16px;
}

.mf-auth__box {
    width: 100%;
    max-width: 420px;
    background: #161b22;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid #2a3441;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    position: relative;
}


/* ==================================================
   TITLE
   ================================================== */

.mf-auth__title {
    text-align: center;
    margin-bottom: 20px;
    color: #f0f6fc;
}

.mf-auth__title h1,
.mf-auth__title h2,
.mf-auth__title h3 {
    color: #f0f6fc;
}

.mf-auth__title p,
.mf-auth__title small,
.mf-auth__title span {
    color: #9fb0c3;
}


/* ==================================================
   MODE SWITCH
   ================================================== */

.mf-auth__modes {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}

.mf-auth__mode {
    flex: 1;
    padding: 10px;
    background: #212a35;
    color: #c7d2de;
    border: 1px solid #2d3743;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mf-auth__mode:hover {
    background: #283341;
    color: #ffffff;
}

.mf-auth__mode.is-active {
    background: #2d5be3;
    color: #fff;
    border-color: #2d5be3;
}


/* ==================================================
   FORM FIELDS
   ================================================== */

.mf-auth__field {
    margin-bottom: 14px;
}

.mf-auth__field label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: #c7d2de;
}

.mf-auth__field input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: #e6edf3;
    background: #0f141c;
    border: 1px solid #303b48;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.mf-auth__field input::placeholder {
    color: #7f8ea3;
}

.mf-auth__field input:focus {
    border-color: #4c84ff;
    box-shadow: 0 0 0 3px rgba(76, 132, 255, 0.18);
    background: #111821;
}


/* ==================================================
   SUBMIT & ERROR
   ================================================== */

.mf-auth__submit {
    display: block;
    width: 100%;
    padding: 11px;
    background: #2d5be3;
    color: #fff;
    border: 1px solid #2d5be3;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.mf-auth__submit:hover {
    background: #2449b8;
    border-color: #2449b8;
}

.mf-auth__submit:active {
    transform: translateY(1px);
}

.mf-auth__submit + .mf-auth__submit {
    margin-top: 12px;
}

.mf-auth__error {
    color: #ff6b6b;
    margin-bottom: 10px;
    font-size: 14px;
}


/* ==================================================
   STATES (CORE LOGIC)
   ================================================== */

/* PIN MODE */
.mf-auth.state-pin .field-login,
.mf-auth.state-pin .field-password,
.mf-auth.state-pin .field-password-confirm {
    display: none;
}

/* PASSWORD MODE */
.mf-auth.state-password .field-phone,
.mf-auth.state-password .field-pin,
.mf-auth.state-password .field-password-confirm {
    display: none;
}

/* SET PASSWORD (future) */
.mf-auth.state-set-password .field-phone,
.mf-auth.state-set-password .field-pin,
.mf-auth.state-set-password .field-login {
    display: none;
}


/* ==================================================
   INFO BLOCK
   ================================================== */

.mf-auth__info {
    margin: 20px 0;
    padding: 14px;
    background: #111821;
    border-left: 4px solid #2d5be3;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #c7d2de;
}

.mf-auth__info p {
    margin: 0 0 8px 0;
}

.mf-auth__info a {
    color: #79a6ff;
    text-decoration: none;
    word-break: break-all;
}

.mf-auth__info a:hover {
    text-decoration: underline;
}

.mf-auth__warning {
    color: #f3c969;
    background: #2a2416;
    border: 1px solid #4a3c19;
    padding: 10px;
    border-radius: 6px;
}


/* ==================================================
   FOOTER / HINT
   ================================================== */

.mf-auth__hint {
    margin-top: 14px;
    font-size: 12px;
    color: #8b9aad;
    text-align: center;
}


/* ==================================================
   LOADING STATE
   ================================================== */

.mf-auth.is-loading {
    opacity: 0.6;
    pointer-events: none;
}


/* ===========================
   ACTIVE ROOMS
   =========================== */

.mf-auth__rooms {
    margin: 30px 0 20px;
    padding: 20px;
    background: #111821;
    border-radius: 12px;
    border: 1px solid #2a3441;
}

.mf-auth__rooms-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f0f6fc;
}

.mf-auth__rooms-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mf-auth__room-title {
    font-weight: 500;
    color: #f0f6fc;
}

.mf-auth__rooms--empty {
    background: #111821;
}

.mf-auth__rooms-empty {
    color: #8b9aad;
    font-size: 14px;
}

.mf-auth__room {
    padding: 0;
    background: transparent;
    border: none;
}

.mf-auth__room-btn {
    display: inline-block;
    padding: 14px 18px;
    background: #2d5be3;
    color: #ffffff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid #2d5be3;
    transition: background 0.2s ease, transform 0.1s ease, border-color 0.2s ease;
}

.mf-auth__room-btn:hover {
    background: #1f44b5;
    border-color: #1f44b5;
    transform: translateY(-1px);
}

.mf-auth__room-btn--full {
    width: 100%;
    text-align: center;
}


/* ==================================================
   BUTTON VARIANTS
   ================================================== */

.mf-auth__submit--danger {
    background: #c23b3b;
    border-color: #c23b3b;
}

.mf-auth__submit--danger:hover {
    background: #a92f2f;
    border-color: #a92f2f;
}


/* ==================================================
   PROFILE / USER CARD HELPERS
   ================================================== */

.mf-auth img {
    max-width: 100%;
    border-radius: 10px;
}

.mf-auth .card,
.mf-auth .well,
.mf-auth .alert,
.mf-auth .list-group-item {
    background: #161b22;
    color: #e6edf3;
    border-color: #2a3441;
}

.mf-auth .text-muted,
.mf-auth .small,
.mf-auth small {
    color: #8b9aad !important;
}


/* ==================================================
   TELEGRAM QR BLOCK
   ================================================== */

.mf-auth__qr,
.mf-auth__telegram,
.mf-auth__bot {
    background: #111821;
    border: 1px solid #2a3441;
    border-radius: 12px;
    padding: 14px;
}

.mf-auth__qr img {
    display: block;
    margin: 0 auto;
    background: #fff;
    padding: 8px;
    border-radius: 10px;
}

.mf-auth__qr-caption {
    margin-top: 10px;
    text-align: center;
    font-size: 13px;
    color: #8b9aad;
}


/* ==================================================
   MODAL
   ================================================== */

.mf-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.mf-modal[hidden] {
    display: none !important;
}

.mf-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.mf-modal__box {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    margin: 80px auto 0;
    background: #161b22;
    border: 1px solid #2a3441;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    color: #e6edf3;
}

.mf-modal__box h3 {
    margin: 0 0 18px 0;
    color: #f0f6fc;
    font-size: 28px;
    line-height: 1.2;
}

.mf-modal__box .mf-auth__field label {
    color: #c7d2de;
}

.mf-modal__box .mf-auth__field input {
    background: #0f141c;
    border: 1px solid #303b48;
    color: #e6edf3;
}

.mf-modal__box .mf-auth__field input:focus {
    border-color: #4c84ff;
    box-shadow: 0 0 0 3px rgba(76, 132, 255, 0.18);
    background: #111821;
}

.mf-userdata-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.mf-userdata-actions .mf-auth__submit {
    flex: 1 1 0;
    width: auto;
    margin-top: 0;
}


/* ==================================================
   RESPONSIVE
   ================================================== */

@media (max-width: 480px) {
    .mf-auth {
        padding: 16px 12px;
        align-items: flex-start;
    }

    .mf-auth__box {
        padding: 24px 18px;
        border-radius: 10px;
    }

    .mf-auth__rooms {
        padding: 16px;
    }

    .mf-modal__box {
        margin: 40px auto 0;
        padding: 18px;
        width: min(420px, calc(100vw - 24px));
    }

    .mf-modal__box h3 {
        font-size: 24px;
    }

    .mf-userdata-actions {
        flex-direction: column;
    }

    .mf-userdata-actions .mf-auth__submit + .mf-auth__submit {
        margin-top: 10px;
    }
}