﻿/* Global overflow prevention */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

.magazine-feed-body {
    background-color: #f8f7f4;
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* Magazine Feed Styles */
.magazine-feed-body {
    background-color: #f8f7f4;
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
}

/* Back Navigation */
.back-navigation {
    background-color: #1a1a1a;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.back-link {
    color: #ffffff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 400;
    transition: all 0.3s ease;
}

    .back-link:hover {
        color: #d4a574;
        transform: translateX(-5px);
    }

    .back-link i {
        font-size: 1.1rem;
    }

/* Feed Header */
.feed-header {
    background-color: #ffffff;
    padding: 2rem 0 0 0;
    border-bottom: 1px solid #e5e5e5;
}

.feed-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
    letter-spacing: -1px;
}

.daily-text {
    font-weight: 400;
    font-style: italic;
}

.feed-nav {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding-bottom: 0;
}

.nav-tab {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 1px;
    color: #6b6b6b;
    text-decoration: none;
    padding: 1rem 0;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

    .nav-tab:hover,
    .nav-tab.active {
        color: #1a1a1a;
        border-bottom-color: #1a1a1a;
    }

/* Feed Container */
.magazine-feed-container {
    min-height: 100vh;
}

/* Section */
.feed-section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a1a;
    position: relative;
    display: inline-block;
}

    .section-title::after {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 2px;
        background-color: #d4a574;
    }

/* Feed Grid */
.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    grid-auto-flow: dense;
}

.articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-flow: dense;
}

/* Feed Cards */
.feed-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
    background-color: #ffffff;
    height: 400px;
}

    .feed-card.large {
        grid-column: span 2;
        grid-row: span 2;
        height: auto;
        min-height: 600px;
    }

    .feed-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    }

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.card-image {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: transparent;
}

    .card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

        .card-image img.portrait {
            object-fit: contain;
        }

    .card-image::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
        opacity: 0.7;
        transition: opacity 0.3s ease;
    }

.feed-card:hover .card-image::before {
    opacity: 0.85;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    color: #ffffff;
    z-index: 1;
}

.feed-card.large .card-overlay {
    padding: 3rem;
}

.card-category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #d4a574;
    margin-bottom: 0.75rem;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: #ffffff;
}

.feed-card.large .card-title {
    font-size: 2.5rem;
}

.card-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-card.large .card-description {
    font-size: 1rem;
    -webkit-line-clamp: 4;
}

.read-more {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #ffffff;
    border-bottom: 2px solid #d4a574;
    padding-bottom: 4px;
    transition: all 0.3s ease;
}

.feed-card:hover .read-more {
    color: #d4a574;
}

