﻿/* =========================
   DESKTOP - Hide mobile elements
========================= */
@media (min-width: 769px) {
    .mobile-banner,
    .mobile-menu-bar,
    .mobile-menu {
        display: none !important;
    }
}

/* =========================
   MOBILE ONLY
========================= */
@media (max-width: 768px) {
    /* Reset body and override bg.png background */
    * {
        box-sizing: border-box;
    }
    
    html {
        margin: 0;
        padding: 0;
        width: 100%;
        overflow-x: hidden;
        height: 100%;
    }
    
    body {
        background-image: none !important;
        background-color: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        overflow-x: hidden;
        min-height: 100%;
    }
    
    #table {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background-image: none !important;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    /* Hide desktop header/menu */
    #head {
        display: none !important;
    }
    
    /* Mobile banner - full width edge to edge */
    .mobile-banner {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    .mobile-banner img {
        width: 100%;
        height: auto;
        display: block;
        margin: 0;
        padding: 0;
    }
    
    /* Hamburger bar */
.mobile-menu-bar {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 12px 15px;
    background: #756033;
    color: #fff;
    font-size: 18px;
    width: 100%;
    margin: 0;
    gap: 10px;
}

.menu-toggle {
    font-size: 26px;
    cursor: pointer;
}
    
    /* Mobile menu */
    .mobile-menu {
        display: none;
        background: #B99B5F;
        width: 100%;
    }
    
    .mobile-menu ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .mobile-menu li {
        border-bottom: 1px solid #9A7F4D;
    }
    
    .mobile-menu a {
        display: block;
        padding: 15px 12px;
        color: #fff;
        text-decoration: none;
        font-size: 16px;
    }
    
    .mobile-menu a:hover {
        background: #A68A54;
    }
    
    /* Submenu toggle with plus/minus icons */
.mobile-menu .submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu .submenu-toggle .arrow {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.mobile-menu .submenu {
    display: none;
    background: #826A39;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu .submenu li {
    border-bottom: 1px solid #6F5A2F;
}

.mobile-menu .submenu li:last-child {
    border-bottom: none;
}

.mobile-menu .submenu a {
    padding: 12px 12px 12px 40px;
    font-size: 15px;
    background: #826A39;
}

.mobile-menu .submenu a:hover {
    background: #6F5A2F;
}

/* When submenu is open */
.mobile-menu .submenu-open > .submenu-toggle {
    background: #A68A54;
}

    /* Main content area - full width with background */
    .main {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        background-image: url(/image/mainbg2.jpg) !important;
        background-repeat: repeat-y !important;
        background-position: center top !important;
        background-size: 100% auto !important;
        background-attachment: scroll !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-bottom: 0 !important;
        overflow-x: hidden;
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .nr-g {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 5px 0 5px !important;
        margin: 0 !important;
        background: transparent !important;
        overflow-x: hidden !important;
    }
    
    /* Make content containers full width on mobile */
    .nrLeft {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }
    
    .Menubox,
    .MenuDibu {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .Allneir {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 10px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        border-left: none !important;
        border-right: none !important;
        overflow-x: hidden !important;
    }
    
    /* Make all images responsive */
    .Allneir img,
    .brandJs img,
    .ppnr img,
    .son2 img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
    }
    
    /* Adjust content areas */
    .main_tit,
    .brandJs,
    .ppnr,
    .son2,
    .son3 {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    .ppnr {
        padding: 5px 10px !important;
    }
    
    .ul_cdb {
        padding-left: 20px !important;
        padding-right: 10px !important;
    }
    
    .li_cdb {
        word-wrap: break-word !important;
    }
    
    .gy_topic,
    .zc_topic {
        padding-left: 15px !important;
        font-size: 14px !important;
    }
    
    .bm_c {
        width: 100% !important;
        padding: 5px !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
        margin-bottom: 0 !important;
        background: transparent !important;
    }
    
    /* Waterfall container - 2 columns FORCED */
#waterfall {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
}

/* Remove the :after pseudo element spacing */
#waterfall:after {
    content: none !important;
    display: none !important;
}

/* Waterfall mobile grid container */
.waterfall-mobile-grid {
    width: 100% !important;
    margin: 10px 0 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    display: block !important;
}

/* Each row contains 2 items */
.waterfall-row {
    display: flex !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-bottom: 15px !important;
    gap: 10px !important;
}

/* Last row - no bottom margin */
.waterfall-row:last-child {
    margin-bottom: 0 !important;
}

/* Items in mobile grid - exactly 50% width */
.waterfall-mobile-grid li {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: calc(50% - 5px) !important;
    flex: 0 0 calc(50% - 5px) !important;
    margin: 0 !important;
    padding: 0 0 3px !important;
    box-sizing: border-box !important;
    border-top: 1px solid #EAEAEA !important;
    background: url(https://lienhoanhoa.com/static/image/common/bg_waterfall.png) no-repeat 100% 100% !important;
}

/* Single item in row (odd number of total items) */
.waterfall-row li:only-child {
    width: calc(50% - 5px) !important;
    flex: 0 0 calc(50% - 5px) !important;
}

/* Image container */
.waterfall-mobile-grid .c,
#waterfall .c {
    padding: 5px !important;
    border: solid #EAEAEA;
    border-width: 0 1px;
    background-color: #F8F8F8;
    max-height: none !important;
    overflow: hidden !important;
}

/* Images - fully responsive */
.waterfall-mobile-grid .c img,
.waterfall-mobile-grid img,
#waterfall .c img,
#waterfall img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    display: block !important;
}

/* Titles */
.waterfall-mobile-grid h3,
#waterfall h3 {
    padding: 8px 5px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
    border: solid #EAEAEA;
    border-width: 0 1px;
    background-color: #F8F8F8;
    margin: 0 !important;
}

.waterfall-mobile-grid h3.xw0,
#waterfall h3.xw0 {
    padding: 8px 5px !important;
}

/* Remove list bullets/dots - AGGRESSIVE */
.waterfall-mobile-grid {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.waterfall-row {
    display: flex !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-bottom: 15px !important;
    gap: 10px !important;
    list-style: none !important;
}

.waterfall-mobile-grid li {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: calc(50% - 5px) !important;
    flex: 0 0 calc(50% - 5px) !important;
    margin: 0 !important;
    padding: 0 0 3px !important;
    padding-left: 0 !important;
    box-sizing: border-box !important;
    border-top: 1px solid #EAEAEA !important;
    background: url(https://lienhoanhoa.com/static/image/common/bg_waterfall.png) no-repeat 100% 100% !important;
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
}

/* Make sure row has no list styling */
.waterfall-row::before {
    display: none !important;
}
    
    /* Clear any floats - hide and remove all spacing on mobile */
    .clear {
        clear: both !important;
        display: block !important;
        height: 0 !important;
        line-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
    }
    
    /* Hide social icons on mobile */
    .clear img,
    .clear div,
    .clear a {
        display: none !important;
    }
    
    /* Footer - at bottom with footbg.jpg, pull up with negative margin to close gap */
    .foot {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 250px !important;
        background-image: url(/image/footbg.jpg) !important;
        background-repeat: no-repeat !important;
        background-position: center bottom !important;
        background-size: 100% auto !important;
        background-attachment: scroll !important;
        margin: 0 !important;
        margin-top: -200px !important;
        padding: 50px 0 15px 0 !important;
        padding-top: 250px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
    }
    
    .footwz {
        padding: 0 15px 5px 15px !important;
        line-height: 20px !important;
        margin: 0 !important;
    }
}