﻿/* bsa.site.mobile.css - loaded only on small screens */
@media screen and ( max-width: 480px ) {
    /* Move header box below the logo area */
    .signin .header-box {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin-bottom: 15px;
        padding-left: 0;
        text-align: center;
    }

    /* Logo at bottom center, 50% size */
    .company-logo {
        position: fixed;
        bottom: 35px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 120px; /* 50% of 240px */
    }

    .company-logo img {
        width: 100%;
    }

    /* Footer at very bottom, below logo */
    .login-footer {
        position: fixed;
        bottom: 8px;
        left: 0;
        right: 0;
        margin-left: 0;
        text-align: center;
        font-size: 11px;
    }

    /* Prevent long database names from overflowing */
    .unit-databases-container .database-name,
    .unit-databases-container .unit-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    /* Ensure form doesn't overflow viewport */
    .signin-container-outer {
        overflow-x: hidden;
    }


    /* Form container - full width with padding */
    .form-signin {
        max-width: 100%;
        width: auto;
        margin: 0 10px 80px; /* Bottom margin makes room for fixed footer/logo */
        padding: 20px 15px 15px;
    }

        /* Inputs - fluid width */
        .form-signin input[type="text"],
        .form-signin input[type="password"] {
            box-sizing: border-box;
        }

    /* Modals - nearly full screen */
    .modal-two-step .modal,
    .modal-two-step-mobile-auth-registration .modal,
    .modal-set-new-password .modal {
        width: 95%;
        left: 2.5%;
        margin-left: 0;
        top: 5%;
    }

    /* Hide background photo on mobile for performance */
    .signin-background-photo {
        display: none;
    }

    /* Larger touch targets */
    .signin .login-button,
    .signin .sso-button {
        min-height: 48px;
        font-size: 16px;
    }

    /* Two-factor options - stack vertically */
    .modal-two-step .two-step-option {
        flex-direction: column;
        text-align: center;
        padding: 15px 10px;
    }

    .modal-two-step .option-action {
        margin-top: 10px;
    }

    /* Extra padding when two-step code is visible to clear fixed footer */
    .signin .two-step-code-container {
        padding-bottom: 70px;
    }

    .signin .restart-wf-container {
        margin-bottom: 20px;
    }

    /* =====================================================
       User Profile - Show avatar on mobile
       ===================================================== */

    /* Override bootstrap-responsive-bsa.css that hides profile */
    .site-header-right .user-profile .dropdown-toggle .profile-container {
        display: block !important;
        padding: 15px 7px;
    }

    /* Hide the display name, show only avatar */
    .site-header-right .user-profile .dropdown-toggle .profile-container span.user-display-name,
    .site-header-right .user-profile .dropdown-toggle .profile-container .fa-caret-down {
        display: none;
    }

    /* Make avatar appropriately sized for mobile header */
    .site-header-right .user-profile .profile-image img {
        width: 32px;
        height: 32px;
    }

    /* Ensure dropdown menu is accessible on mobile */
    .site-header-right .user-profile .dropdown-menu {
        right: 0;
        left: auto;
        max-height: 80vh;
        overflow-y: auto;
    }
}

/* =====================================================
   Landscape orientation - short viewport height
   ===================================================== */
@media screen and ( max-height: 500px ) {

    /* Make body scrollable in landscape */
    body {
        overflow-y: auto !important;
        height: auto !important;
    }

    /* Remove absolute positioning so content flows naturally */
    .signin-container-outer {
        position: relative !important;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        min-height: auto;
        overflow: visible !important;
    }

    /* Make signin container flow naturally */
    .signin {
        min-height: auto !important;
        height: auto !important;
        padding-bottom: 20px;
        justify-content: flex-start;
    }

    /* Hide background elements that use absolute positioning */
    .signin-container-background,
    .signin-background-photo {
        display: none;
    }

    /* Show logo at half size, below signin container */
    .company-logo {
        display: block;
        position: relative !important;
        bottom: auto;
        right: auto;
        left: auto;
        transform: none;
        width: 120px;
        margin: 15px auto 0 auto;
    }

    .company-logo img {
        width: 100%;
    }

    /* Footer below logo */
    .login-footer {
        position: relative !important;
        bottom: auto;
        left: auto;
        margin-left: 0;
        margin-top: 10px;
        margin-bottom: 15px;
        padding: 10px 0;
        text-align: center;
    }

    /* Ensure form has proper spacing */
    .form-signin {
        margin-bottom: 10px;
    }

    /* Reduce padding to maximize usable space */
    .signin .two-step-code-container {
        padding-bottom: 20px;
    }
}
