/* Global News Content Image Styling */
.news-content img,
.card-body img,
.content img,
.article-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
    object-fit: contain;
}

/* News Card Images - Prevent Flickering */
.news-card img,
.card-img-top {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
}

/* Thumbnail Container - Prevent Layout Shift */
.news-image,
.card-img-top-container {
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}

/* Placeholder for missing thumbnails */
.news-image::before,
.card-img-top-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f8f9fa;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.news-image img,
.card-img-top {
    position: relative;
    z-index: 2;
    transition: opacity 0.1s ease;
}

/* Prevent flickering on load */
.news-card {
    contain: layout;
}

/* Admin Table Thumbnails - Prevent Flickering */
.table td img,
.thumbnail-container img {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
}

.thumbnail-container {
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}

.news-content img:hover,
.card-body img:hover,
.content img:hover,
.article-content img:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Editor Images */
#contentEditor img,
.editor-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 0.5rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* Remove display: block to allow alignment in editor */
    /* display: block; */
    object-fit: contain;
}

/* Support for image alignment in editor */
#contentEditor img[style*="text-align: center"],
#contentEditor img[style*="text-align:center"] {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#contentEditor img[style*="text-align: right"],
#contentEditor img[style*="text-align:right"] {
    display: block;
    margin-left: auto;
    margin-right: 0;
}

#contentEditor img[style*="text-align: left"],
#contentEditor img[style*="text-align:left"] {
    display: block;
    margin-left: 0;
    margin-right: auto;
}

/* Preview Modal Images */
.modal-body img,
.preview-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 0.5rem 0;
    display: block;
    object-fit: contain;
}

/* Container Constraints */
.news-content,
.card-body,
.content,
.article-content {
    overflow: hidden;
    word-wrap: break-word;
}

/* News Typography - Font Size and Weight Adjustments */
/* News Card Titles - More Prominent */
.news-card .card-title,
.news-card h5,
.news-card h6 {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

/* News Card Content */
.news-card .card-text,
.news-card p,
.news-card .news-content {
    font-size: 13px !important;
    font-weight: 300 !important;
    line-height: 1.5 !important;
}

/* News Detail Page */
.news-detail .article-title,
.news-detail h1,
.news-detail .card-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

.news-detail .article-content,
.news-detail .news-content,
.news-detail .card-body p {
    font-size: 14px !important;
    font-weight: 300 !important;
    line-height: 1.6 !important;
}

/* Home Page News Cards */
.home-news .card-title,
.home-news h5 {
    font-size: 18px !important;
    font-weight: 600 !important;
}

.home-news .card-text,
.home-news p {
    font-size: 13px !important;
    font-weight: 300 !important;
}

/* News Index Page */
.news-index .card-title,
.news-index h5 {
    font-size: 18px !important;
    font-weight: 600 !important;
}

.news-index .card-text,
.news-index p {
    font-size: 13px !important;
    font-weight: 300 !important;
}

/* Responsive Images */
@media (max-width: 768px) {
    .news-content img,
    .card-body img,
    .content img,
    .article-content img {
        margin: 0.5rem 0;
    }
    
    #contentEditor img,
    .editor-content img {
        margin: 0.25rem 0;
    }
    
    /* Responsive Typography */
    .news-card .card-title,
    .news-card h5,
    .news-card h6,
    .home-news .card-title,
    .home-news h5,
    .news-index .card-title,
    .news-index h5 {
        font-size: 16px !important;
        font-weight: 600 !important;
    }
    
    .news-detail .article-title,
    .news-detail h1,
    .news-detail .card-title {
        font-size: 18px !important;
        font-weight: 600 !important;
    }
}
