/* AGGRESSIVE VIDEO LAYOUT FIX - HIGHEST PRIORITY */

/* Force all elements to use border-box */
* {
    box-sizing: border-box !important;
}

/* Content wrapper fixes */
.content-wrapper {
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Article detail content fixes */
.article-detail-content {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    padding: 15px !important;
    margin: 0 !important;
}

/* Video container fixes */
.article-detail-content .video-auto-responsive {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 0 !important;
    margin: 10px 0 15px 0 !important;
    /* padding-bottom will be set by JavaScript based on actual aspect ratio */
    /* Fallback: default to 16:9 aspect ratio if JavaScript doesn't set it */
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: #000 !important;
    border-radius: 4px !important;
}

/* Override fallback for square videos (Facebook) */
.article-detail-content .video-auto-responsive iframe[src*="facebook.com"] {
    /* This will be overridden by JavaScript, but provides a fallback */
}

/* Specific aspect ratio classes as fallbacks */
.article-detail-content .video-auto-responsive.video-16-9 {
    padding-bottom: 56.25% !important; /* 16:9 */
}

.article-detail-content .video-auto-responsive.video-4-3 {
    padding-bottom: 75% !important; /* 4:3 */
}

.article-detail-content .video-auto-responsive.video-1-1 {
    padding-bottom: 100% !important; /* 1:1 square */
}

/* Video iframe fixes */
.article-detail-content .video-auto-responsive iframe,
.article-detail-content iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
    .article-detail-content {
        padding: 15px !important;
        margin: 0 !important;
    }
    
    .article-detail-content .video-auto-responsive {
        width: 100% !important;
        /* padding-bottom will be set by JavaScript based on actual aspect ratio */
        margin: 10px 0 15px 0 !important;
    }
    
    .article-detail-content p {
        margin: 10px 0 !important;
        line-height: 1.5 !important;
        word-wrap: break-word !important;
    }
}

@media (max-width: 480px) {
    .article-detail-content {
        padding: 10px !important;
    }
    
    .article-detail-content .video-auto-responsive {
        /* padding-bottom will be set by JavaScript based on actual aspect ratio */
        margin: 8px 0 12px 0 !important;
    }
    
    .article-detail-content p {
        margin: 8px 0 !important;
        font-size: 14px !important;
    }
}

/* Prevent any layout shifts */
.article-detail-content * {
    box-sizing: border-box !important;
}

/* Force proper text flow */
.article-detail-content p {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}
