/* ==========================================================================
   Comprehensive Responsive Stylesheet for Máy Xây Dựng Hoàng Phúc
   Supports Desktop (>=1200px), Tablet (768px-1199px), Mobile (<768px)
   ========================================================================== */

/* Universal Responsive Base */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container fluid responsive sizing */
.container {
    width: 100%;
    max-width: 1230px;
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .container {
        width: 750px;
    }
}

@media (min-width: 992px) {
    .container {
        width: 970px;
    }
}

@media (min-width: 1200px) {
    .container {
        width: 1170px;
    }
}

@media (min-width: 1300px) {
    .container {
        width: 1230px;
    }
}

/* ==========================================================================
   Tablet & Medium Devices (max-width: 991px)
   ========================================================================== */
@media (max-width: 991px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Header adjustments */
    .header-top {
        display: block !important;
        background: #f6f6f6;
        padding: 9px 0 7px 0;
        font-size: 12px;
        color: #292929;
    }
    .header-top .col-md-6 {
        text-align: center !important;
        margin-bottom: 4px;
        line-height: 1.4;
    }
    .header-top .top-menu-right {
        text-align: center !important;
        padding: 0;
        margin: 0;
    }
    .header-top .top-menu-right li {
        display: inline;
        list-style: none;
        padding: 0 10px;
    }
    .header-top .top-menu-right li a {
        color: #007fc0;
        font-size: 12px;
        text-decoration: none;
    }
    .header-top .top-menu-right li a:hover {
        text-decoration: underline;
    }

    .header-center {
        padding: 10px 0;
    }
    .header-center .logo {
        float: none;
        text-align: center;
        margin-bottom: 10px;
    }
    .header-center .logo img {
        max-height: 55px;
        width: auto;
    }
    .header-center .header-info {
        float: none;
        text-align: center;
        margin: 5px auto;
    }
    .header-center .header-info p {
        display: inline-block;
        margin: 0 10px;
    }

    /* Cart button */
    .cart-mini-box {
        position: absolute;
        top: 15px;
        right: 10px;
    }

    /* Header Bottom (Navigation bar) */
    .header-bottom .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        padding-top: 4px;
        padding-bottom: 4px;
    }
    .danh-muc-box {
        position: relative;
    }
    .danh-muc-btn {
        width: auto;
        padding: 8px 14px 8px 30px;
        font-size: 13px;
        border-radius: 3px;
    }
    .header-bottom .search-box {
        flex: 1;
        margin: 0 0 0 10px;
        min-width: 180px;
    }
    .header-bottom .search-box .txt-search {
        width: 100%;
        max-width: 100%;
        height: 36px;
        box-sizing: border-box;
    }
    .header-ky-thuat, .header-sale {
        display: none !important;
    }

    /* Home Hero & Category sidebar */
    .home-top-left {
        display: none !important;
    }
    .home-top-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }

    /* Category tax left sidebar */
    .home-product-tax-left {
        display: none !important;
    }
    .home-product-tax-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }

    /* Product detail page */
    .product-left, .product-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }
    .product-right {
        margin-top: 20px;
    }

    /* Cart page */
    .cart-left, .cart-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }
    .cart-right {
        margin-top: 25px;
    }

    /* Footer */
    .footer-top-left, .footer-top-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }
    .footer-top-right {
        margin-top: 20px;
    }
}

/* ==========================================================================
   Mobile Devices (max-width: 767px)
   ========================================================================== */
