/**
 * Related Articles Carousel Styles
 * Custom styling for the related articles owl carousel
 */

/* ==========================================================================
   Related Articles Carousel Container
   ========================================================================== */

#related-articles-carousel {
    padding: 0;
    margin: 0;
}

#related-articles-carousel .owl-nav {
    margin-top: 20px;
    text-align: center;
}

#related-articles-carousel .owl-nav button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007bff !important;
    color: white !important;
    border: none !important;
    margin: 0 5px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#related-articles-carousel .owl-nav button:hover {
    background: #0056b3 !important;
    transform: scale(1.1);
}

#related-articles-carousel .owl-nav button.owl-prev {
    margin-right: 10px;
}

#related-articles-carousel .owl-nav button.owl-next {
    margin-left: 10px;
}

#related-articles-carousel .owl-dots {
    text-align: center;
    margin-top: 15px;
}

#related-articles-carousel .owl-dots .owl-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    margin: 0 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#related-articles-carousel .owl-dots .owl-dot.active,
#related-articles-carousel .owl-dots .owl-dot:hover {
    background: #007bff;
    transform: scale(1.2);
}

/* ==========================================================================
   Related Article Cards
   ========================================================================== */

.related-article-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.3s ease;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.related-article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15) !important;
    border-color: #007bff;
}

/* Card Image Container */
.related-article-card .card-img-container {
    position: relative;
    overflow: hidden;
    height: 180px;
}

.related-article-card .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    transition: all 0.3s ease;
}

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

/* Card Body */
.related-article-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.related-article-card .card-title {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 10px;
    font-weight: 600;
}

.related-article-card .card-title a {
    color: #212529;
    text-decoration: none;
    transition: color 0.3s ease;
}

.related-article-card .card-title a:hover {
    color: #007bff;
}

.related-article-card .card-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #6c757d;
    flex-grow: 1;
}

/* Badge Styling */
.related-article-card .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* Featured Badge */
.related-article-card .badge.bg-warning {
    font-size: 0.7rem;
    padding: 4px 6px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Mobile Styles */
@media (max-width: 576px) {
    .related-article-card .card-img-container {
        height: 150px;
    }

    .related-article-card .card-body {
        padding: 12px;
    }

    .related-article-card .card-title {
        font-size: 0.9rem;
    }

    .related-article-card .card-text {
        font-size: 0.8rem;
    }

    #related-articles-carousel .owl-nav button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Tablet Styles */
@media (min-width: 577px) and (max-width: 768px) {
    .related-article-card .card-img-container {
        height: 160px;
    }
}

/* Desktop Styles */
@media (min-width: 769px) {
    .related-article-card .card-img-container {
        height: 180px;
    }
}

.related-articles-carousel .badge {
    font-size: 0.7rem;
    padding: 4px 8px;
}

.related-articles-carousel .card-footer {
    background: transparent;
    border-top: 1px solid #f8f9fa;
    padding-top: 10px;
}

.related-articles-carousel .btn-outline-primary {
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.related-articles-carousel .btn-outline-primary:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* General mobile improvements */
@media (max-width: 767.98px) {
    .related-articles-container {
        margin-top: 1.5rem !important;
        padding: 0 10px !important;
    }

    .related-articles-container h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem !important;
    }

    #related-articles-carousel {
        padding: 0;
        margin: 0;
    }

    .related-articles-carousel .owl-nav button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .related-article-card {
        margin: 0 5px;
    }

    .related-article-card .card-img-container {
        height: 160px;
    }

    .related-article-card .card-title {
        font-size: 0.9rem;
    }

    .related-article-card .card-text {
        font-size: 0.8rem;
    }

    .related-article-card .card-body {
        padding: 12px;
    }
}

/* Extra small devices */
@media (max-width: 575.98px) {
    .related-articles-container {
        padding: 0 5px !important;
    }

    .related-articles-carousel .owl-nav {
        margin-top: 15px;
    }

    .related-articles-carousel .owl-dots {
        margin-top: 10px;
    }

    .related-article-card .card-img-container {
        height: 140px;
    }

    .related-article-card .card-body {
        padding: 10px;
    }

    .related-article-card .card-footer {
        padding: 8px 10px;
    }

    .related-article-card .card-title {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .related-article-card .card-text {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    /* Ensure proper spacing on very small screens */
    #related-articles-carousel .owl-stage-outer {
        padding: 0 5px;
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.related-articles-carousel.loading {
    opacity: 0.6;
    pointer-events: none;
}

.related-articles-carousel .owl-stage-outer {
    padding-bottom: 10px;
}

/* ==========================================================================
   Animation Enhancements
   ========================================================================== */

.related-articles-carousel .item {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.related-articles-carousel .item:nth-child(1) { animation-delay: 0.1s; }
.related-articles-carousel .item:nth-child(2) { animation-delay: 0.2s; }
.related-articles-carousel .item:nth-child(3) { animation-delay: 0.3s; }
.related-articles-carousel .item:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Theme Customization
   ========================================================================== */

.related-articles-carousel .owl-theme .owl-nav [class*='owl-'] {
    outline: none;
}

.related-articles-carousel .owl-theme .owl-dots .owl-dot span {
    display: none;
}

/* Custom navigation positioning for larger screens */
@media (min-width: 1200px) {
    .related-articles-carousel .owl-nav {
        position: relative;
    }

    .related-articles-carousel .owl-nav button.owl-prev {
        position: absolute;
        left: -50px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }

    .related-articles-carousel .owl-nav button.owl-next {
        position: absolute;
        right: -50px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }
}

/* ==========================================================================
   Simple Layout for Few Articles (≤ 3)
   ========================================================================== */

/* When we have 3 or fewer items, display them as a simple grid */
.related-articles-carousel.simple-layout {
    padding: 0;
}

.related-articles-carousel.simple-layout .owl-stage-outer {
    padding: 0 !important;
    overflow: visible !important;
}

.related-articles-carousel.simple-layout .owl-stage {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    width: 100% !important;
    transform: none !important;
    left: auto !important;
}

.related-articles-carousel.simple-layout .owl-item {
    position: static !important;
    width: auto !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    float: none !important;
    min-width: 280px;
    max-width: calc(33.333% - 15px);
}

/* Responsive adjustments for simple layout */
@media (max-width: 767.98px) {
    .related-articles-carousel.simple-layout .owl-item {
        min-width: 250px;
        max-width: calc(50% - 10px);
    }

    .related-articles-carousel.simple-layout .owl-stage {
        gap: 15px !important;
    }
}

@media (max-width: 575.98px) {
    .related-articles-carousel.simple-layout .owl-item {
        min-width: 100%;
        max-width: 100%;
    }
}

/* Hide navigation and dots for simple layout */
.related-articles-carousel.simple-layout .owl-nav,
.related-articles-carousel.simple-layout .owl-dots {
    display: none !important;
}

/* ==========================================================================
   End Simple Layout
   ========================================================================== */
