/* ==========================================================================
   CYMA ESS - Mobile / Responsive Overrides
   Breakpoints:
     - <= 1023px  (tablet + phone layout)
     - <=  767px  (phone layout)
   ========================================================================== */


/* ---------------------------
   Shared component layout
   --------------------------- */

/* Event calendar desktop/tablet layout */
.EventCalendarLayout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.EventCalendarMain {
    flex: 1 1 auto;
    min-width: 0;
}

.EventCalendarDetail {
    flex: 0 0 320px;
    width: 320px;
    box-sizing: border-box;
}

.EventDetailBody {
    border: 1px solid #ccc;
    padding: 12px;
    background: #fff;
    min-height: 80px;
    box-sizing: border-box;
}

.CalendarMobileMessage {
    display: none;
}


/* ---------------------------
   1) Tablet + Phone (<=1023)
   --------------------------- */
@media (max-width: 1023px) {

    /* Fluid outer container */
    #PortalContainer {
        width: auto;
        margin: 2px 5px;
        box-sizing: border-box;
    }

    #PortalSubContainer {
        width: 100%;
    }

    /* Fluid main content area */
    #PortalMainContent {
        width: auto;
        margin-left: 0;
    }

    /* Fluid header */
    #PortalHeaderContainer {
        width: 100%;
        box-sizing: border-box;
    }

    /* viewWrap used in EmpContInfo and SuperCheckHist */
    .viewWrap {
        width: auto;
        box-sizing: border-box;
    }

    /* FeatureHours centered div */
    div.FeatureHours_Center {
        width: auto;
        margin: 0 auto;
    }
}


/* ---------------------------
   2) Phone (<=767)
   --------------------------- */
@media (max-width: 767px) {

    /* Keep font readable; avoid tiny text on iOS */
    html, body {
        font-size: 14px;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
        transform: scale(1);
    }

    /* Horizontal scrolling wrapper for grids/tables */
    .grid-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack all hpanel variants (hpanelLeft, hpanelRight, etc.) */
    div[class^="hpanel"],
    div[class*=" hpanel"] {
        display: block;
        width: 100%;
        margin-right: 0;
        padding-left: 0;
        box-sizing: border-box;
    }

    /* hbox containers that wrap hpanels */
    div.hbox,
    div.hbox_noborder {
        width: 100%;
    }

    /* Stack header text */
    .PortalHeaderTextName,
    .PortalHeaderTextDate {
        width: 100%;
        float: none;
        text-align: left;
        display: block;
    }

    /* Login card */
    #UserLoginTable {
        width: 92%;
        margin: 20px auto;
        box-sizing: border-box;
    }

    .UserLoginContent {
        width: 100%;
        box-sizing: border-box;
    }

        .UserLoginContent input,
        .UserLoginContent select,
        .UserLoginContent textarea {
            font-size: 16px;
        }

    /* Stack label above input (table-based forms) */
    td.FormLabel,
    td.FormLabel2,
    td.FormLabel_padded {
        display: block;
        width: auto;
        padding-bottom: 2px;
    }

    td.FormValue,
    td.FormValue2 {
        display: block;
        width: auto;
        margin-bottom: 10px;
    }

    /* Reorder: User Info above Menu */
    #PortalMenuContainer {
        display: flex;
        flex-direction: column;
    }

    .UserInfoMenu {
        order: -1;
        width: 100%;
        float: none;
    }

    /* Calendar / home page image overflow */
    #Center img,
    #EventCalendar img {
        max-width: 100%;
        height: auto;
    }

    #EventCalendar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Background watermark image — clip rather than overflow */
    #PortalMainContent {
        overflow: hidden;
    }

    /* Password UI wrappers */
    .password-wrapper {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .password-box {
        width: 100%;
        box-sizing: border-box;
    }

    /* Event calendar stacks on phones */
    .EventCalendarLayout {
        display: block;
    }

    .EventCalendarDetail {
        width: 100%;
        margin-top: 15px;
    }
}


/* ---------------------------
   3) Tablet (768 - 1023)
   --------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Tablet: wider login card */
    #UserLoginTable {
        width: 50%;
        margin: 40px auto;
    }

    .UserLoginContent {
        width: 100%;
    }
}


