/* ============================================
   RESPONSIVE IMAGES IN CONTENT AREA
   Untuk halaman detail berita (frontend)
   ============================================ */

/* Container konten berita */
.berita-content,
.article-content,
.post-content,
.content-area {
    width: 100%;
    overflow-x: hidden;
}

/* Semua gambar dalam konten menjadi responsif */
.berita-content img,
.article-content img,
.post-content img,
.content-area img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hover effect untuk gambar (opsional) */
.berita-content img:hover,
.article-content img:hover,
.post-content img:hover,
.content-area img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Figure element (gambar dengan caption dari CKEditor) */
.berita-content figure,
.article-content figure,
.post-content figure,
.content-area figure {
    max-width: 100% !important;
    margin: 25px auto !important;
    padding: 0;
    text-align: center;
}

.berita-content figure img,
.article-content figure img,
.post-content figure img,
.content-area figure img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto;
}

/* Caption styling */
.berita-content figcaption,
.article-content figcaption,
.post-content figcaption,
.content-area figcaption {
    font-style: italic;
    color: #666;
    font-size: 0.9em;
    margin-top: 10px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
    border-radius: 4px;
    text-align: left;
    line-height: 1.5;
}

/* Style untuk gambar yang di-align */
.berita-content .image-style-side,
.article-content .image-style-side,
.post-content .image-style-side,
.content-area .image-style-side {
    max-width: 50%;
    float: right;
    margin-left: 20px;
    margin-bottom: 15px;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
    .berita-content img,
    .article-content img,
    .post-content img,
    .content-area img {
        max-width: 100% !important;
        width: 100% !important;
        margin: 15px auto;
    }
    
    .berita-content figure,
    .article-content figure,
    .post-content figure,
    .content-area figure {
        margin: 20px auto !important;
    }
    
    /* Side images menjadi full width */
    .berita-content .image-style-side,
    .article-content .image-style-side,
    .post-content .image-style-side,
    .content-area .image-style-side {
        max-width: 100%;
        width: 100%;
        float: none;
        margin-left: 0;
    }
}

/* Mobile (max 767px) */
@media (max-width: 767px) {
    .berita-content img,
    .article-content img,
    .post-content img,
    .content-area img,
    .berita-content figure img,
    .article-content figure img,
    .post-content figure img,
    .content-area figure img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 15px 0;
        border-radius: 5px;
    }
    
    .berita-content figure,
    .article-content figure,
    .post-content figure,
    .content-area figure {
        margin: 15px 0 !important;
    }
    
    .berita-content figcaption,
    .article-content figcaption,
    .post-content figcaption,
    .content-area figcaption {
        font-size: 0.85em;
        padding: 6px 10px;
    }
}

/* Small Mobile (max 480px) */
@media (max-width: 480px) {
    .berita-content img,
    .article-content img,
    .post-content img,
    .content-area img {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    .berita-content figcaption,
    .article-content figcaption,
    .post-content figcaption,
    .content-area figcaption {
        font-size: 0.8em;
        padding: 5px 8px;
        margin-top: 8px;
    }
}

/* ============================================
   GAMBAR UTAMA BERITA (Featured Image)
   ============================================ */

.featured-image,
.gambar-utama,
.main-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.featured-image img,
.gambar-utama img,
.main-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Caption untuk gambar utama */
.featured-image .caption,
.gambar-utama .caption,
.main-image .caption,
.image-caption {
    display: block;
    font-style: italic;
    color: #666;
    font-size: 0.9em;
    margin-top: 10px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
    border-radius: 4px;
    line-height: 1.5;
}

@media (max-width: 767px) {
    .featured-image,
    .gambar-utama,
    .main-image {
        border-radius: 5px;
        margin-bottom: 15px;
    }
    
    .featured-image .caption,
    .gambar-utama .caption,
    .main-image .caption,
    .image-caption {
        font-size: 0.85em;
        padding: 6px 10px;
    }
}

/* ============================================
   OVERRIDE INLINE STYLES
   Force responsive untuk gambar dengan inline width
   ============================================ */

.berita-content img[style*="width"],
.article-content img[style*="width"],
.post-content img[style*="width"],
.content-area img[style*="width"] {
    width: auto !important;
    max-width: 100% !important;
}

.berita-content img[width],
.article-content img[width],
.post-content img[width],
.content-area img[width] {
    width: auto !important;
    max-width: 100% !important;
}

/* ============================================
   LOADING & PLACEHOLDER
   ============================================ */

.berita-content img,
.article-content img,
.post-content img,
.content-area img {
    background: #f0f0f0;
    min-height: 100px;
}

/* Lazy loading blur effect (opsional) */
.berita-content img.loading,
.article-content img.loading,
.post-content img.loading,
.content-area img.loading {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

.berita-content img.loaded,
.article-content img.loaded,
.post-content img.loaded,
.content-area img.loaded {
    filter: blur(0);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .berita-content img,
    .article-content img,
    .post-content img,
    .content-area img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}