/* 
 * READMORE PAGE STYLES
 */

.readmore-layout {
    display: flex;
    flex-direction: row;
    gap: 30px;
    padding-top: 30px;
    padding-bottom: 50px;
    align-items: flex-start;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* 1. LEFT SIDEBAR: TRENDING */
.trending-sidebar {
    flex: 0 0 350px;
    position: sticky;
    top: 85px;
    /* Matched home.css side-bar top */
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    order: 2;
    /* Move to the right */
}

body.dark .trending-sidebar {
    background: #2d3748;
}

body {
    background: gainsboro;
}

.trending-sidebar h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-left: 8px;
    border-bottom: 1px solid #242424;
    color: #2d3748;
}

body.dark .trending-sidebar h2 {
    color: #edf2f7;
}

.gallery-item img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 650px;
    object-fit: contain;
    display: block;

}

.trending-item {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 15px;
    margin-bottom: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
    border-bottom: 1px solid #2424;
}

body.dark .trending-item {
    border-bottom: 1px solid #2d3748;
}

.trending-item:hover {
    transform: translateX(5px);
    color: #e47200;
}

.trending-item img {
    width: 85px;
    height: 75px;
    object-fit: contain;
    flex-shrink: 0;
}

.trending-item .title {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.6;
    /* Significant increase to prevent clipping */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /*-webkit-box-orient: vertical;*/
    overflow: hidden;
}

/* 2. MAIN CONTENT AREA */
.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* News Header */
.news-header {
    background: transparent;
    padding: 0;
    margin-bottom: 30px;
    transition: all 0.3s;
}

.sticky-title {
    font-size: 46px;
    font-weight: 800;
    line-height: 1.6;
    margin: 0;
    padding: 15px 0;
    color: #1a202c;
    position: sticky;
    top: 70px;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body.dark .sticky-title {
    background: #1a202c;
    color: #f7fafc;
}

.sticky-title.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.10);
    padding-left: 15px;
    background: antiquewhite;
    padding-right: 15px;
    font-size: 30px;
    border-bottom: 1px solid #2424;
}

body.dark .sticky-title.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 24px;
    color: #4a5568;
    margin-bottom: 20px;
    line-height: 1.5;
}

body.dark .subtitle {
    color: #a0aec0;
}

/* Byline */
.byline {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf2f7;
}

body.dark .byline {
    border-color: #2d3748;
}

body.dark .sticky-title {
    color: #f7fafc;
    /* Matched home.css text color */
}

body.dark .subtitle {
    color: #a0aec0;
}

.author-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #F56565;
}

.author-info .name {
    font-size: 20px;
    font-weight: 600;
    display: block;
    color: inherit;
}

.author-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.author-link:hover .name {
    color: #e47200;
}

.author-link:hover .author-img {
    border-color: #e47200;
    transform: scale(1.05);
}

.author-info .date {
    font-size: 16px;
    color: #718096;
}

/* Highlights */
.highlights-box {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    /* Light Grey */
    border-left: 6px solid #CBD5E0;
    /* Grey Border */
    padding: 20px;
    margin-bottom: 20px;
}

.highlights-box p {
    font-size: 18px;
    font-style: italic;
    text-align: justify;
    font-weight: 600;
}

body.dark .highlights-box {
    background: #2d3748;
    border-color: #4a5568;
    color: #edf2f7;
}

.highlights-box ul {
    margin: 0;
    padding-left: 20px;
}

.highlights-box li {
    font-size: 20px;
    margin-bottom: 10px;
    line-height: 1.6;
    font-style: italic;
}

/* Share Buttons */
.share-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
    margin-bottom: 35px;
    padding: 10px 0;
    border-top: 1px solid #edf2f7;
    border-bottom: 1px solid #edf2f7;
}

body.dark .share-section {
    border-color: #2d3748;
}

.share-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.share-btn:hover {
    opacity: 0.8;
}

.btn-fb {
    background: #3b5998;
}

.btn-wa {
    background: #25d366;
}

.btn-ms {
    background: #0084ff;
}

.btn-tw {
    background: #000000;
}

body.dark .btn-tw {
    background: #ffffff;
    color: #000000;
}

.copy-url-btn {
    background: #4A5568 !important;
    color: white !important;
    border: none !important;
}

/* Font Controls */
.content-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

body.dark .content-controls {
    background: #2d3748;
    border: 1px solid #4a5568;
}

.font-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
    border: 1px solid #2424;
}

body.dark .control-btn {
    background: #4a5568;
    border-color: #718096;
    color: white;
}

.control-btn:hover {
    background: #e47200;
}

.copy-btn {
    background: #F56565;
    color: white;
    border: none;
}

.copy-btn:hover {
    background: #e53e3e;
}