/* ==========================================================================
   4) Mobile Menu (Hamburger + Drill-Down Panel)
   ========================================================================== */

/* Desktop defaults */
.mobile-menu-btn {
    display: none;
}

.desktop-nav {
    display: block;
}

.mobile-nav {
    display: none;
}

/* Phone behavior */
@media (max-width: 767px) {

    .mobile-menu-btn {
        display: block;
        width: 100%;
        padding: 10px 14px;
        background: #333;
        color: #fff;
        border: none;
        font-size: 16px;
        text-align: left;
        cursor: pointer;
        border-radius: 4px;
        margin: 6px 0 4px 0;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-nav {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99999;
        background: rgba(0, 0, 0, 0.25);
        opacity: 0;
        pointer-events: none;
        transition: opacity .15s ease-in-out;
    }

        .mobile-nav.open {
            opacity: 1;
            pointer-events: auto;
        }

    .mobile-nav-panel {
        position: absolute;
        top: 110px;
        left: 10px;
        right: 10px;
        bottom: 10px;
        background: #fff;
        border: 1px solid #ddd;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
        display: flex;
        flex-direction: column;
        border-radius: 4px;
        overflow: hidden;
    }

    .mn-header {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-bottom: 1px solid #e0e0e0;
        background: #f6f6f6;
    }

    .mn-title {
        flex: 1;
        font-weight: 600;
    }

    .mn-back,
    .mn-close {
        border: none;
        background: transparent;
        font-size: 18px;
        cursor: pointer;
        padding: 4px 8px;
    }

    .mn-level {
        flex: 1 1 auto;
        overflow-y: auto;
        transition: transform .2s ease;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 0;
        list-style: none;
        display: none;
    }

        .mn-level.active {
            display: block;
        }

        .mn-level.mn-drilled > li {
            display: none;
        }

            .mn-level.mn-drilled > li.mn-current {
                display: block;
            }

                .mn-level.mn-drilled > li.mn-current > a.mn-link {
                    display: none;
                }

    .mn-item {
        border-bottom: 1px solid #eaeaea;
    }

        .mn-item > .mn-level {
            padding: 0;
            margin: 0;
        }

    .mn-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        font-size: 16px;
        text-decoration: none;
        color: #111;
    }

    .mn-arrow {
        opacity: 0.7;
    }
}


/* ======================================================================
   5) Two-Factor pages (Verify + Setup) - Phone (<=767px)
   ====================================================================== */
/* ======================================================================
   5) Two-Factor pages (Verify + Setup) - Phone (<=767px)
   ====================================================================== */
