/* News & Events Section */
.news-events-section {
    --section-spacing: 5rem;
    --card-spacing: 1.5rem;
    --image-radius: 0.75rem;
    --transition: 0.3s ease;
    --overlay-color: rgba(0, 0, 0, 0.5);

    padding: var(--section-spacing) 0;
    background-color: var(--neutral-100);
    padding: 4rem 0;
}

/* Section Header - Fix stacking context */
.section-header {
    margin-bottom: 3rem;
    text-align: center;
    position: relative; /* Ensure proper stacking */
    z-index: 1;
}

/* Category Tag - Standardized width */
.category-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    min-width: 120px; /* Standard minimum width */
    max-width: 160px; /* Maximum width to prevent overflow */
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--text-light);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: translateZ(0);
    pointer-events: none;
    transition: none;
}

/* News Image Container - Ensure proper positioning context */
.news-image {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: var(--image-radius) var(--image-radius) 0 0;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translateZ(0); /* Hardware acceleration */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
    will-change: transform;
}

/* Remove any conflicting styles */
.news-item {
    background: var(--white);
    border-radius: var(--image-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    position: relative;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

/* Section Badge - Ensure proper positioning */
.section-badge {
    position: relative;
    z-index: 2;
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* Section Title - Ensure proper positioning */
.section-title {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

/* Remove any AOS-related flickering */
[data-aos] {
    pointer-events: none;
}

[data-aos].aos-animate {
    pointer-events: auto;
}

/* Category Filter - Prevent flickering */
.category-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 2rem 0;
    opacity: 1 !important; /* Prevent AOS opacity flickering */
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--neutral-200);
    border-radius: 2rem;
    background: var(--white);
    color: var(--neutral-700);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color var(--transition),
                color var(--transition),
                border-color var(--transition);
    cursor: pointer;
    opacity: 1 !important; /* Prevent button flickering */
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

/* Smooth Hover Effects */
.news-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.news-item:hover .news-image img {
    transform: scale(1.05) translateZ(0);
}

/* Category Tag */
.news-image .category-tag {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--white);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 1;
    transform: translateZ(0); /* Prevent flickering */
}

/* Ensure smooth transitions for filtering */
.news-item[data-filtered="false"] {
    display: none;
}

/* Featured News Slider */
.featured-news-slider {
    position: relative;
    margin-bottom: 2rem;
    height: auto;
}

.swiper-container {
    overflow: hidden;
    border-radius: var(--image-radius);
}

.featured-news {
    background: var(--white);
    border-radius: var(--image-radius);
    overflow: hidden;
}

.featured-image {
    position: relative;
    height: 100%;
    min-height: 400px;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent, var(--overlay-color));
}

.news-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 2;
}

.featured-content {
    padding: 2rem;
}

/* News Meta */
.news-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.category {
    color: var(--primary);
    font-weight: 500;
}

.date {
    color: var(--neutral-600);
    font-size: 0.875rem;
}

/* Content Footer */
.content-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
}

.share-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--neutral-200);
    background: var(--white);
    color: var(--neutral-600);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Swiper Navigation */
.swiper-button-prev,
.swiper-button-next {
    width: 3rem;
    height: 3rem;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.swiper-button-prev::after,
.swiper-button-next::after {
    font-size: 1.25rem;
    color: var(--neutral-900);
}

.swiper-pagination-bullet {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--white);
    opacity: 0.5;
}

.swiper-pagination-bullet-active {
    opacity: 1;
    background: var(--primary);
}

/* News Grid */
.news-grid {
    margin-top: 3rem;
    scroll-margin-top: 100px;
    transition: all var(--transition);
}

/* Load More Button */
.load-more-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 100px;
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    gap: 0.75rem;
    min-width: 180px;
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.load-more-btn.show-less {
    background-color: var(--primary);
    color: var(--text-light);
}

.load-more-btn:hover {
    background: var(--primary);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(27, 67, 50, 0.15);
}

.load-more-btn:focus {
    box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.25);
    outline: none;
}

.load-more-btn:hover i {
    transform: translateY(3px);
}