/* Load More Button */
.btn-load-more {
    background-color: transparent;
    border: 2px solid #1a1a1a;
    color: #1a1a1a;
    padding: 1rem 3rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .btn-load-more:hover {
        background-color: #1a1a1a;
        color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    }

/* Responsive Design */
@media (max-width: 1200px) {
    .feed-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .feed-card.large {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .feed-title {
        font-size: 2.5rem;
    }

    .feed-nav {
        gap: 2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .feed-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .feed-card,
    .feed-card.large {
        height: 350px;
        min-height: 350px;
    }

    .card-title {
        font-size: 1.3rem;
    }

    .feed-card.large .card-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .back-link {
        font-size: 0.85rem;
    }

    .feed-title {
        font-size: 2rem;
    }

    .nav-tab {
        font-size: 0.8rem;
    }

    .card-overlay {
        padding: 1.5rem;
    }
}

/* ... existing styles ... */

/* Back to Feed Button */
.back-to-feed-container {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.btn-back-to-feed {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

    .btn-back-to-feed:hover {
        color: #d4a574;
        background-color: #f8f7f4;
        border-color: #d4a574;
        transform: translateX(-5px);
    }

    .btn-back-to-feed i {
        font-size: 1.2rem;
        transition: transform 0.3s ease;
    }

    .btn-back-to-feed:hover i {
        transform: translateX(-3px);
    }

/* Mobile responsive */
@media (max-width: 768px) {
    .back-to-feed-container {
        padding: 0.75rem 0;
        margin-bottom: 1rem;
    }

    .btn-back-to-feed {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }

        .btn-back-to-feed i {
            font-size: 1rem;
        }
}

/* ==================== ARTICLE FEED LIST (REDESIGNED) ==================== */

.article-feed-container {
    background-color: #f8f7f4;
    min-height: 100vh;
    padding: 2rem 0 4rem;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

    .article-feed-container .container-fluid {
        max-width: 100%;
        overflow-x: hidden;
    }
    .article-feed-container .row {
        align-items: flex-start; /* Align columns to top */
    }

/* Main Article Section (Left Side - 9 columns) */
.main-article-section {
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    max-width: 100%;
    margin-top: 0; /* Remove any top margin */
}

.article-header {
    border-bottom: 2px solid #e5e5e5;
    padding-bottom: 1rem;
}

.article-main-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    margin-bottom: 1rem;
    word-wrap: break-word; /* Prevent long words from causing overflow */
    overflow-wrap: break-word;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #6b6b6b;
    font-size: 0.95rem;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.article-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Article Carousel */
.article-carousel-container {
    width: 100%;
    max-width: 100%; /* Critical: prevent overflow */
    background-color: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

    .article-carousel-container .carousel {
        width: 100%;
        max-width: 100%;
    }

    .article-carousel-container .carousel-inner {
        width: 100%;
        max-width: 100%;
    }

    .article-carousel-container .carousel-item {
        width: 100%;
        max-width: 100%;
    }

    .article-carousel-container .carousel-image-container {
        width: 100%;
        max-width: 100%;
        height: 500px;
        overflow: hidden;
        background-color: #000;
    }

        .article-carousel-container .carousel-image-container img {
            width: 100%;
            max-width: 100%; /* Ensure images don't overflow */
            height: 100%;
            object-fit: contain;
            background-color: #000;
        }

    .article-carousel-container .carousel-control-prev,
    .article-carousel-container .carousel-control-next {
        width: 50px;
        height: 50px;
        top: 50%;
        transform: translateY(-50%);
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        opacity: 0.7;
        transition: all 0.3s ease;
    }

    .article-carousel-container .carousel-control-prev {
        left: 10px; /* Reduced from 20px to keep within bounds */
    }

    .article-carousel-container .carousel-control-next {
        right: 10px; /* Reduced from 20px to keep within bounds */
    }

        .article-carousel-container .carousel-control-prev:hover,
        .article-carousel-container .carousel-control-next:hover {
            opacity: 1;
            background-color: rgba(255, 255, 255, 1);
        }

    .article-carousel-container .carousel-control-prev-icon,
    .article-carousel-container .carousel-control-next-icon {
        width: 24px;
        height: 24px;
        background-size: 100%;
        filter: invert(1);
    }

    .article-carousel-container .carousel-indicators {
        bottom: 20px;
        margin-left: 0;
        margin-right: 0;
    }

        .article-carousel-container .carousel-indicators button {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.6);
            border: 2px solid rgba(255, 255, 255, 0.8);
            margin: 0 5px;
        }

            .article-carousel-container .carousel-indicators button.active {
                background-color: #d4a574;
                border-color: #d4a574;
            }

/* Article Content */
.article-content {
    padding: 0;
    max-width: 100%;
    overflow: hidden !important; /* Force hide overflow */
    word-break: break-word;
}

.article-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    max-width: 100%;
    overflow-x: hidden !important;
    overflow-y: visible;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

    .article-description * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .article-description p {
        margin-bottom: 1.5rem;
        max-width: 100% !important;
    }

    .article-description h1,
    .article-description h2,
    .article-description h3,
    .article-description h4,
    .article-description h5,
    .article-description h6 {
        font-family: 'Playfair Display', serif;
        margin-top: 2rem;
        margin-bottom: 1rem;
        color: #1a1a1a;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100% !important;
    }

    .article-description img {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
        border-radius: 8px;
        margin: 1.5rem 0;
        display: block;
        object-fit: contain;
    }

    .article-description iframe,
    .article-description video,
    .article-description embed,
    .article-description object {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 1.5rem 0;
    }

    .article-description table {
        width: 100% !important;
        max-width: 100% !important;
        display: block;
        overflow-x: auto;
        border-collapse: collapse;
        margin: 1.5rem 0;
        word-break: normal;
    }
        .article-description table td,
        .article-description table th {
            padding: 0.75rem;
            border: 1px solid #ddd;
            word-break: break-word;
        }

    .article-description pre {
        max-width: 100% !important;
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
        background-color: #f5f5f5;
        padding: 1rem;
        border-radius: 4px;
        margin: 1.5rem 0;
    }

    .article-description code {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: pre-wrap;
    }

    .article-description ul,
    .article-description ol {
        max-width: 100% !important;
        padding-left: 2rem;
        margin: 1rem 0;
    }

    .article-description li {
        max-width: 100% !important;
        word-wrap: break-word;
        margin-bottom: 0.5rem;
    }

    .article-description blockquote {
        max-width: 100% !important;
        border-left: 4px solid #d4a574;
        padding-left: 1.5rem;
        margin: 1.5rem 0;
        font-style: italic;
        color: #555;
    }

    /* Links - prevent long URLs from breaking layout */
    .article-description a {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-all; /* Break long URLs */
        color: #d4a574;
        text-decoration: underline;
    }

        .article-description a:hover {
            color: #c5a76f;
        }

    .article-description div {
        max-width: 100% !important;
        overflow-x: hidden;
    }

    /* Figures and captions */
    .article-description figure {
        max-width: 100% !important;
        margin: 1.5rem 0;
    }

    .article-description figcaption {
        font-size: 0.9rem;
        color: #666;
        text-align: center;
        margin-top: 0.5rem;
    }

    .article-description .note-editable {
        max-width: 100% !important;
    }

    /* Handle any floated elements */
    .article-description::after {
        content: "";
        display: table;
        clear: both;
    }

    .article-description [style*="float"] {
        max-width: 50% !important;
    }

    /* Force wrapping on specific inline elements */
    .article-description span,
    .article-description strong,
    .article-description em,
    .article-description b,
    .article-description i {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Horizontal rules */
    .article-description hr {
        margin: 2rem 0;
        border: none;
        border-top: 2px solid #e5e5e5;
    }

/* Articles Sidebar (Right Side - 3 columns) */
.articles-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 100%;
    margin-top: 0; /* Remove any top margin to align with article */
}

.sidebar-search {
    margin-bottom: 1.5rem;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

    .search-input-group i {
        position: absolute;
        left: 15px;
        color: #6b6b6b;
        font-size: 1rem;
        z-index: 1;
    }

    .search-input-group .form-control {
        width: 100%;
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        border: 2px solid #e5e5e5;
        border-radius: 25px;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        box-sizing: border-box;
    }

        .search-input-group .form-control:focus {
            outline: none;
            border-color: #d4a574;
            box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
        }

/* Articles List Cards */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
}

.article-card {
    display: block;
    background-color: #ffffff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    max-width: 100%;
}

    .article-card:hover {
        border-color: #d4a574;
        box-shadow: 0 4px 15px rgba(212, 165, 116, 0.2);
        transform: translateY(-3px);
    }

    .article-card.active {
        border-color: #d4a574;
        background-color: #faf9f7;
        box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
    }

.article-card-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background-color: #f0f0f0;
}

    .article-card-image img {
        width: 100%;
        max-width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.article-card:hover .article-card-image img {
    transform: scale(1.05);
}

.article-card-content {
    padding: 1rem;
    max-width: 100%;
}

.article-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

.article-card-description {
    font-size: 0.8rem;
    color: #6b6b6b;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
}

.article-card-date {
    font-size: 0.75rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Scrollbar for sidebar */
.articles-sidebar::-webkit-scrollbar {
    width: 6px;
}

.articles-sidebar::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.articles-sidebar::-webkit-scrollbar-thumb {
    background: #d4a574;
    border-radius: 10px;
}

    .articles-sidebar::-webkit-scrollbar-thumb:hover {
        background: #c5a76f;
    }

/* Responsive Design */
@media (max-width: 992px) {
    .article-feed-container .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .article-main-title {
        font-size: 2rem;
    }

    .article-carousel-container .carousel-image-container {
        height: 350px;
    }

    .articles-sidebar {
        position: static;
        max-height: none;
        margin-top: 2rem;
    }

    .main-article-section {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .article-feed-container .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .article-main-title {
        font-size: 1.75rem;
    }

    .article-carousel-container .carousel-image-container {
        height: 250px;
    }

    .article-description {
        font-size: 1rem;
    }

    .main-article-section {
        padding: 1rem;
    }

    .articles-sidebar {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .article-feed-container .container-fluid {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .article-carousel-container .carousel-control-prev,
    .article-carousel-container .carousel-control-next {
        width: 40px;
        height: 40px;
    }

    .article-carousel-container .carousel-control-prev {
        left: 5px;
    }

    .article-carousel-container .carousel-control-next {
        right: 5px;
    }

    .main-article-section {
        padding: 0.75rem;
    }
}

/* Magazine Link Section */
.magazine-link-section {
    border-top: 2px solid #e5e5e5 !important;
}

.btn-view-magazine {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #d4a574;
    color: #ffffff;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #d4a574;
}

    .btn-view-magazine:hover {
        background-color: #c5a76f;
        border-color: #c5a76f;
        color: #ffffff;
        transform: translateX(5px);
        box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
    }

    .btn-view-magazine i {
        transition: transform 0.3s ease;
    }

    .btn-view-magazine:hover i {
        transform: translateX(3px);
    }