/*
 SkyNext Mobile Fix - WebKhuVuiChoi
 Version 1.2.0
 Deep responsive repair for legacy Topweb/WPBakery layouts.
*/

@media (max-width: 767px) {

    html, body {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    /* ===== 1. Legacy fixed-width layout containers ===== */
    body .container,
    body .container-fluid,
    body .wrapper,
    body .site,
    body .site-content,
    body .content,
    body .content-area,
    body .main,
    body .main-content,
    body #main,
    body #content,
    body .page-wrapper,
    body .post-wrapper,
    body .single-wrapper,
    body article,
    body .post,
    body .hentry,
    body .entry-content,
    body .post-content,
    body .single-post-content,
    body .article-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Keep sensible side padding for article text */
    body .entry-content,
    body .post-content,
    body .single-post-content,
    body .article-content {
        padding-left: 15px !important;
        padding-right: 15px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* ===== 2. Bootstrap / old theme grid ===== */
    body .row,
    body [class*="row-"],
    body [class^="col-"],
    body [class*=" col-"],
    body .span1, body .span2, body .span3, body .span4,
    body .span5, body .span6, body .span7, body .span8,
    body .span9, body .span10, body .span11, body .span12 {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    body [class^="col-"],
    body [class*=" col-"],
    body .span1, body .span2, body .span3, body .span4,
    body .span5, body .span6, body .span7, body .span8,
    body .span9, body .span10, body .span11, body .span12 {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body .row {
        width: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* ===== 3. WPBakery / Visual Composer legacy ===== */
    body .vc_row,
    body .wpb_row,
    body .vc_row-fluid,
    body .vc_column_container,
    body .vc_column-inner,
    body .wpb_column,
    body .wpb_wrapper {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* ===== 4. Fix fixed/inline widths in old post HTML ===== */
    body .entry-content *,
    body .post-content *,
    body .single-post-content *,
    body .article-content * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body .entry-content p,
    body .entry-content h1,
    body .entry-content h2,
    body .entry-content h3,
    body .entry-content h4,
    body .entry-content h5,
    body .entry-content h6,
    body .post-content p,
    body .post-content h1,
    body .post-content h2,
    body .post-content h3,
    body .post-content h4,
    body .single-post-content p,
    body .article-content p {
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        transform: none !important;
        text-indent: 0;
    }

    /* ===== 5. Media ===== */
    body img,
    body video,
    body iframe,
    body embed,
    body object,
    body svg,
    body figure,
    body .wp-caption,
    body .wp-caption img,
    body .gallery,
    body .gallery-item {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body img,
    body video {
        height: auto !important;
    }

    /* Prevent old aligncenter widths from overflowing */
    body .aligncenter,
    body img.aligncenter,
    body .wp-caption.aligncenter {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* ===== 6. Tables / long content ===== */
    body .entry-content table,
    body .post-content table,
    body .single-post-content table,
    body .article-content table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    body pre {
        max-width: 100% !important;
        overflow-x: auto !important;
        white-space: pre-wrap !important;
    }

    body p, body li, body a, body span {
        overflow-wrap: anywhere;
        word-wrap: break-word;
    }
}