.load-more-btn i {
    transition: transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.load-more-btn.loading {
    opacity: 0.8;
    cursor: wait;
}

.load-more-btn.loading i {
    display: none;
}

.load-more-btn.loading .spinner-border {
    display: inline-block !important;
}

/* Newsletter Section */
.newsletter-section {
    background: linear-gradient(45deg, var(--primary-100), var(--primary-50));
    border: 1px solid var(--primary-200);
}

.newsletter-form .form-control {
    border-radius: 2rem 0 0 2rem;
    border: none;
    padding: 0.75rem 1.5rem;
}

.newsletter-form .btn {
    border-radius: 0 2rem 2rem 0;
    padding: 0.75rem 2rem;
}

/* Share Modal */
.share-modal .modal-content {
    border-radius: var(--image-radius);
    border: none;
}

.share-options {
    padding: 1rem;
}

.share-option {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .featured-image {
        min-height: 300px;
    }

    .featured-content {
        padding: 1.5rem;
    }

    .category-filter {
        gap: 0.5rem;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .news-events-section {
        --section-spacing: 3rem;
    }

    .featured-news {
        margin-bottom: 2rem;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 1rem;
    }

    .newsletter-form .form-control,
    .newsletter-form .btn {
        border-radius: 2rem;
    }

    .category-tag {
        min-width: 100px;
        max-width: 140px;
        font-size: 0.8125rem;
        padding: 0.4rem 0.875rem;
    }

    .filter-btn,
    .load-more-btn {
        min-height: 44px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .news-item,
    .news-image img,
    .filter-btn,
    .share-btn {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .news-events-section {
        background: none;
    }

    .news-item {
        break-inside: avoid;
        box-shadow: none;
    }

    .category-filter,
    .newsletter-section,
    .share-buttons {
        display: none;
    }
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(27, 67, 50, 0.2);
}

/* Swiper Navigation Positioning */
.featured-news-slider {
    position: relative;
}

.swiper-button-prev,
.swiper-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: all 0.3s ease;
}

.swiper-button-prev {
    left: 1rem;
}

.swiper-button-next {
    right: 1rem;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background: var(--primary);
}

.swiper-button-prev:hover::after,
.swiper-button-next:hover::after {
    color: var(--white);
}

/* Filter Animation */
.news-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.news-item[data-loaded="false"] {
    display: none;
}

/* Loading State */
.load-more-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Read More Link */
.read-more {
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    margin-top: auto;
}

.read-more:hover {
    color: var(--primary-dark);
}

.read-more i {
    transition: transform var(--transition);
}

.read-more:hover i {
    transform: translateX(5px);
}

/* News Grid Layout */
.news-grid .row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.news-grid .col-md-6 {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* Ensure proper spacing */
.news-details {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-details p {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.news-item {
    height: 100%;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.load-more-btn .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Prevent text selection during hover animation */
.news-item * {
    user-select: none;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.filter-btn:focus-visible,
.load-more-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Add loading skeleton animation */
.news-item.loading {
    position: relative;
    overflow: hidden;
}

.news-item.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}


/* News Item Card */
.news-item {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* News Item Share Button Styles */
.news-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    width: 90%;
    margin: 0 auto;
}

.share-btn {
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    transition: all 0.3s ease;
}

.share-btn:hover {
    color: var(--bs-primary);
    background-color: rgba(0, 0, 0, 0.05);
}

/* Share Modal Styles */
.share-options .btn {
    min-width: 120px;
    padding: 0.75rem 1.25rem;
}

.share-options .btn i {
    margin-right: 0.5rem;
}

/* Social Platform Colors */
.share-options .btn[data-platform="facebook"] {
    color: #1877f2;
    border-color: #1877f2;
}

.share-options .btn[data-platform="facebook"]:hover {
    background-color: #1877f2;
    color: #fff;
}

.share-options .btn[data-platform="twitter"] {
    color: #1da1f2;
    border-color: #1da1f2;
}

.share-options .btn[data-platform="twitter"]:hover {
    background-color: #1da1f2;
    color: #fff;
}

.share-options .btn[data-platform="linkedin"] {
    color: #0a66c2;
    border-color: #0a66c2;
}

.share-options .btn[data-platform="linkedin"]:hover {
    background-color: #0a66c2;
    color: #fff;
}

/* News Item Action Styles */
.action-left {
    flex: 0 1 auto;
    max-width: 70%;
}

.action-right {
    flex: 0 0 auto;
    margin-left: 15px;
}

/* Read More Button Styles */
.read-more {
    display: inline-flex;
    align-items: center;
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.read-more i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.read-more:hover {
    color: var(--bs-primary-dark);
}

.read-more:hover i {
    transform: translateX(5px);
}

/* News Card Layout */
.news-details {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
    overflow: visible;
}

.news-divider {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    opacity: 0.5;
}

/* Ensure proper spacing in news card */
.news-details p {
    flex-grow: 1;
    margin-bottom: 0;
}

/* Ensure container doesn't clip the arrow */
.news-actions {
    padding: 0.5rem;
    overflow: visible;
    margin-right: 10px;
}

.news-item {
    overflow: visible;
}

/* Ensure parent containers don't clip */
.news-item,
.news-details,
.news-actions {
    overflow: visible !important;
}