/* News Description - Definitive Visibility Fixes */
.news-description {
    font-size: 20px;
    line-height: 1.8;
    color: #2d3748 !important;
    /* Default light mode color */
    margin-bottom: 40px;
    word-wrap: break-word;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    text-align: justify;
    text-justify: inter-word;
    -webkit-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

/* Aggressive Dark Mode Overrides */
body.dark .main-content,
body.dark .news-description,
body.dark .news-description *,
.dark-mode .news-description,
.dark-mode .news-description *,
[data-theme="dark"] .news-description,
[data-theme="dark"] .news-description * {
    color: #ffffff !important;
    background-color: transparent !important;
}

/* Images inside description */
.news-description img {
    max-width: 100%;
    height: auto !important;
    margin: 25px auto;
    display: block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* 3. IMAGE MODAL / LIGHTBOX */
.image-modal {
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 2147483647;
    /* Highest possible z-index */
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    /* Nearly solid black */
    backdrop-filter: blur(10px);
}

.image-modal.show {
    display: flex;
}

.image-modal .close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-modal .modal-content {
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 8px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    cursor: zoom-in;
    user-select: none;
    touch-action: none;
    position: relative;
    z-index: 10;
}

.image-modal .modal-content.zoomed {
    cursor: grab;
    transition: transform 0.05s ease-out;
}

.image-modal .modal-content.zoomed:active {
    cursor: grabbing;
}

.image-modal .modal-arrow {
    position: absolute;
    top: 50%;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    z-index: 1000;
    transform: translateY(-50%);
    padding: 0 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.image-modal .modal-arrow.left {
    left: 20px;
}

.image-modal .modal-arrow.right {
    right: 20px;
}

.image-modal .zoom-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 1000;
    pointer-events: auto;
}

.image-modal .zoom-controls .btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

.image-modal .image-counter {
    position: absolute;
    top: 20px;
    left: 30px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .readmore-layout {
        flex-direction: column;
        padding-top: 20px;
    }

    .sticky-title {
        font-size: 32px;
        top: 60px;
        padding: 10px 0;
    }

    .sticky-title.scrolled {
        font-size: 24px;
    }

    .trending-sidebar {
        flex: none;
        width: 100%;
        position: static;
        margin-bottom: 40px;
        order: 2;
    }

    .main-content {
        order: 1;
    }

    .news-header {
        position: static;
        padding: 0;
        margin-bottom: 20px;
    }

    .sticky-title {
        font-size: 32px;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 20px;
    }

    .news-description {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .sticky-title {
        font-size: 28px;
    }

    .author-info .name {
        font-size: 18px;
    }
}

/* 4. DOCUMENT SECTION (PDF Support) */
.document-section {
    margin-top: 40px;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #242424;
}

body.dark .document-section {
    background: #2d3748;
    border-color: #4a5568;
}

.document-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #2d3748;
    border-left: 5px solid #3182ce;
    padding-left: 12px;
}

body.dark .document-section h2 {
    color: #edf2f7;
}

.document-item {
    padding: 15px 20px;
    border-radius: 10px;
    border: 1px solid #2424;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

body.dark .document-item {
    background: #1a202c;
    border-color: #4a5568;
}

.document-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.document-info i {
    font-size: 28px;
    color: #e53e3e;
    /* PDF Red */
}

.document-info span {
    font-size: 18px;
    font-weight: 500;
    color: #4a5568;
}

body.dark .document-info span {
    color: #edf2f7;
}

.document-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.doc-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: none;
}

.btn-preview {
    background: #ebf8ff;
    color: #3182ce;
}

.btn-preview:hover {
    background: #bee3f8;
}

.btn-preview.active {
    background: #3182ce;
    color: white;
}

.btn-open {
    background: #f0fff4;
    color: #38a169;
}

.btn-open:hover {
    background: #c6f6d5;
}

.btn-download {
    background: #fff5f5;
    color: #e53e3e;
}

.btn-download:hover {
    background: #fed7d7;
}

.doc-preview-container {
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
}

.doc-preview-container iframe {
    width: 100%;
    height: 600px;
    border: none;
}

@media (max-width: 768px) {
    .doc-preview-container iframe {
        height: 400px;
    }

    .document-actions {
        justify-content: space-between;
    }

    .doc-btn {
        flex: 1;
        justify-content: center;
        padding: 10px;
    }
}

/* 5. RELATED & RECOMMENDATION SECTIONS */
.related-section,
.recommendation-section {
    padding-top: 10px;
    border-top: 2px solid #edf2f7;
}

body.dark .related-section,
body.dark .recommendation-section {
    border-color: #2d3748;
}

.related-section h2,
.recommendation-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 25px;
    color: #1a202c;
    position: relative;
    padding-left: 15px;
    border-bottom: 1px solid #242424;
}

.related-section h2::before,
.recommendation-section h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 40px;
    background: #e47200;
    border-radius: 3px;
}

