/* =====================================================================
   Layout fixes for the ERP.
   - Login page: one card design for every screen size (top of file).
   - Everything else is inside max-width: 767px (phones), so the desktop
     pages are not affected.
   Loaded after the site styles from _Layout.cshtml and Login.cshtml.
   ===================================================================== */

/* Home page date and card titles are for the phone layout only */
.home-date,
.home-card-title {
    display: none;
}

/* ---- Login: a centred glass card over the photo slider (all screen sizes) ---- */

/* login.css paints the phone background yellow (left-over debug rule).
   Login page only: other pages keep their normal background */
body.login-page {
    background-color: #1d1d1d;
}

#login {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* empty spacer column used for desktop centring */
#login > div:first-child:not(.col-xs-8) {
    display: none;
}

#login .col-xs-8 {
    flex: 0 1 380px;
    float: none;
    width: 100%;
    max-width: 380px;
    padding: 0;
    margin: 0;
}

#login .login-from-full-wrap {
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 14px;
    overflow: hidden;
    background-color: rgba(20, 20, 20, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

#login .login-from-full-wrap .panel-heading {
    background-color: rgba(0, 0, 0, 0.6) !important;
    padding: 28px 20px 18px 20px;
}

#login .login-panel .panel-heading .welcome img {
    width: 130px;
    height: auto;
    margin: 0 auto;
}

#login .login-panel .panel-heading .welcome h6 {
    margin: 14px 0 0 0;
    font-size: 14px;
    letter-spacing: 0.3px;
    opacity: 0.9;
}

#login .login-from-full-wrap .panel-body {
    padding: 22px 20px 24px 20px !important;
}

#login .panel-body > br {
    display: none;
}

#login .panel .panel-body .form-group {
    position: relative;
    float: none;
    width: 100%;
    padding: 0;
    margin: 0 0 14px 0;
}

#login .login-from-full-wrap .panel-body input.form-control {
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 44px 0 16px !important;
    border-radius: 8px !important;
    background-color: rgba(0, 0, 0, 0.6);
    font-size: 16px;               /* 16px stops iPhone zooming in on tap */
    color: #fff !important;
}

#login .login-from-full-wrap .panel-body input.form-control::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

#login .form-control-feedback {
    top: 0;
    right: 0;
    width: 44px;
    height: 48px;
    line-height: 48px;
    padding: 0;
    font-size: 17px;
    text-align: center;
}

#login-button-wrap .row {
    margin: 0;
}

#login-button-wrap .col-xs-12 {
    padding: 0;
}

#login-button-wrap .login-button {
    float: none;
    display: block;
    width: 100% !important;
    height: 48px !important;
    padding: 0 !important;
    margin-top: 6px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff !important;
    transition: background-color 0.2s, transform 0.1s;
}

#login-button-wrap .login-button:hover {
    background-color: #f07b17 !important;
}

#login-button-wrap .login-button:active {
    transform: translateY(1px);
}

#login .login-from-full-wrap .panel-body input.form-control:focus {
    box-shadow: 0 0 0 2px rgba(254, 143, 52, 0.85);
}

/* soft dark shade over the photos so the card stands out */
.login-page .globe-home-slider::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(8, 20, 38, 0.55) 0%, rgba(0, 0, 0, 0.25) 100%);
}

.login-footer {
    margin: 16px 0 0 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* larger screens: a slightly bigger card */
@media (min-width: 768px) {
    #login .col-xs-8 {
        flex-basis: 420px;
        max-width: 420px;
    }

    #login .login-from-full-wrap .panel-heading {
        padding: 34px 28px 22px 28px;
    }

    #login .login-from-full-wrap .panel-body {
        padding: 28px 28px 30px 28px !important;
    }

    #login .login-panel .panel-heading .welcome img {
        width: 150px;
    }
}

@media (max-width: 767px) {

    /* ---- Home page: greeting + white cards on a soft grey page ---- */
    .home-page {
        background-color: #f2f4f7;
        margin: -6px -10px 0 -10px;     /* fill the screen edge to edge */
        padding: 18px 14px 24px 14px;
        min-height: calc(100vh - 51px);
    }

    .home-page .home-greeting {
        margin: 0;
        font-size: 22px;
        font-weight: 600;
        line-height: 1.3;
        color: #1f2937;
    }

    .home-page .home-date {
        display: block;
        margin: 4px 0 18px 0;
        font-size: 13px;
        color: #6b7280;
    }

    .home-widgets {
        float: none;
        padding: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .home-widgets > .home-card {
        float: none;
        margin: 0 0 14px 0;
        padding: 14px;
        background-color: #fff;
        border-radius: 14px;
        box-shadow: 0 2px 10px rgba(16, 24, 40, 0.07);
        text-align: center;
        overflow: hidden;
    }

    .home-card-title {
        display: block;
        margin: 0 0 12px 0;
        text-align: left;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.6px;
        text-transform: uppercase;
        color: #6b7280;
    }

    .home-card-title .fa {
        width: 18px;
        color: #22749f;
    }

    .home-widgets > .home-card > iframe,
    .home-widgets > .home-card > div[id^="gcw_main"] {
        display: inline-block;
        vertical-align: top;
        text-align: left;
    }

    .home-widgets > .home-card > iframe + br {
        display: none;
    }

    /* weather fills the card */
    .home-widgets > .home-card > .aw-widget-current {
        display: block;
        text-align: left;
        border-radius: 10px;
        overflow: hidden;
    }

    /* the four videos: 2 x 2 grid */
    .home-widgets > .home-card > .col-xs-12 {
        width: 50%;
        float: left;
        padding: 0 5px 10px 5px;
    }

    .home-widgets > .home-card > .col-xs-12 > iframe {
        width: 100%;
        height: 96px;
        border-radius: 8px;
    }

    /* ---- Page body: start below the fixed top bar (51px) instead of under it ---- */
    #main {
        margin-top: 51px;
        padding: 6px 10px 0 10px;
    }

    /* ---- Menu: the opened hamburger menu scrolls instead of running off the screen ---- */
    .navbar-fixed-top .navbar-collapse {
        max-height: calc(100vh - 51px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Tables: scroll sideways inside their own box, not the whole page ---- */
    .dataTables_wrapper,
    .table-responsive-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Row action menus (edit / print / cancel ...) would be clipped by the
       scrolling box above, so open them inline under the button instead */
    .dataTables_wrapper .table-button-td .dropdown-menu {
        position: static;
        float: none;
        box-shadow: none;
    }

    /* ---- Fixed-width pop-ups that are wider than a phone ---- */
    .multifilter-dropdown {
        width: calc(100vw - 20px);
        right: auto;
        left: 0;
    }

    .profit-details .popover {
        width: auto;
        max-width: calc(100vw - 20px);
    }

    .modal-dialog,
    .modal-lg,
    .modal-sm {
        width: auto;
        margin: 10px;
    }

    /* ---- Images, videos and embedded widgets never wider than the screen ---- */
    #main img,
    #main iframe {
        max-width: 100%;
    }

    /* ---- Tabs (Glass / Accessory / Complex ...) wrap instead of overflowing ---- */
    .nav-tabs > li > a,
    .nav-tabs > li.active > a {
        padding: 8px 10px;
    }

    /* ---- Buttons in a row wrap onto the next line ---- */
    .btn-toolbar,
    .dt-buttons {
        white-space: normal;
    }
}