@media (max-width: 767px) {
    /* Header top */
    .header-top {
        display: block !important;
        padding: 8px 0 6px 0;
        font-size: 11.5px;
    }
    .header-top .top-menu-right li {
        padding: 0 6px;
    }

    .header-center {
        position: relative;
        padding: 8px 0;
    }
    .header-center .logo {
        text-align: left;
        padding-left: 5px;
    }
    .header-center .logo img {
        max-height: 44px;
        width: auto;
    }
    .header-center .header-info {
        display: none;
    }

    .cart-mini-box {
        position: absolute;
        top: 8px;
        right: 10px;
        margin: 0;
    }
    .cart-mini-box .cart-mini {
        padding: 5px 10px;
        font-size: 12px;
    }
    .cart-mini-box font:last-child {
        display: none;
    }

    /* Header Bottom Mobile Navigation */
    .header-bottom {
        background: #007fc0;
        padding: 6px 0;
    }
    .header-bottom .container {
        display: flex;
        align-items: center;
        position: relative;
    }
    .danh-muc-box {
        flex-shrink: 0;
    }
    .danh-muc-btn {
        width: 40px;
        height: 36px;
        padding: 0;
        text-align: center;
        line-height: 36px;
        background: url(../images/icon-danh-muc.png) no-repeat center #00679c !important;
        border-radius: 3px;
        cursor: pointer;
    }
    .danh-muc-btn .danhmuc-text {
        display: none;
    }
    .danh-muc-btn:before {
        display: none;
    }

    /* Search Box */
    .header-bottom .search-box {
        flex: 1;
        margin: 0 0 0 8px;
        position: relative;
    }
    .header-bottom .search-box .txt-search {
        width: 100%;
        height: 36px;
        padding: 6px 45px 6px 12px;
        border-radius: 3px;
        font-size: 13px;
        border: 1px solid #005a88;
    }
    .header-bottom .search-box .btn-search {
        position: absolute;
        top: 0;
        right: 0;
        width: 40px;
        height: 36px;
        border: none;
        background: #005a88;
        color: #fff;
        border-radius: 0 3px 3px 0;
        font-size: 0;
    }
    .header-bottom .search-box .btn-search:before {
        content: "\f002";
        font-family: "Font Awesome 5 Free"; font-weight: 900;
        font-size: 14px;
    }

    /* Mobile Drawer Menu - Beautiful wide dropdown */
    .danh-muc-box {
        position: relative !important;
    }
    .danh-muc-box .danh-muc-menu {
        position: absolute !important;
        top: 40px !important;
        left: 0 !important;
        width: 320px !important;
        max-width: calc(100vw - 20px) !important;
        min-width: 280px !important;
        margin: 0 !important;
        background: #ffffff !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25) !important;
        z-index: 99999 !important;
        max-height: 75vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border: 1px solid #e0e0e0 !important;
        border-top: 2px solid #005a88 !important;
        border-radius: 0 0 8px 8px !important;
    }
    .danh-muc-menu ul {
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
    }
    .danh-muc-menu > ul > li {
        position: relative !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }
    .danh-muc-menu > ul > li:last-child {
        border-bottom: none !important;
    }
    .danh-muc-menu > ul > li > a {
        display: block !important;
        padding: 13px 50px 13px 16px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #222222 !important;
        line-height: 1.4 !important;
        text-transform: uppercase !important;
    }
    .danh-muc-menu > ul > li > a:hover,
    .danh-muc-menu > ul > li > a:active {
        background: #f4f9fd !important;
        color: #007fc0 !important;
    }
    /* Mobile sub-menu accordion toggle button */
    .view-sub-menu {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 14px !important;
        color: #666666 !important;
        cursor: pointer !important;
        z-index: 10 !important;
        background: #f8f8f8 !important;
        border-left: 1px solid #eeeeee !important;
        transition: background 0.2s ease !important;
    }
    .view-sub-menu:hover,
    .view-sub-menu:active {
        background: #edf5fa !important;
        color: #007fc0 !important;
    }
    /* Sub-menu accordion styling */
    .danh-muc-menu > ul > li > ul.sub-menu {
        width: 100% !important;
        position: static !important;
        box-shadow: none !important;
        background: #f8fafc !important;
        padding: 4px 0 !important;
        border-top: 1px solid #eef2f5 !important;
        display: none;
    }
    .danh-muc-menu > ul > li > ul.sub-menu > li {
        width: 100% !important;
        float: none !important;
        border-bottom: 1px dashed #e8edf1 !important;
    }
    .danh-muc-menu > ul > li > ul.sub-menu > li:last-child {
        border-bottom: none !important;
    }
    .danh-muc-menu > ul > li > ul.sub-menu > li > a {
        display: block !important;
        padding: 10px 20px 10px 24px !important;
        font-size: 13.5px !important;
        font-weight: 500 !important;
        color: #444444 !important;
        text-align: left !important;
    }
    .danh-muc-menu > ul > li > ul.sub-menu > li > a:hover {
        background: #edf4fa !important;
        color: #007fc0 !important;
    }
    .danh-muc-menu > ul > li > ul.sub-menu .img {
        display: none !important;
    }
    .danh-muc-menu > ul > li > ul.sub-menu .text {
        padding: 0 !important;
        margin: 0 !important;
        text-align: left !important;
        color: inherit !important;
    }

    /* Product Grid: 2 Columns Per Row on Mobile */
    .product-list .row {
        margin-left: -5px;
        margin-right: -5px;
    }
    .product-list .col-md-3,
    .product-list .col-xs-6,
    .product-item {
        width: 50% !important;
        float: left !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-bottom: 12px;
        box-sizing: border-box;
    }
    .product-box {
        background: #fff;
        border: 1px solid #e8e8e8;
        border-radius: 4px;
        padding: 6px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .product-img {
        position: relative;
        overflow: hidden;
        aspect-ratio: 1 / 1;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fafafa;
        border-radius: 3px;
    }
    .product-img img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    .product-info {
        padding: 8px 2px 2px;
    }
    .product-title {
        font-size: 12px !important;
        line-height: 16px !important;
        height: 32px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        margin: 0 0 4px !important;
        font-weight: 600;
    }
    .product-price .gia {
        font-size: 13px !important;
        font-weight: 700;
        color: #d0021b;
        margin: 0;
    }
    .product-price .gia-cu {
        font-size: 11px !important;
        color: #999;
        text-decoration: line-through;
        margin: 0;
    }

    /* Home Tabs on Mobile */
    .home-box-product-tab .product-tab .tab-header ul {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        border-bottom: 2px solid #007fc0;
        padding: 0;
        margin: 0;
    }
    .home-box-product-tab .product-tab .tab-header ul li {
        float: none;
        display: inline-block;
    }
    .home-box-product-tab .product-tab .tab-header ul li a {
        padding: 8px 12px;
        font-size: 13px;
    }
    .home-product-left {
        width: 100% !important;
        float: none !important;
    }
    .home-product-left .product-item {
        width: 100% !important;
    }
    .home-product-left .product-excerpt {
        display: none;
    }
    .home-product-right {
        width: 100% !important;
        float: none !important;
    }

    /* Category Section Headers on Mobile */
    .home-box-product .home-product-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
    }
    .home-box-title {
        font-size: 14px !important;
        margin: 0;
        min-width: unset !important;
    }
    .btn-xem-tat-ca {
        font-size: 12px;
        padding: 2px 8px;
    }

    /* Product Detail Page Mobile & Tablet Enhanced Responsive */
    .single-product #main-content {
        padding: 10px 0 25px !important;
    }
    .single-product .box-content {
        padding: 15px !important;
        margin-bottom: 15px !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05) !important;
        background: #ffffff !important;
    }
    .box-content.product-top {
        display: flex !important;
        flex-direction: column !important;
        padding: 15px !important;
        border-radius: 8px !important;
    }

    /* Product Left (Image & Slider) */
    .product-left {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
        margin: 0 0 16px 0 !important;
        display: block !important;
    }
    .product-slider {
        width: 100% !important;
    }
    .product-slider .img-main {
        width: 100% !important;
        height: 320px !important;
        min-height: 260px !important;
        max-height: 360px !important;
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ffffff !important;
        border: 1px solid #e8e8e8 !important;
        border-radius: 8px !important;
        padding: 10px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    .product-slider .img-main img {
        position: static !important;
        display: block !important;
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        margin: auto !important;
    }

    /* Product Right (Info & Actions) */
    .product-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }
    .product-single-title {
        font-size: 20px !important;
        font-weight: 700 !important;
        color: #00679c !important;
        line-height: 1.4 !important;
        margin: 0 0 12px 0 !important;
        word-break: break-word !important;
    }
    .product-price.product-single-price {
        display: flex !important;
        align-items: baseline !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 10px 14px !important;
        background: #fff8f8 !important;
        border: 1px solid #ffdcdc !important;
        border-radius: 6px !important;
        margin: 0 0 14px 0 !important;
    }
    .product-single-price .gia {
        font-size: 22px !important;
        font-weight: 800 !important;
        color: #e5101d !important;
        margin: 0 !important;
        line-height: 1.2 !important;
    }
    .product-single-price .gia-cu {
        font-size: 14px !important;
        color: #888888 !important;
        text-decoration: line-through !important;
        margin: 0 !important;
    }

    /* Product Parameters / Attributes */
    .product-parameter {
        background: #f8f9fa !important;
        border: 1px solid #e9ecef !important;
        border-radius: 6px !important;
        padding: 12px 14px !important;
        margin: 0 0 14px 0 !important;
        font-size: 13.5px !important;
        line-height: 1.7 !important;
        color: #333333 !important;
    }
    .product-parameter p {
        margin: 0 !important;
    }

    /* Showroom & Addresses */
    .product-address {
        background: #fbfbfb !important;
        border: 1px solid #eeeeee !important;
        border-radius: 6px !important;
        padding: 12px 14px !important;
        margin: 0 0 14px 0 !important;
    }
    .product-info-title {
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #222222 !important;
        text-transform: uppercase !important;
        margin: 0 0 6px 0 !important;
    }
    .header-address {
        font-size: 13px !important;
        color: #555555 !important;
        line-height: 1.5 !important;
        margin: 0 0 4px 0 !important;
    }

    /* Hotline */
    .product-hotline {
        background: #f0f7fb !important;
        border: 1px solid #d0e7f5 !important;
        border-radius: 6px !important;
        padding: 12px 14px !important;
        margin: 0 0 16px 0 !important;
    }
    .product-hotline-item {
        margin-bottom: 8px !important;
    }
    .product-hotline-item:last-child {
        margin-bottom: 0 !important;
    }
    .product-hotline-list, .product-ky-thuat-list {
        font-size: 13.5px !important;
        color: #00679c !important;
        font-weight: 600 !important;
        margin: 0 !important;
    }
    .phone-link {
        color: #d0021b !important;
        font-weight: 700 !important;
        text-decoration: none !important;
    }

    /* Action Buttons */
    .product-btn {
        display: flex !important;
        gap: 10px !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .product-btn-left, .product-btn-right {
        flex: 1 1 50% !important;
        width: 50% !important;
        float: none !important;
        padding: 0 !important;
    }
    .product-btn .button.btn-buy,
    .product-btn .button.btn-add-cart {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 44px !important;
        line-height: normal !important;
        padding: 0 10px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        border-radius: 6px !important;
        text-align: center !important;
        text-transform: uppercase !important;
        box-sizing: border-box !important;
        transition: all 0.2s ease !important;
    }
    .product-btn .button.btn-buy {
        background: #007bc4 !important;
        color: #ffffff !important;
        box-shadow: 0 2px 6px rgba(0, 123, 196, 0.25) !important;
    }
    .product-btn .button.btn-add-cart {
        background: #d0021b !important;
        color: #ffffff !important;
        box-shadow: 0 2px 6px rgba(208, 2, 27, 0.25) !important;
    }

    /* Product Bottom (Detail Description & Comments) */
    .product-bottom .box-content {
        margin-top: 15px !important;
    }
    .product-single-box-title {
        font-size: 17px !important;
        font-weight: 700 !important;
        color: #222222 !important;
        border-bottom: 2px solid #00679c !important;
        padding-bottom: 8px !important;
        margin-bottom: 14px !important;
    }
    .zing-content {
        font-size: 14px !important;
        line-height: 1.7 !important;
        color: #333333 !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    .zing-content img {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 12px auto !important;
        border-radius: 6px !important;
    }
    .zing-content table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-collapse: collapse !important;
        margin: 12px 0 !important;
    }
    .zing-content iframe,
    .zing-content video {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Similar Products */
    .product-similar .row {
        margin-left: -5px !important;
        margin-right: -5px !important;
    }
    .product-similar .col-xs-6 {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    /* Floating call button */
    .call-now-button {
        bottom: 85px !important;
        left: 15px !important;
        top: unset !important;
        z-index: 99999 !important;
        transform: scale(0.9) !important;
        transform-origin: bottom left !important;
    }

    /* Footer on Mobile */
    .footer-top {
        padding-top: 15px;
    }
    .footer-box {
        margin-bottom: 20px;
        text-align: left;
    }
    .footer-title {
        font-size: 14px;
        margin-bottom: 8px;
    }
}

