/*
 * Responsive cho template Joomla cũ (cố định 960px) — dulichmucangchai.com.vn v2.
 *
 * NGUYÊN TẮC: màn hình >= 992px giữ nguyên giao diện cũ từng pixel. Bootstrap 5.3.8 chỉ được nạp cho < 992px
 * (link media="(max-width: 991.98px)"), toàn bộ quy tắc dưới đây cũng nằm trong media query.
 * Các id/class bố cục dùng style inline (width: 960px...) → cần !important để ghi đè.
 */

/* Nút mở menu (chỉ có trên mobile) — desktop ẩn */
.mcc-menu-toggle { display: none; }

@media (max-width: 991.98px) {
    html, body { overflow-x: hidden; }
    body { font-size: 15px; }

    /* Bootstrap reboot đổi box-sizing → template cũ tính theo content-box */
    #jm-page-gradient *, #jm-page-gradient *::before, #jm-page-gradient *::after { box-sizing: content-box; }
    #jm-page-gradient input, #jm-page-gradient select, #jm-page-gradient textarea, #jm-page-gradient button,
    .mcc-menu-toggle { box-sizing: border-box; }

    /* ---- Khung trang: bỏ độ rộng cố định -------------------------------------------------------- */
    #jm-page-center, #jm-top, #jm-main, #jm-main-wrap, #jm-main-in, #jm-content, #jm-left, #jm-right,
    #jm-bottom, #jm-footer-in, #jm-djmenu-left, #jm-djmenu-right, #jm-djmenu-bg, #jm-djmenu, #jm-djmenu-top1,
    #jm-page-gradient .clearfix[style*="960px"] {
        width: auto !important;
        max-width: 100% !important;
        float: none !important;
    }
    #jm-top, #jm-main, #jm-bottom, #jm-footer-in { margin-left: 8px !important; margin-right: 8px !important; }
    #jm-main { padding-left: 0 !important; padding-right: 0 !important; }
    #jm-content-in { padding: 10px !important; }

    /* Nội dung trước, cột trái (danh mục, điểm đến, tour nổi bật) xuống dưới */
    #jm-main-in { display: flex !important; flex-direction: column; }
    #jm-main-in > #jm-content { order: 1; margin: 0 !important; }
    #jm-main-in > #jm-left { order: 2; margin: 20px 0 0 !important; }

    /* ---- Header ---------------------------------------------------------------------------------- */
    #jm-logo-sitedesc { float: none !important; padding: 12px 0 8px !important; text-align: center; }
    #jm-logo { font-size: 28px !important; line-height: 1.2 !important; margin: 0 !important; }
    #jm-sitedesc { margin: 4px 0 0 !important; }
    #jm-top-modules { float: none !important; padding: 0 0 10px !important; }
    #jm-smallmenu { text-align: center; float: none !important; }
    #jm-smallmenu ul.menu { display: inline-block; float: none !important; margin: 0 !important; padding: 0 !important; }
    #jm-search { float: none !important; padding: 8px 0 0 !important; }
    #jm-search .search { display: flex; gap: 6px; align-items: center; }
    #jm-search .inputbox { flex: 1 1 auto; width: auto !important; min-width: 0; height: 38px; font-size: 16px; }

    /* ---- Menu ngang → menu dọc mở bằng nút ------------------------------------------------------- */
    .mcc-menu-toggle {
        display: flex; align-items: center; gap: 8px; width: 100%;
        padding: 10px 14px; border: 0; border-radius: 6px;
        background: #4a4637 url(djmenu_bg.jpg) repeat-x; color: #f3ead6;
        font: 600 17px/1.2 "Times New Roman", Times, serif; text-align: left;
    }
    .mcc-menu-toggle .mcc-burger { display: inline-block; width: 22px; height: 2px; background: currentColor;
        box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor; margin: 0 6px 0 2px; }
    #jm-djmenu-left, #jm-djmenu-right, #jm-djmenu-bg { background: none !important; padding: 0 !important; height: auto !important; }
    #jm-djmenu-left { margin: 0 8px 14px !important; }
    #jm-djmenu { height: auto !important; }
    #jm-djmenu ul.dj-main { display: none; margin: 6px 0 0 !important; padding: 6px 0 !important; height: auto !important;
        background: #f0e8d9; border-radius: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
    #jm-djmenu.mcc-open ul.dj-main { display: block; }
    #jm-djmenu ul.dj-main li { float: none !important; display: block !important; width: auto !important;
        height: auto !important; background: none !important; margin: 0 !important; }
    #jm-djmenu ul.dj-main a.dj-up_a, #jm-djmenu ul.dj-main a.dj-more {
        display: block !important; float: none !important; height: auto !important; padding: 10px 16px !important;
        line-height: 1.3 !important; color: #5a3d1e !important; background: none !important; font-size: 16px !important;
        border-bottom: 1px solid rgba(0, 0, 0, .06);
    }
    #jm-djmenu ul.dj-main a.dj-up_a span { background: none !important; padding: 0 !important; height: auto !important;
        line-height: 1.3 !important; color: inherit !important; }
    /* Menu con hiện sẵn, thụt lề (không dùng hover trên cảm ứng) */
    #jm-djmenu ul.dj-main ul, #jm-djmenu ul.dj-main ul.dj-submenu {
        position: static !important; display: block !important; visibility: visible !important; opacity: 1 !important;
        width: auto !important; height: auto !important; margin: 0 !important; padding: 0 0 0 16px !important;
        background: none !important; box-shadow: none !important; transform: none !important; left: auto !important;
    }
    #jm-djmenu ul.dj-main li.submenu_top, #jm-djmenu ul.dj-main li.submenu_bot { display: none !important; }
    #jm-djmenu ul.dj-main a.dj-more { font-size: 15px !important; }
    #jm-djmenu ul.dj-main a { text-decoration: none !important; }
    #jm-smallmenu a { text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }

    /* ---- Slider ảnh trang chủ: thu nhỏ đúng tỉ lệ (responsive.js đặt --mcc-zoom) ---------------------- */
    #djslider-loader105 { zoom: var(--mcc-zoom, 1); }
    #jm-ribbon { display: none; }
    #jm-main-wrap { margin-top: 10px !important; background: none !important; }

    /* ---- Nội dung ------------------------------------------------------------------------------- */
    #jm-page-gradient img { max-width: 100%; height: auto; }
    #jm-page-gradient iframe, #jm-page-gradient video, #jm-page-gradient embed { max-width: 100% !important; }
    #jm-page-gradient table { display: block; max-width: 100%; overflow-x: auto; }
    #jm-content h1, #jm-content h2 { font-size: 24px !important; line-height: 1.3 !important; }
    .djc_item, .djc_item.pull_left { width: 50% !important; }
    .djc_mainimage { width: auto !important; height: auto !important; }
    .djc_label, .djc_attribute-label { width: 40% !important; }
    .djc_contact_form input[type="text"], .djc_contact_form select, .djc_contact_form textarea,
    #djc_contact_form input[type="text"], #djc_contact_form select, #djc_contact_form textarea, .txtText {
        width: 100% !important; max-width: 100% !important; font-size: 16px;
    }
    .pagination { flex-wrap: wrap; }

    /* ---- Chân trang ----------------------------------------------------------------------------- */
    #jm-bottom-in, #jm-footer-in { padding-left: 10px !important; padding-right: 10px !important; }
    #jm-bottom .jm-module, #jm-bottom [class*="jm-col"], #jm-bottom-in > div { float: none !important; width: auto !important; }
}

@media (max-width: 575.98px) {
    .djc_item, .djc_item.pull_left { width: 100% !important; float: none !important; }
    #jm-logo { font-size: 24px !important; }
    #jm-smallmenu ul.menu li { font-size: 14px; }
    .djc_label, .djc_attribute-label { width: 100% !important; float: none !important; }
}
