/* 
 * Single Post Image Fixed Styling
 * Cố định và làm đẹp phần hiển thị ảnh trên single post
 */

/* Container cho phần image - Cố định */
.single .row.mb-3:has(.image_ratio_full_size_in),
.single .row.mb-3:has(.wp-post-image) {
    position: relative !important;
    width: 100% !important;
    margin: 2rem 0 !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%) !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
    min-height: 400px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Image styling - Cố định */
.single .image_ratio_full_size_in,
.single .wp-post-image {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 600px !important;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 20px !important;
    display: block !important;
    transition: transform 0.5s ease !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
}

/* Hover effect */
.single .row.mb-3:hover .image_ratio_full_size_in,
.single .row.mb-3:hover .wp-post-image {
    transform: scale(1.02) !important;
}

/* Placeholder khi không có image - Thay thế màu đỏ */
.single .row.mb-3.no-image-placeholder,
.single .row.mb-3:has(img[src*="no_img.png"]),
.single .row.mb-3:has(img[alt*="NO IMAGE"]),
.single .row.mb-3:has(img[alt*="No image available"]) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    position: relative !important;
}

.single .row.mb-3.no-image-placeholder::before,
.single .row.mb-3:has(img[src*="no_img.png"])::before,
.single .row.mb-3:has(img[alt*="NO IMAGE"])::before,
.single .row.mb-3:has(img[alt*="No image available"])::before {
    content: "📷";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
}

.single .row.mb-3.no-image-placeholder::after,
.single .row.mb-3:has(img[src*="no_img.png"])::after,
.single .row.mb-3:has(img[alt*="NO IMAGE"])::after,
.single .row.mb-3:has(img[alt*="No image available"])::after {
    content: "Chưa có hình ảnh";
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Poppins', 'Roboto', sans-serif;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* Ẩn text "NO IMAGE" nếu có */
.single .row.mb-3 img[alt*="NO IMAGE"],
.single .row.mb-3 img[src*="no_img.png"],
.single .row.mb-3 img[alt*="No image available"] {
    opacity: 0.2 !important;
    filter: blur(3px) brightness(0.5) !important;
    position: relative;
    z-index: 0;
}

/* Slider support - Nếu có slider */
.single .row.mb-3 .carousel,
.single .row.mb-3 .slider,
.single .row.mb-3 .swiper-container,
.single .row.mb-3 .gallery,
.single .row.mb-3 .wp-block-gallery {
    width: 100% !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    margin: 0 !important;
}

.single .row.mb-3 .carousel-item img,
.single .row.mb-3 .slider img,
.single .row.mb-3 .swiper-slide img,
.single .row.mb-3 .gallery-item img,
.single .row.mb-3 .wp-block-image img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 600px !important;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 20px !important;
    display: block !important;
}

/* WordPress Gallery styling */
.single .row.mb-3 .gallery {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 1rem !important;
}

.single .row.mb-3 .gallery-item {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 12px !important;
}

.single .row.mb-3 .gallery-item img {
    transition: transform 0.3s ease !important;
}

.single .row.mb-3 .gallery-item:hover img {
    transform: scale(1.1) !important;
}

/* Responsive */
@media (max-width: 991px) {
    .single .row.mb-3:has(.image_ratio_full_size_in),
    .single .row.mb-3:has(.wp-post-image) {
        min-height: 300px !important;
        border-radius: 16px !important;
    }
    
    .single .image_ratio_full_size_in,
    .single .wp-post-image {
        max-width: 100% !important;
        max-height: 400px !important;
        object-fit: contain !important;
        object-position: center !important;
        border-radius: 16px !important;
    }
}

@media (max-width: 767px) {
    .single .row.mb-3:has(.image_ratio_full_size_in),
    .single .row.mb-3:has(.wp-post-image) {
        min-height: 250px !important;
        border-radius: 12px !important;
        margin: 1.5rem 0 !important;
    }
    
    .single .image_ratio_full_size_in,
    .single .wp-post-image {
        max-width: 100% !important;
        max-height: 300px !important;
        object-fit: contain !important;
        object-position: center !important;
        border-radius: 12px !important;
    }
    
    .single .row.mb-3:has(img[src*="no_img.png"])::before {
        font-size: 3rem !important;
    }
    
    .single .row.mb-3:has(img[src*="no_img.png"])::after {
        font-size: 1rem !important;
    }
}

/* Fallback cho browser không hỗ trợ :has() */
@supports not selector(:has(*)) {
    .single .row.mb-3 {
        position: relative !important;
        width: 100% !important;
        margin: 2rem 0 !important;
        padding: 0 !important;
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%) !important;
        border-radius: 20px !important;
        overflow: hidden !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
        min-height: 400px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