@media (max-width: 767px) {

    /* Shared page spacing */
    .TwoFactorVerifyPage,
    .TwoFactorSetupPage {
        padding: 14px 0 !important;
    }

        /* Shared white card */
        .TwoFactorVerifyPage .hboxTwoFactorVerify,
        .TwoFactorVerifyPage .hboxTwoFactor,
        .TwoFactorSetupPage .hboxTwoFactor {
            width: calc(100% - 24px) !important;
            max-width: 420px !important;
            margin: 0 auto !important;
            min-height: 0 !important;
            height: auto !important;
            padding: 28px 28px 22px 28px !important;
            box-sizing: border-box !important;
            overflow: visible !important;
            background: #fff !important;
            border: 3px solid #000 !important;
            display: block !important;
        }

            .TwoFactorVerifyPage .hboxTwoFactorVerify::after,
            .TwoFactorVerifyPage .hboxTwoFactor::after,
            .TwoFactorSetupPage .hboxTwoFactor::after {
                content: "";
                display: block;
                clear: both;
            }

        /* Shared title */
        .TwoFactorVerifyPage .TwoFactorTitle,
        .TwoFactorSetupPage .TwoFactorTitle {
            display: block !important;
            width: auto !important;
            max-width: 100% !important;
            margin: 0 0 22px 0 !important;
            font-size: 24px !important;
            line-height: 1.2 !important;
        }

        /* Shared float cleanup */
        .TwoFactorVerifyPage .floatLeft,
        .TwoFactorVerifyPage .floatRight,
        .TwoFactorSetupPage .floatLeft,
        .TwoFactorSetupPage .floatRight {
            float: none !important;
            width: 100% !important;
        }

        /* Shared text/input rhythm */
        .TwoFactorVerifyPage label,
        .TwoFactorVerifyPage span,
        .TwoFactorVerifyPage div,
        .TwoFactorSetupPage label,
        .TwoFactorSetupPage span,
        .TwoFactorSetupPage div {
            line-height: 1.35;
        }

        .TwoFactorVerifyPage #tbAuthCode,
        .TwoFactorVerifyPage .RadInput,
        .TwoFactorVerifyPage .riTextBox,
        .TwoFactorSetupPage #tbAuthCode,
        .TwoFactorSetupPage #tbManualCode,
        .TwoFactorSetupPage .manualCode,
        .TwoFactorSetupPage .manualCode .rbDecorated,
        .TwoFactorSetupPage .RadInput,
        .TwoFactorSetupPage .riTextBox {
            width: 100% !important;
            max-width: 100% !important;
            box-sizing: border-box !important;
        }

        /* =========================
       VERIFY PAGE
       ========================= */

        .TwoFactorVerifyPage .hpanelLeftTwoFactor {
            width: 100% !important;
            float: none !important;
            margin: 0 !important;
            padding: 0 !important;
            display: block !important;
            text-align: left !important;
            min-height: 0 !important;
            height: auto !important;
            overflow: visible !important;
        }

        .TwoFactorVerifyPage #tbAuthCode {
            margin-top: 8px !important;
            margin-bottom: 18px !important;
        }

        .TwoFactorVerifyPage #rlbReset {
            display: inline-block !important;
            margin: 4px 0 18px 0 !important;
            padding: 8px 0 !important;
            font-size: 16px !important;
            line-height: 1.2 !important;
        }

        .TwoFactorVerifyPage .hpanelLeftTwoFactor .floatRight {
            display: flex !important;
            justify-content: flex-end !important;
            gap: 10px !important;
            flex-wrap: nowrap !important;
            width: 100% !important;
            margin: 0 !important;
            clear: both !important;
        }

            .TwoFactorVerifyPage .hpanelLeftTwoFactor .floatRight .RadButton,
            .TwoFactorVerifyPage .hpanelLeftTwoFactor .floatRight input,
            .TwoFactorVerifyPage .hpanelLeftTwoFactor .floatRight button {
                flex: 0 0 auto;
            }

        /* =========================
       SETUP PAGE
       ========================= */

        .TwoFactorSetupPage .hpanelCenterTwoFactor {
            display: none !important;
        }

        .TwoFactorSetupPage .hpanelLeftTwoFactor,
        .TwoFactorSetupPage .hpanelRightTwoFactor {
            width: 100% !important;
            float: none !important;
            margin: 0 !important;
            padding: 0 !important;
            display: block !important;
        }

        .TwoFactorSetupPage .hpanelRightTwoFactor {
            margin-top: 16px !important;
            text-align: center !important;
        }

        .TwoFactorSetupPage ol {
            margin: 12px 0 0 0 !important;
            padding-left: 22px !important;
        }

        .TwoFactorSetupPage .PadLeft25px {
            padding-left: 0 !important;
        }

        .TwoFactorSetupPage #imgQrCode {
            display: block;
            margin: 10px auto 0 auto;
            width: 100%;
            max-width: 220px;
            height: auto;
        }

        .TwoFactorSetupPage .hpanelLeftTwoFactor .floatRight {
            display: flex !important;
            gap: 10px !important;
            margin-top: 14px !important;
        }

            .TwoFactorSetupPage .hpanelLeftTwoFactor .floatRight .RadButton {
                flex: 1 1 0;
                min-width: 0;
            }

        .TwoFactorSetupPage #lblManualCode,
        .TwoFactorSetupPage #tbManualCode {
            display: block !important;
            clear: both !important;
            width: 100% !important;
            margin-top: 10px !important;
            text-align: left !important;
        }

        .TwoFactorSetupPage #btnTwoFactorCode {
            display: inline-block !important;
            margin-top: 8px !important;
        }
}

/* ======================================================================
   6) Scheduler portrait/landscape behavior on phones
   ====================================================================== */

