/* Rich Editor Content Styling - News Detail Page */
/* IMPORTANT: Force image constraints with !important */

.news-content {
    /* General content styling */
    line-height: 1.6;
    color: #333;
    overflow-x: hidden !important; /* Prevent horizontal scroll */
    word-wrap: break-word !important;
}

.news-content img,
.news-content figure img,
.content img,
div[class*="content"] img,
div[class*="news"] img {
    /* FORCE image constraints - use !important to override any other CSS */
    max-width: 100% !important;
    height: auto !important;
    width: auto !important;
    max-width: min(100%, 600px) !important;

    /* Add some spacing around images */
    margin: 1rem auto !important;

    /* Responsive behavior */
    display: block !important;

    /* Add subtle border and shadow for better visual */
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;

    /* Prevent any absolute positioning that might break layout */
    position: relative !important;

    /* Ensure images are contained within their parent */
    object-fit: contain !important;
}

/* For very small screens */
@media (max-width: 480px) {
    .news-content img,
    .content img {
        /* Ensure full width on mobile but with padding */
        max-width: 100% !important;
        width: 100% !important;
        margin: 0.5rem 0 !important;
        border-radius: 4px !important;
    }
}

/* For medium screens (tablets) */
@media (min-width: 481px) and (max-width: 1024px) {
    .news-content img,
    .content img {
        max-width: 100% !important;
        max-width: min(100%, 500px) !important;
        margin: 1rem auto !important;
    }
}

/* For large screens (desktop) */
@media (min-width: 1025px) {
    .news-content img,
    .content img {
        /* Prevent images from being too large on desktop */
        max-width: 600px !important;
        margin: 1.5rem auto !important;
    }
}

/* Additional protection - target any container that might have images */
.bg-white .news-content img,
.container img,
.col-lg-8 img {
    max-width: 100% !important;
    max-width: min(100%, 600px) !important;
    height: auto !important;
    display: block !important;
    margin: 1rem auto !important;
}

/* Style for image captions if needed */
.news-content figure {
    margin: 1.5rem 0 !important;
    text-align: center !important;
    max-width: 100% !important;
}

.news-content figcaption {
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
    padding: 0 1rem;
}

/* Style for rich editor content blocks */
.news-content blockquote {
    border-left: 4px solid #e2e8f0;
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background-color: #f7fafc;
    font-style: italic;
    color: #4a5568;
}

.news-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: #2d3748;
    line-height: 1.3;
}

.news-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: #2d3748;
    line-height: 1.3;
}

.news-content ul,
.news-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.news-content li {
    margin: 0.5rem 0;
}

.news-content p {
    margin: 1rem 0;
    text-align: justify;
}

.news-content a {
    color: #3182ce;
    text-decoration: underline;
}

.news-content a:hover {
    color: #2c5aa0;
}

/* Code blocks styling */
.news-content pre {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.news-content code {
    background-color: #f7fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #e53e3e;
}

/* Ensure consistent spacing */
.news-content > *:first-child {
    margin-top: 0;
}

.news-content > *:last-child {
    margin-bottom: 0;
}

/* Emergency CSS - if all else fails */
* img {
    max-width: 100% !important;
}

.container img,
.col-lg-8 img,
.bg-white img {
    max-width: min(100%, 600px) !important;
    height: auto !important;
}
