/* ==========================================================================
   1. LARGE DESKTOP ( >= 1200px )
   ========================================================================== */
@media (min-width: 1200px) {
    .header-menu-main .container-fluid {
        padding: 2rem 5rem !important;
    }
}

/* ==========================================================================
   2. MEDIUM DESKTOP / TABLET LANDSCAPE ( >= 1024px )
   ========================================================================== */
@media (min-width: 1024px) {
    .item-partner-slider {
        width: 248px !important;
    }
}

/* Ẩn nút X trên Desktop - Click backdrop để đóng */
@media (min-width: 992px) {
    .btn-close-overlay {
        display: none;
    }
    .footer-top-row-flex {
        flex-direction: row;
    }
    .slab-system-popup-wrapper {
        width: 80vw; 
        height: 85vh; 
        padding: 60px;
    }
    .ssp-panel-inner {
        flex-direction: row;
    }
}

/* ==========================================================================
   3. SMALL DESKTOP & BELOW ( <= 1200px )
   ========================================================================== */
@media (max-width: 1200px) {
    .search-form-desktop { display: none; }
    .toggle-modal-search { display: inline-block; }
    .container-full { max-width: 95%; }
    .container-full-medium { padding-bottom: 10px; }
    .content-header-top { display: none; }
    .fc-menu-header { display: none; }
    .header-menu-main { box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15); }
    .header-menu-main .header-menu-logo a.logo img { max-width: 120px; }
    .header-menu-logo {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    .hotline-header-top {
        text-align: right;
        position: relative;
        top: inherit;
        transform: none;
        display: block;
        width: 100%;
    }
    .overflow-image-content .content-editor img {
        width: 100%;
        max-width: 100%;
        margin: 15px 0;
    }
    a.btn-menu-mobile { display: inline-block; }
    .header-action {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translate(0, -50%);
    }
    .product-hero-content-wrapper { max-width: 60%; }
    .product-title-hero { font-size: 5.5rem; }
    
    /* Product Grid - Portrait Thumbnails & Proper Scaling (Tablet/Desktop) */
    .product-thumb {
        aspect-ratio: 2 / 3 !important;
        padding: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .thumb-inner {
        margin: 0 auto !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .product-thumb img {
        max-height: 100% !important;
        width: auto !important;
        object-fit: contain !important;
    }
}

/* ==========================================================================
   4. TABLET & BELOW ( <= 992px / 991px )
   ========================================================================== */
@media (max-width: 992px) {
    /* Layout & Sidebar */
    .sidebar-template { display: none; }
    .layout-sidebar { width: 100%; }
    
    /* Footer */
    .footer-template-new { padding: 40px 0 20px 0; margin-top: 40px; }
    .footer-huge-text { font-size: 72px; letter-spacing: -1px; }
    .item-footer-nav { justify-content: center; width: 100%; margin-top: 30px; }
    .footer-nav-grid { max-width: 100%; column-gap: 32px; }
    .footer-top-row-flex { align-items: center; gap: 24px; }
    .item-footer-huge-logo { width: 100%; text-align: center; }
    .footer-bottom-row, .footer-bottom-row .col-6 { text-align: center !important; }

    /* Typography & UI */
    .title-single { font-size: 24px; }
    .title-item-post-loop { font-size: 22px; }
    .breadcrumb-template .container { padding: 0; }
    .btn-to-top { display: none; }
    .builder-title-content { font-size: 30px; }


    /* Product & Shop */
    .description-product-category svg { width: 40px; height: 40px; }
    .archive-product { padding-top: 0; }
    
    /* Components */
    .customers-partners { font-size: 22px; }
    .review-of { font-size: 18px; }
    .item-builder-slider .sub-title-item-builder-slider { font-size: 24px; }
    .item-builder-slider .title-item-builder-slider { font-size: 16px; }
    .wrapper-builder-statics { width: calc(100% / 3); border-bottom: 1px dashed var(--fc_color_tertiary); }

    /* Overlay Menu Mobile */
    .overlay-main-menu { flex-direction: column; gap: 20px; margin-bottom: 20px; }
    .overlay-main-menu > li > a::after { display: none; }
    .overlay-main-menu ul.sub-menu { position: relative; padding: 10px 0 0 20px; }
    .overlay-main-menu ul.sub-menu > li > a { font-size: 20px; }

    /* Slab styles */
    .is-random .slab-item-img { width: 30%; }
    .slab-colored-frame { padding: 24px !important; }
}

/* ==========================================================================
   5. LARGE MOBILE & BELOW ( <= 768px / 767px )
   ========================================================================== */
@media (max-width: 768px) {
    .item-partner { width: 25%; }
    .image-builder-about { padding-left: 0; }
    .sub-title-flex-builder, #title-quick-contact-us { font-size: 24px; }
    .count-up-animate { font-size: 30px; font-weight: 700; }
    .content-statics { font-size: 18px; }
    

    /* Video & Slider */
    .builder-video { height: 0 !important; padding-top: 56.25% !important; }
    .play-button { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 60px; height: 60px; }
    .row-partner2 { padding: 5px; }
    .row-partner { margin: 0; }
    
    /* Builder Slider Section - Mobile Adjustment */
    .builder-slider-section .builder-main-slider,
    .builder-slider-section .builder-main-slider .swiper-wrapper,
    .builder-slider-section .builder-main-slider .swiper-slide {
        height: auto !important;
        min-height: unset !important;
    }
    .builder-slider-section .builder-main-slider img {
        height: auto !important;
        min-height: unset !important;
        object-fit: contain !important;
    }
    
    /* Header Mobile Toggle & Floating Logo */
    .header-menu-main {
        background: transparent !important;
        box-shadow: none !important;
    }
    
    .header-menu-main .container-fluid {
        margin: 10px 15px !important;
        padding: 8px 20px !important;
        border-radius: 2px !important;
        width: calc(100% - 30px) !important;
        max-width: calc(100% - 30px) !important;
    }
    
    .header-menu-main .header-menu-logo a.logo {
        font-size: 26px !important;
        font-weight: 400 !important;
        letter-spacing: 2px !important;
    }
    
    .header-menu-main .btn-menu-overlay {
        font-size: 36px !important;
        font-weight: 200 !important;
        line-height: normal !important;
        margin-top: -5px !important; /* Visual alignment for + icon */
    }

    /* Builder Banner - Full Background & Category Hero Sections */
    section.builder-banner.banner-full-bg,
    section.category-hero-section {
        min-height: 100vh !important;
        height: 100vh !important;
        background-position: 100% center !important;
    }
    
    /* Builder Banner - Boxed mode (Background inside Container) */
    section.builder-banner:not(.banner-full-bg) {
        min-height: 100vh !important;
        display: flex !important;
        align-items: center !important;
        padding: 20px 15px !important; /* Vertical and horizontal frame */
    }
    section.builder-banner:not(.banner-full-bg) .container.banner-container-bg {
        min-height: 90vh !important; /* Reduced height to show vertical frame */
        background-position: 100% center !important;
        padding: 40px 20px !important;
    }

    /* Product Hero Section Adjustment */
    section.product-hero-section {
        min-height: 100vh !important;
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        padding-bottom: 80px !important; /* Space from the bottom for title/meta */
    }
    
    section.product-hero-section .hero-slab-wrapper {
        position: absolute !important;
        width: 100% !important;
        height: 100vh !important;
        top: 0;
        left: 0;
    }

    section.product-hero-section .hero-slab-img {
        height: 100vh !important;
        width: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }
    
    .product-hero-content-wrapper {
        position: relative !important;
        z-index: 10 !important;
        max-width: 70% !important;
        margin: 0 auto !important;
    }

    .product-title-hero {
        font-size: 32px !important;
        color: #fff !important;
        text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    }
    

    /* Builder Title & Contact */
    .builder-title-content { font-size: 26px; }
    .builder-contact .builder-contact-title { font-size: 18px; }

    /* Builder Title & Contact */

    /* Slab Layout */
    .slab-card-wrapper { padding: 20px !important; }
    .slab-grid-layout { grid-template-columns: 1fr; }
    .ssp-panel-inner { flex-direction: column-reverse; }
    .ssp-panel-info { margin-top: 20px; }
    .ssp-thumbs-grid { gap: 4px; }
    .ssp-thumb-item { width: calc((100% - 12px) / 4); }
    .ssp-pagination-wrapper { display: none; }
    
    .builder-heading { padding: 40px 0 30px 0 !important; }
    .builder-heading.size-large .heading-title { font-size: 32px; }
    .builder-heading.size-large .heading-description { font-size: 16px; }

    .product-thumb img {
        max-height: 100% !important;
        width: auto !important;
        object-fit: contain !important;
    }
}

/* ==========================================================================
   6. SMALL MOBILE ( <= 576px / 575px )
   ========================================================================== */
@media (max-width: 576px) {
    .item-partner { width: 50%; }
    .content-form-newsletter { padding: 15px 0; }
    .footer-huge-text { font-size: 50px; letter-spacing: -1px; }
    .item-footer-bottom-logo, .item-footer-copyright { width: 100%; text-align: left !important; margin-top: 15px; }
    .content-item-post-loop { padding: 15px 0 0 0; }
    .header-menu-main .header-menu-logo a.logo img { max-width: 120px; margin-bottom: -20%; }
    .archive-product .container { padding: 0; }
    
    
    /* Brand */
    .read-more-item-brand, .builder-brand .flex-direction-nav, .read-more-blog { display: none !important; }
    .row-brand { padding: 2px; }
    .builder-brand .flex-slider-theme { padding: 0 10px; }
    
    .wrapper-builder-statics { width: 50%; }
    .builder-title-content { font-size: 22px; }
    .woo-category-tabs .products-in-category .item-category-tab { width: 100%; }

    /* Overlay Mobile */
    .aeterna-main-overlay { width: 100%; }
    .overlay-tier1 { flex-direction: column; align-items: stretch; padding: 16px 24px !important; }
    .overlay-header-actions {
        order: 1; display: flex; justify-content: space-between; align-items: center;
        padding-bottom: 16px; border-bottom: 1px solid #e8e8e8; margin-bottom: 14px;
    }
    .btn-close-overlay { display: flex !important; }
    .overlay-tabs { order: 2; gap: 20px; }
    .overlay-body, .overlay-search-panel { padding: 24px !important; }
    .mega-subitems li a { font-size: 22px; margin-bottom: 14px; }

    /* Header Mobile */
    .header-menu-main .container-fluid { padding: 16px 20px !important; }
    .btn-menu-overlay { font-size: 32px; margin-right: 4px; }
    .header-menu-logo .logo img, .header-menu-logo .logo { height: 24px; }
}