/* Phone portrait: hide scheduler, show message */
@media (max-width: 767px) and (orientation: portrait) {
    .Calendar {
        display: none;
    }

    .CalendarMessage,
    .EventCalendarDetail {
        display: none;
    }

    .CalendarMobileMessage {
        display: block;
        margin: 15px 0;
        padding: 14px 16px;
        background: #f5f5f5;
        border: 1px solid #ccc;
        font-size: 16px;
        line-height: 1.4;
        text-align: center;
    }
}

/* Phone landscape: show scheduler and keep mobile page layout */
@media (max-height: 500px) and (orientation: landscape) {
    #PortalContainer {
        width: auto;
        margin: 2px 5px;
        box-sizing: border-box;
    }

    #PortalMainContent {
        width: auto;
        margin-left: 0;
    }

    #PortalMenuContainer {
        display: flex;
        flex-direction: column;
    }

    .UserInfoMenu {
        order: -1;
        width: 100%;
        float: none;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
        width: 100%;
    }

    .Calendar {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .CalendarMobileMessage {
        display: none;
    }

    .EventCalendarLayout {
        display: block;
    }

    .EventCalendarDetail {
        display: none;
    }

    .Calendar .RadScheduler {
        width: 100% !important;
    }
}


/* ==========================================================================
   PersonalInfo.aspx responsive fixes
   ========================================================================== */

@media (max-width: 767px) {

    /* Header */
    .SectionHeader .floatLeft,
    .SectionHeader .floatRight {
        float: none !important;
        display: block;
        width: 100%;
        text-align: left;
    }

    .SectionHeader .floatRight {
        margin-top: 8px;
    }

        .SectionHeader .floatRight input,
        .SectionHeader .floatRight img {
            max-width: 100%;
            height: auto;
        }

    /* Main Personal Information section: keep label/value on same line */
    .personal-info-form {
        margin: 8px !important;
    }

        .personal-info-form table.personal-info-table,
        .personal-info-form table.personal-info-view-table,
        .personal-info-form table.personal-info-edit-table {
            width: 100%;
            border-collapse: collapse;
            table-layout: fixed;
        }

            .personal-info-form table.personal-info-table tr,
            .personal-info-form table.personal-info-view-table tr,
            .personal-info-form table.personal-info-edit-table tr {
                display: table-row !important;
            }

            .personal-info-form table.personal-info-table td,
            .personal-info-form table.personal-info-view-table td,
            .personal-info-form table.personal-info-edit-table td {
                display: table-cell !important;
                vertical-align: top;
                padding: 8px 6px 8px 0 !important;
                text-align: left !important;
                box-sizing: border-box;
            }

                .personal-info-form table.personal-info-table td.FormLabel,
                .personal-info-form table.personal-info-view-table td.FormLabel,
                .personal-info-form table.personal-info-edit-table td.FormLabel {
                    width: 115px !important;
                    min-width: 115px !important;
                    white-space: nowrap;
                    font-weight: bold;
                    padding-right: 10px !important;
                }

                .personal-info-form table.personal-info-table td.FormValue,
                .personal-info-form table.personal-info-table td.FormValue2,
                .personal-info-form table.personal-info-view-table td.FormValue,
                .personal-info-form table.personal-info-view-table td.FormValue2,
                .personal-info-form table.personal-info-edit-table td.FormValue,
                .personal-info-form table.personal-info-edit-table td.FormValue2,
                .personal-info-form table.personal-info-table td:not(.FormLabel),
                .personal-info-form table.personal-info-view-table td:not(.FormLabel),
                .personal-info-form table.personal-info-edit-table td:not(.FormLabel) {
                    width: auto !important;
                }

        .personal-info-form .FormValue label,
        .personal-info-form .FormValue2 label,
        .personal-info-form .FormValue span,
        .personal-info-form .FormValue2 span {
            display: inline !important;
        }

        /* Telerik / input sizing */
        .personal-info-form .RadInput,
        .personal-info-form .RadInputMgr,
        .personal-info-form .RadPicker,
        .personal-info-form .RadComboBox,
        .personal-info-form .riTextBox,
        .personal-info-form .rcbInner,
        .personal-info-form input[type="text"],
        .personal-info-form input[type="email"],
        .personal-info-form input[type="tel"],
        .personal-info-form select,
        .personal-info-form textarea {
            width: 100% !important;
            max-width: 100% !important;
            box-sizing: border-box;
        }

        /* Make value text line up nicely in view mode */
        .personal-info-form .FormValue,
        .personal-info-form .FormValue2 {
            font-size: 16px;
            line-height: 1.35;
        }

    /* Contact section can stack */
    .personal-contact-form table {
        width: 100%;
        border-collapse: collapse;
    }

    .personal-contact-form tr {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }

    .personal-contact-form td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding-right: 0;
        text-align: left !important;
    }

        .personal-contact-form td.FormLabel {
            font-weight: bold;
            padding-bottom: 4px;
        }

        .personal-contact-form td.FormValue,
        .personal-contact-form td.FormValue2 {
            margin-bottom: 8px;
        }

    .personal-contact-form input[type="text"],
    .personal-contact-form input[type="email"],
    .personal-contact-form input[type="tel"],
    .personal-contact-form .RadInput,
    .personal-contact-form .RadPicker,
    .personal-contact-form .RadComboBox,
    .personal-contact-form .riTextBox,
    .personal-contact-form .rcbInner {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .personal-contact-form .PhoneGridHeader {
        display: none;
    }

    .personal-contact-form tr.data-row {
        border: 1px solid #d8d8d8;
        padding: 10px;
        margin-bottom: 12px;
        background: #fafafa;
    }

        .personal-contact-form tr.data-row td {
            padding: 3px 0;
        }

            .personal-contact-form tr.data-row td::before {
                display: block;
                font-weight: bold;
                margin-bottom: 2px;
                color: #333;
            }

            .personal-contact-form tr.data-row td.phone-type::before {
                content: "Type";
            }

            .personal-contact-form tr.data-row td.phone-number::before {
                content: "Phone / Fax / Email";
            }

            .personal-contact-form tr.data-row td.phone-desc::before {
                content: "Description";
            }

    .personal-grid-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

        .personal-grid-wrap .RadGrid,
        .personal-grid-wrap .rgMasterTable,
        .personal-grid-wrap table {
            min-width: 620px;
        }

    .RadWindow,
    .rwWindow {
        width: 94vw !important;
        max-width: 94vw !important;
        left: 3vw !important;
    }

        .rwContent,
        .RadWindow .rwContent {
            width: auto !important;
            box-sizing: border-box;
        }
}

