/*
 * Tanasobefekri Auth - Front-end isolated styles
 * Version: 11.8.0
 */

#tfa-unique-wrap,
#tfa-unique-wrap * {
    box-sizing: border-box !important;
}

#tfa-unique-wrap {
    all: initial !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100% !important;
    min-height: 100vh !important;
    /* واحد جدید که با نشان/پنهان شدن نوار آدرس مرورگر موبایل هماهنگ می‌شود؛
       مرورگرهای قدیمی‌تر که این واحد را نمی‌شناسند همان مقادیر بالا را حفظ می‌کنند */
    height: 100dvh !important;
    min-height: 100dvh !important;
    z-index: 99999999 !important;

    /* Center alignment strict lock */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;

    color-scheme: light only !important;
    direction: rtl !important;
    
    /* Inherit the primary site font */
    font-family: inherit !important;
    line-height: 1.5 !important;
    
    /* Smooth scrolling for mobile UX */
    scroll-behavior: smooth !important;
}

#tfa-unique-wrap button,
#tfa-unique-wrap input,
#tfa-unique-wrap textarea,
#tfa-unique-wrap select {
    font-family: inherit !important;
}

#tfa-box {
    position: relative !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    margin: 0 !important; /* Strict 0 to sync with wrapper center */
    flex: 0 0 auto !important;
    padding: 35px 25px 25px !important; /* Slightly reduced vertical padding for compactness */
    width: 100% !important;
    max-width: 420px !important;
    border-radius: 20px !important;
    direction: rtl !important;
    z-index: 10 !important;
    color-scheme: light only !important;
    background-image: url("/wp-content/plugins/tf-auth/assets/login-card-pattern.svg") !important;
    background-repeat: repeat !important;
    background-size: 300px 300px !important;
}

#tfa-unique-wrap form,
#tfa-unique-wrap .tfa-form-group {
    width: 100% !important;
    max-width: 100% !important;
}

#tfa-unique-wrap .tfa-form-group {
    margin-bottom: 12px !important; /* Compacted from 15px */
}

/* 
 * Hide elements strictly based on inline display:none from jQuery
 */
#tfa-unique-wrap #tfa_password_box[style*="display: none"],
#tfa-unique-wrap #tfa_password_box[style*="display:none"],
#tfa-unique-wrap #tfa_register_box[style*="display: none"],
#tfa-unique-wrap #tfa_register_box[style*="display:none"],
#tfa-unique-wrap #tfa_otp_box[style*="display: none"],
#tfa-unique-wrap #tfa_otp_box[style*="display:none"],
#tfa-unique-wrap #tfa_action_buttons[style*="display: none"],
#tfa-unique-wrap #tfa_action_buttons[style*="display:none"],
#tfa-unique-wrap #tfa_reg_mobile_box[style*="display: none"],
#tfa-unique-wrap #tfa_reg_mobile_box[style*="display:none"],
#tfa-unique-wrap #tfa_reg_email_box[style*="display: none"],
#tfa-unique-wrap #tfa_reg_email_box[style*="display:none"],
#tfa-unique-wrap #tfa_main_buttons[style*="display: none"],
#tfa-unique-wrap #tfa_main_buttons[style*="display:none"],
#tfa-unique-wrap #tfa_confirm_password_wrap[style*="display: none"],
#tfa-unique-wrap #tfa_confirm_password_wrap[style*="display:none"],
#tfa-unique-wrap #tfa_remember_wrap[style*="display: none"],
#tfa-unique-wrap #tfa_remember_wrap[style*="display:none"] {
    display: none !important;
}

#tfa-unique-wrap .tfa-password-wrapper {
    position: relative !important;
    width: 100% !important;
    display: block !important;
}

#tfa-unique-wrap input.tfa-input {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 46px !important; /* Compacted from 50px */
    min-height: 46px !important;
    margin: 0 !important;
    padding: 12px 15px !important; /* Adjusted for new height */
    border: 1.5px solid rgba(224, 224, 224, 0.6) !important;
    border-radius: 50px !important;
    outline: none !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 20px !important;
    color: #333 !important;
    background-color: rgba(250, 250, 250, 0.9) !important;
    text-align: center !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

#tfa-unique-wrap input.tfa-input:focus {
    border-color: #8b3dff !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(139, 61, 255, 0.1) !important;
}

#tfa-unique-wrap input.tfa-input:disabled {
    background-color: rgba(240, 240, 240, 0.7) !important;
    color: #888 !important;
    opacity: 1 !important;
}

#tfa-unique-wrap .tfa-password-wrapper input {
    padding-left: 45px !important;
}

/* Expanded Hitbox for Touch Devices */
#tfa-unique-wrap .tfa-toggle-password {
    position: absolute !important;
    left: 2px !important; 
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 44px !important; /* Large 44x44 hitbox for easy tapping */
    height: 44px !important; 
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    color: #888 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 20 !important;
    -webkit-tap-highlight-color: transparent !important; 
}

#tfa-unique-wrap .tfa-toggle-password svg {
    width: 24px !important;
    height: 24px !important;
}

#tfa-unique-wrap .tfa-toggle-password:hover {
    color: #333 !important;
}

#tfa-unique-wrap .tfa-buttons-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 20px 0 0 !important;
    padding: 0 !important;
}

#tfa-unique-wrap .tfa-buttons-wrapper > .tfa-btn {
    flex: 0 0 auto !important;
    align-self: stretch !important;
}

#tfa-unique-wrap button.tfa-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 46px !important; /* Compacted from 50px */
    min-height: 46px !important;
    padding: 0 15px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50px !important;
    outline: none !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.5 !important;
    white-space: normal !important;
    text-indent: 0 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    cursor: pointer !important;
    transition: filter 0.2s ease, transform 0.2s ease !important;
    box-shadow: none !important;
    background-image: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

#tfa-unique-wrap button.tfa-btn:hover {
    filter: brightness(0.85) !important;
}

#tfa-unique-wrap button.tfa-btn:active {
    transform: scale(0.98) !important;
}

#tfa-unique-wrap button.tfa-btn:disabled {
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Beautiful Floating Home Button */
#tfa-unique-wrap a.tfa-back-to-home {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important; /* Positioned top-left inside the box */
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.05) !important;
    color: #555 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    box-shadow: none !important;
    border: none !important;
    z-index: 100 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#tfa-unique-wrap a.tfa-back-to-home:hover {
    background: rgba(0, 0, 0, 0.12) !important;
    color: #000 !important;
    transform: scale(1.05) !important;
}

#tfa-unique-wrap .tfa-terms-text {
    display: block !important;
    width: 90% !important;
    margin: 22px auto 0 !important;
    padding: 0 10px !important;
    font-size: 15px !important; /* Made larger and more readable */
    font-weight: 700 !important; /* Bold */
    color: #444 !important;
    text-align: center !important;
    line-height: 1.7 !important; /* Better line spacing */
}

@media (max-width: 480px) {
    #tfa-unique-wrap {
        padding: 15px !important; /* Tighter padding on small screens */
    }

    #tfa-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 25px 20px 25px !important;
        border-radius: 20px !important;
        flex: 0 0 auto !important;
    }
}
