/* ===================================================
   Responsive overrides for HV UI
   Breakpoints:
     Large   : >= 1200px  (desktop, existing layout)
     Medium  : 768–1199px (tablet/small laptop)
     Small   : < 768px    (phone)
   =================================================== */

/* ---------- Base: tables inside forms scroll on overflow ---------- */

/* toggleContent scrolls horizontally when table is wider than container */
.main-content .toggleContent {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* tableGrd fills container when smaller, keeps natural width when larger (container scrolls) */
.toggleContent .tableGrd,
.pnlSearchResult .tableGrd,
.main-content .tableGrd {
    min-width: 100%;
}

/* detail and aspGridView stay within container */
.detail,
.aspGridView {
    width: 100%;
    box-sizing: border-box;
}

/* ---------- Medium screens: 768px – 1199px ---------- */
@media (max-width: 1199px) {
    .page-container {
        width: 100%;
    }

    .header {
        background-size: auto 80px;
    }
}

/* ---------- Small screens: < 768px ---------- */
@media (max-width: 767px) {

    /* Header: scroll ngang riêng trong vùng header, không ảnh hưởng phần còn lại của trang.
       position:relative để .sitelogo (absolute) neo đúng vào header thay vì float ra ngoài. */
    .header {
        overflow-x: auto !important;
        overflow-y: visible !important;
        position: relative !important;
        /* Khôi phục chiều cao và background desktop */
        height: 100px !important;
        background-size: auto 100px, cover !important;
        background-position: top left, center center !important;
    }

    /* Giữ nguyên chiều rộng desktop để nội dung tràn ra và tạo scrollbar */
    .header-top,
    .header-bottom,
    .marketInfo {
        min-width: 820px;
    }

    /* Khôi phục về desktop layout */
    .sitelogo    { display: block !important; }
    .header-top  { height: 28px !important; overflow: hidden !important; }
    .header-bottom { height: 40px !important; }
    .motivational-ticker { margin-left: 195px; height: 48px; white-space: nowrap; }
    .ticker-track { animation: ticker-scroll 60s linear infinite; padding-left: 100%; white-space: nowrap; }

    .marketInfo {
        font-size: 11px;
    }

    /* Hamburger toggle button: visible only on mobile */
    .mobile-nav-toggle {
        display: block !important;
        width: 100%;
        background-color: rgb(157, 47, 10);
        color: #fff;
        border: none;
        padding: 10px 16px;
        text-align: left;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        z-index: 100;
    }

    /* Override flex to block on mobile */
    .main {
        display: block;
    }

    /* Sidebar: hidden by default on mobile */
    .main-navigation {
        width: 100% !important;
        flex-basis: auto !important;
        border-right: none;
        display: none;
        background-color: #ECEFE7;
        padding-top: 0;
        cursor: default;
        white-space: normal;
        overflow: visible;
        transition: none;
    }

    /* Show when toggled */
    .main-navigation.mobile-open {
        display: block;
    }

    /* Content: full width on mobile */
    .main-content {
        width: 100%;
        padding-left: 6px;
        padding-right: 6px;
        box-sizing: border-box;
    }

    /* Hide collapse icon on mobile */
    .nav-toggle-hint {
        display: none;
    }

    /* Make data tables scroll horizontally */
    .toggleContent,
    #main-content .pnlSearch,
    #main-content .pnlUpload {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.detail,
    table.tableGrd,
    .aspGridView table,
    .ui-jqgrid {
        min-width: 600px;
    }

    /* Button panels: wrap on small screens */
    .btnPanel,
    .buttonPanel {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .icon-button,
    [class*="icon-button"] {
        margin: 2px !important;
    }

    /* Form fields: full width */
    .detail td.data input[type="text"],
    .detail td.data select,
    .detail td.data textarea {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Function name breadcrumb */
    p.functionName {
        font-size: 11px;
        word-break: break-word;
    }
}

/* ---------- Hide hamburger on desktop ---------- */
@media (min-width: 768px) {
    .mobile-nav-toggle {
        display: none !important;
    }
}

/* ---------- Print: keep fixed 960px layout ---------- */
@media print {
    .mobile-nav-toggle {
        display: none !important;
    }
}