@media (min-width: 768px) and (max-width: 1023px) {

    .personal-info-form table.personal-info-table,
    .personal-contact-form table {
        width: 100%;
    }

    .personal-info-form .RadInput,
    .personal-info-form .RadPicker,
    .personal-info-form .RadComboBox,
    .personal-contact-form .RadInput,
    .personal-contact-form .RadComboBox {
        max-width: 100%;
    }
}


/* ==========================================================================
   Emergency contacts grid 
   ========================================================================== */

.EmergencyContactsMobileMessage {
    display: none;
}

@media (max-width: 767px) and (orientation: portrait) {
    .EmergencyContactsMobileMessage {
        display: block;
        margin: 12px 0;
        padding: 14px 16px;
        background: #f5f5f5;
        border: 1px solid #ccc;
        font-size: 16px;
        line-height: 1.4;
        text-align: center;
    }

    .personal-grid-wrap {
        display: none !important;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .EmergencyContactsMobileMessage {
        display: none;
    }

    .personal-grid-wrap {
        display: block !important;
    }
}


.EmailHRMobileMessage {
    display: none;
}

/* Phone portrait: hide Email HR form, show rotate message */
@media (max-width: 767px) and (orientation: portrait) {
    .EmailHRPage {
        display: none !important;
    }

    .EmailHRMobileMessage {
        display: block;
        margin: 15px 0;
        padding: 14px 16px;
        background: #f5f5f5;
        border: 1px solid #ccc;
        font-size: 16px;
        line-height: 1.4;
        text-align: center;
    }
}

/* Phone landscape: show Email HR form */
@media (max-height: 500px) and (orientation: landscape) {
    .EmailHRPage {
        display: block !important;
    }

    .EmailHRMobileMessage {
        display: none !important;
    }

    .EmailHRPage table {
        width: 100% !important;
    }

    .EmailHRPage input[type="text"],
    .EmailHRPage textarea,
    .EmailHRPage select {
        max-width: 100%;
        box-sizing: border-box;
    }
}