body.dark .related-section h2,
body.dark .recommendation-section h2 {
    color: #edf2f7;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* Recommendation Grid */
.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.recommend-card {
    text-decoration: none;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark .recommend-card {
    background: #2d3748;
}

.recommend-card:hover {
    transform: translateY(-5px);
}

.recommend-card .card-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}

.recommend-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recommend-card .card-content {
    padding: 12px;
}

.recommend-card .title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.dark .recommend-card .title {
    color: #edf2f7;
}

@media (max-width: 991px) {
    .recommendation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .recommendation-grid {
        grid-template-columns: 1fr;
    }
}

/* 6. ADDITIONAL ATTACHED IMAGES GALLERY */
.additional-gallery {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #edf2f7;
}

body.dark .additional-gallery {
    border-color: #2d3748;
}

.additional-gallery h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    color: #1a202c;
    position: relative;
    padding-left: 15px;
}

.additional-gallery h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 22px;
    background: #4a5568;
    border-radius: 3px;
}

body.dark .additional-gallery h2 {
    color: #edf2f7;
}

.gallery-dynamic-grid {
    display: grid;
    gap: 10px;
    border-radius: 12px;
    overflow: hidden;
}

.dynamic-gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #f7fafc;
}

.dynamic-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.dynamic-gallery-item:hover img {
    transform: scale(1.05);
}

.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

/* Layout for 1 image */
.gallery-layout-1 {
    grid-template-columns: 1fr;
    aspect-ratio: 16/9;
}

/* Layout for 2 images */
.gallery-layout-2 {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 16/9;
}

/* Layout for 3 images */
.gallery-layout-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16/9;
}

.gallery-layout-3 .dynamic-gallery-item:first-child {
    grid-row: span 2;
}

/* Layout for 4 images */
.gallery-layout-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    aspect-ratio: 16/9;
}

/* Layout for 5+ images */
.gallery-layout-5,
.gallery-layout-more {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16/9;
}

.gallery-layout-5 .dynamic-gallery-item:nth-child(1),
.gallery-layout-more .dynamic-gallery-item:nth-child(1) {
    grid-column: span 3;
}

.gallery-layout-5 .dynamic-gallery-item:nth-child(2),
.gallery-layout-more .dynamic-gallery-item:nth-child(2) {
    grid-column: span 3;
}

.gallery-layout-5 .dynamic-gallery-item:nth-child(3),
.gallery-layout-more .dynamic-gallery-item:nth-child(3) {
    grid-column: span 2;
}

.gallery-layout-5 .dynamic-gallery-item:nth-child(4),
.gallery-layout-more .dynamic-gallery-item:nth-child(4) {
    grid-column: span 2;
}

.gallery-layout-5 .dynamic-gallery-item:nth-child(5),
.gallery-layout-more .dynamic-gallery-item:nth-child(5) {
    grid-column: span 2;
}

@media (max-width: 640px) {
    .gallery-dynamic-grid {
        aspect-ratio: auto;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto !important;
    }

    .dynamic-gallery-item {
        aspect-ratio: 1/1;
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
}

/* 7. VIDEO SECTION */
.video-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #edf2f7;
}

body.dark .video-section {
    border-color: #2d3748;
}

.video-section h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    color: #1a202c;
    position: relative;
    padding-left: 15px;
}

.video-section h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 22px;
    background: #4a5568;
    border-radius: 3px;
}

body.dark .video-section h2 {
    color: #edf2f7;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-item {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: hidden;
    background: #f7fafc;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.dark .video-item {
    background: #2d3748;
}

.video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

body.dark .video-item:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-item:hover .video-thumbnail img {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 0, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.video-item:hover .play-overlay {
    background: rgba(255, 0, 0, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.play-overlay i {
    font-size: 28px;
    color: white;
}

.video-caption {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.dark .video-caption {
    color: #edf2f7;
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
    }

    .video-section h2 {
        font-size: 20px;
    }

    .play-overlay {
        width: 50px;
        height: 50px;
    }

    .play-overlay i {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* Trending Sidebar Sequence Styles */
.mobile-trending-ad {
    display: none;
}

.sidebar-sequence-block {
    transition: opacity 0.4s ease;
}

.trending-ad-box {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 10px auto;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 0;
    overflow: hidden;
}

/* Standardized Mobile Behavior */
@media (max-width: 991px) {
    .mobile-trending-ad {
        display: block;
        margin-bottom: 20px;
    }

    .desktop-trending-sequence {
        display: block;
    }

    .sequence-step {
        display: block !important;
        opacity: 1 !important;
        margin-bottom: 20px;
    }

    .trending-ad-box {
        display: none !important;
    }
}