/* ==============================
   GLOBAL LAYOUT / RESET
   ============================== */

html,
body {
    height: 100%;
}

body {
    margin: 0;
    padding-top: 70px;
    font-family: "Lato", sans-serif;
    background-color: #fff;
    color: #212529;
    box-sizing: border-box;
}

/* Layout wrapper so footer sticks to bottom */
.wrapper {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

#mainContent,
#welcomeMessage {
    flex: 1 0 auto;
}

/* ==============================
   HEADER (TOP BLUE BAR)
   ============================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #4595FD;
    height: 70px;
    width: 100%;
    padding: 0 16px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.header img {
    height: 54px;
    width: auto;
}

/* Center title between logo & right side content */
.header_content {
    flex: 1;
    text-align: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

/* Right side: email + icons */
.header-icons {
    display: flex;
    gap: 14px;
    align-items: center;
}

#userEmail {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Home / logout icons */
.header-icons a {
    color: #fff;
    font-size: 22px;
    text-decoration: none;
}

.header-icons a:hover {
    color: #DDD;
}

/* Hamburger icon (mobile only) */
.menu-icon {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
}

/* ==============================
   SUBNAV (L2)
   ============================== */

.subnav {
    display: none;
}

@media (min-width:768px) {
    .subnav {
        display: flex;
        position: sticky;
        top: 70px;
        left: 0;
        background: #f9f9f9;
        border-top: 1px solid #ddd;
        padding: 8px 16px;
        z-index: 999;
        font-weight: 600;
        color: #333;
        justify-content: flex-start;
        /* like live screen */
    }

    .subnav a {
        color: #333;
        text-decoration: none;
        padding: 6px 8px;
    }

    .subnav a:hover {
        color: #4595FD;
        text-decoration: underline;
    }
}

/* ==============================
   L3 UNIT STRIP
   (background bar fixed; links appear only
   when PR screen is open AND strip has .show)
   ============================== */

/* Default: hide strip until PR screen is active */
.unit-strip {
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    padding: 6px 16px;
    font-weight: 600;
    min-height: 30px;
    /* reserve height when shown */
    display: flex;
    /* HIDDEN by default */
    align-items: center;
}

/* Show the bar only when body.has-pr-screen is set by JS */
body.has-pr-screen .unit-strip {
    display: flex;
}

/* Links inside the strip */
.unit-strip-links {
    display: none;
    /* hidden until .show is added */
    align-items: center;
}

/* When JS adds .show, expose the links */
.unit-strip.show .unit-strip-links {
    display: flex;
}

.unit-link {
    margin-right: 30px;
    color: #000;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 3px 10px;
    border-radius: 2px;
}

.unit-link:hover {
    background: #e6f1ff;
    /* very light blue on hover */
    text-decoration: none;
}

.unit-link.active {
    background: #e6f1ff;
    /* very light blue when selected */
    text-decoration: none;
}

/* ==============================
   MAIN CONTENT / FOOTER
   ============================== */

.content {
    max-width: 1000px;
    margin: auto;
    padding: 20px;
    text-align: center;
}

.rfq-container {
    margin-top: 5px;
    padding: 10px;
    width: 98vw;
    max-width: 98vw;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.footer-bottom {
    background: #002140;
    text-align: center;
    padding: 16px 0;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

/* ==============================
   DRAWER / SIDE MENU
   ============================== */

.drawer {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100%;
    width: 260px;
    background: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, .15);
    z-index: 2000;
    transition: left .3s ease-in-out;
    padding-top: 70px;
    /* below header */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.drawer.open {
    left: 0;
}

.drawer .menu-top {
    padding-bottom: 20px;
}

.drawer a {
    display: block;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.drawer a:hover {
    background: #f9f9f9;
    color: #4595FD;
}

.drawer .submenu {
    display: none;
    padding-left: 20px;
}

.drawer .submenu a {
    font-size: .9rem;
}

.drawer .expandable.active+.submenu {
    display: block;
}

.drawer .logout-link {
    border-top: 1px solid #eee;
    margin-top: auto;
    text-align: center;
    padding: 16px;
}

/* Mobile unit list inside drawer
   – only when PR screen is active */
.plant-list-mobile {
    display: none;
    padding-top: 10px;
}

body.has-pr-screen .plant-list-mobile {
    display: block;
}

.plant-list-mobile .unit-mobile-item {
    display: block;
    padding: 10px 20px;
    border-top: 1px solid #f0f0f0;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
}

.plant-list-mobile .unit-mobile-item.active {
    background: #e6f1ff;
    color: #000;
}

/* ==============================
   MOBILE HEADER BEHAVIOUR
   ============================== */

@media (max-width:768px) {

    /* hide icons (home/logout) – keep email */
    .header-icons a {
        display: none;
    }

    .menu-icon {
        display: inline-block;
    }

    .header {
        padding: 0 8px;
    }

    /* Reorder items for better layout on narrow screens */
    .header>a {
        order: 1;
        /* logo */
    }

    .header_content {
        order: 2;
        font-size: 1.2rem;
        padding: 0 4px;
        text-align: center;
    }

    .header-icons {
        order: 3;
        display: flex;
        align-items: center;
        margin-left: auto;
        /* push to the right edge */
    }

    .menu-icon {
        order: 4;
        margin-left: 8px;
    }
}

/* ==============================
   MISC FORM / POPUP STYLES
   ============================== */

.editable-section {
    border-top: 1px solid #ccc;
    margin-top: 10px;
    padding-top: 10px;
}

.dx-popup-content .source-section {
    border-bottom: 1px solid #ccc;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

/* ==============================
   LOADING OVERLAY
   ============================== */

#loadingOverlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .8);
    z-index: 3000;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#loadingOverlay.on {
    display: flex;
}

.spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid #cfe2ff;
    border-top-color: #4595FD;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loadingMsg {
    color: #002140;
    font-weight: 600;
    margin-top: 12px;
}

/* ==============================
   RFQ / PR QUOTATION MODULE
   (Level 1 – Header grid)
   ============================== */

/* Title at top of Level-1 screen */
.rfq-title {
    margin-top: 20px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 20px;
    color: #003366;
}

/* Wrap the grid so we can center it and allow horizontal scroll */
.grid-wrap {
    width: 100%;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    /* center inner grid container */
}

/* Level-1 grid container:
   tuned for 1366×768 but still OK on others */
#rfqHeaderGrid {
    width: 100%;
    min-width: 700px;
    max-width: 900px;
    margin: 20px auto;
    background-color: #fff;
}

/* Optional pre-defined containers for Level-2 / Level-3 */
#rfqLinesGrid,
#quotationForm {
    width: 98%;
    max-width: 1400px;
    margin: 10px auto;
}

#quotationFormButtons {
    margin-top: 20px;
    text-align: right;
}

/* Level-1 RFQ container: fixes width & side space on all grids */
.rfq-level1-container {
    max-width: 1200px;
    /* good for 1366×768 */
    margin: 0 auto 40px;
    /* center, some bottom breathing room */
    padding: 0 16px;
    /* little left/right space */
}

/* Title centred above the container */
.rfq-title {
    margin: 20px auto 10px;
    text-align: center;
    font-weight: 600;
    font-size: 20px;
    color: #003366;
}

/* Horizontal scroll if columns overflow */
.grid-wrap {
    width: 100%;
    overflow-x: auto;
}

/* DevExtreme grid width */
#rfqHeaderGrid {
    min-width: 900px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 🔹 Hide DataGrid's own Save / Cancel buttons in form mode */
.dx-datagrid-form-buttons-container {
    display: none !important;
}

/* 🔹 Our custom toolbar under the form */ 
#quotationFormButtons {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    /* left & right groups */
    align-items: center;
}

#quotationFormButtons .qbtn-right {
    display: flex;
    gap: 10px;
    /* spacing between Confirm / Save / Close */
}