/* ===== Related News Section ===== */
.related-news-wrap {
    margin-top: 25px;
}
.related-news-wrap > h1,
.related-news-wrap > .related-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, #49b545, #3a9a37);
    background-image: url(../images/bg_patt.png), linear-gradient(135deg, #49b545, #3a9a37);
    background-size: 50%, 100%;
    color: #fff;
    border-radius: 10px 10px 0 0;
}

/* ===== Grid layout for cards ===== */
.related-news-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    margin-bottom: 25px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 10px 10px;
}

.full .item .related-card,
.related-card {
    border: none !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

[id*="related"] .related-card,
.item > .related-card {
    display: inline-block;
    vertical-align: top;
}

/* ===== Individual card ===== */
.related-card {
    width: calc(50% - 6px);
    box-sizing: border-box;
    margin: 0 !important;
    position: relative;
}

.related-card__link {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    text-decoration: none !important;
    color: #212529;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.related-card__link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #49b545, #2bb42b);
    border-radius: 3px 0 0 3px;
    transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.related-card__link:hover {
    border-color: rgba(73, 181, 69, 0.3);
    box-shadow: 0 8px 30px rgba(73, 181, 69, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-3px);
}
.related-card__link:hover::before {
    height: 100%;
}

.related-card__poster {
    flex-shrink: 0;
    width: 80px;
    height: 105px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #f1f3f5;
}
.related-card__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}
.related-card__link:hover .related-card__poster img {
    transform: scale(1.08);
    filter: brightness(0.7);
}

.related-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(73, 181, 69, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.related-card__link:hover .related-card__overlay {
    opacity: 1;
}

.related-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.related-card__title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: #212529;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.25s ease;
    background: none !important;
    padding: 0 !important;
}
.related-card__link:hover .related-card__title {
    color: #49b545;
}

.related-card__text {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@keyframes relatedFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.related-card {
    animation: relatedFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.related-card:nth-child(1) { animation-delay: 0s; }
.related-card:nth-child(2) { animation-delay: 0.06s; }
.related-card:nth-child(3) { animation-delay: 0.12s; }
.related-card:nth-child(4) { animation-delay: 0.18s; }
.related-card:nth-child(5) { animation-delay: 0.24s; }
.related-card:nth-child(6) { animation-delay: 0.30s; }
.related-card:nth-child(7) { animation-delay: 0.36s; }
.related-card:nth-child(8) { animation-delay: 0.42s; }
.related-card:nth-child(9) { animation-delay: 0.48s; }
.related-card:nth-child(10) { animation-delay: 0.54s; }

/* ===== DARK THEME ===== */
[data-theme="dark"] .related-news-grid {
    background: #14161c;
    border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .related-card__link {
    background: #191b22;
    border-color: rgba(255, 255, 255, 0.06);
    color: #b8bdc6;
}
[data-theme="dark"] .related-card__link:hover {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(34, 197, 94, 0.08);
}
[data-theme="dark"] .related-card__link::before {
    background: linear-gradient(180deg, #22c55e, #16a34a);
}
[data-theme="dark"] .related-card__title {
    color: #e2e5ea;
}
[data-theme="dark"] .related-card__link:hover .related-card__title {
    color: #4ade80;
}
[data-theme="dark"] .related-card__text {
    color: #9da3ad;
}
[data-theme="dark"] .related-card__poster {
    background: #22252d;
}
[data-theme="dark"] .related-card__overlay {
    background: rgba(34, 197, 94, 0.75);
}
[data-theme="dark"] .related-news-wrap > h1,
[data-theme="dark"] .related-news-wrap > .related-title {
    background-image: url(../images/bg_patt.png), linear-gradient(135deg, #16a34a, #22c55e);
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .related-card {
        width: 100% !important;
        margin: 0 0 10px !important;
    }
    .related-card__poster {
        width: 65px;
        height: 85px;
    }
    .related-card__title {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    .related-card__text {
        -webkit-line-clamp: 2;
        font-size: 11px;
    }
    .related-card__overlay span {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .related-card {
        width: calc(50% - 8px);
    }
}