/**
 * Related Posts Inserter - Frontend Styles
 * Mobile-First: Vertical stacking on mobile, side-by-side on desktop
 */

/* ========================================
   BASE STYLES (All Styles Share These)
   ======================================== */

.rpi-related-posts-box {
    margin: 24px 0;
    clear: both;
}

.rpi-box-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #333;
}

.rpi-posts-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rpi-post-item {
    width: 100%;
}

.rpi-post-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rpi-post-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f0f0f0;
}

.rpi-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.rpi-post-thumbnail.rpi-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #999;
}

.rpi-post-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    margin-top: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Desktop: Side by side (3 columns) */
@media screen and (min-width: 768px) {
    .rpi-posts-grid {
        flex-direction: row;
        gap: 20px;
    }

    .rpi-post-item {
        flex: 1;
        max-width: calc(33.333% - 14px);
    }
}

/* ========================================
   STYLE 1: Minimal Card
   Clean white cards with subtle shadow
   ======================================== */

.rpi-style-1 {
    padding: 0;
    background: transparent;
}

.rpi-style-1 .rpi-box-title {
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.rpi-style-1 .rpi-post-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.rpi-style-1 .rpi-post-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.rpi-style-1 .rpi-post-thumbnail {
    border-radius: 0;
}

.rpi-style-1 .rpi-post-link:hover .rpi-post-thumbnail img {
    transform: scale(1.05);
}

.rpi-style-1 .rpi-post-title {
    padding: 12px 14px 14px;
    margin-top: 0;
    font-size: 14px;
}

@media screen and (min-width: 768px) {
    .rpi-style-1 .rpi-post-title {
        font-size: 15px;
    }
}

/* ========================================
   STYLE 2: Red Glass (Glassmorphism + Red Border)
   Eye-catching frosted glass with red accent
   ======================================== */

.rpi-style-2 {
    padding: 22px 24px;
    background: linear-gradient(135deg, rgba(255, 240, 240, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 3px solid #dc3545;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.15), 0 0 0 1px rgba(220, 53, 69, 0.1);
}

.rpi-style-2 .rpi-box-title {
    color: #dc3545;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 2px solid rgba(220, 53, 69, 0.3);
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.rpi-style-2 .rpi-post-item {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rpi-style-2 .rpi-post-thumbnail {
    border-radius: 0;
}

.rpi-style-2 .rpi-post-link:hover {
    transform: translateY(-4px);
}

.rpi-style-2 .rpi-post-link:hover .rpi-post-thumbnail img {
    transform: scale(1.05);
}

.rpi-style-2 .rpi-post-title {
    padding: 14px 16px 18px;
    margin: 0;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.rpi-style-2 .rpi-post-link:hover .rpi-post-title {
    color: #dc3545;
}

@media screen and (min-width: 768px) {
    .rpi-style-2 .rpi-post-title {
        font-size: 15px;
    }
}

/* ========================================
   STYLE 3: Magazine Grid
   Bold image with overlay title
   ======================================== */

.rpi-style-3 {
    padding: 0;
    background: transparent;
}

.rpi-style-3 .rpi-box-title {
    color: #111;
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.rpi-style-3 .rpi-post-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.rpi-style-3 .rpi-post-thumbnail {
    aspect-ratio: 4 / 3;
}

.rpi-style-3 .rpi-post-thumbnail::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    pointer-events: none;
}

.rpi-style-3 .rpi-post-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.rpi-style-3 .rpi-post-link:hover .rpi-post-thumbnail img {
    transform: scale(1.1);
}

@media screen and (min-width: 768px) {
    .rpi-style-3 .rpi-post-title {
        font-size: 16px;
    }
}

/* ========================================
   STYLE 4: List Style (Bigger)
   Larger horizontal layout for better readability
   ======================================== */

.rpi-style-4 {
    padding: 24px;
    background: #f8f9fa;
    border-radius: 14px;
    border-left: 6px solid #0066cc;
}

.rpi-style-4 .rpi-box-title {
    color: #0066cc;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 18px;
}

.rpi-style-4 .rpi-posts-grid {
    gap: 16px;
}

.rpi-style-4 .rpi-post-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e0e7ef;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}

.rpi-style-4 .rpi-post-link {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
}

.rpi-style-4 .rpi-post-thumbnail {
    width: 140px;
    min-width: 140px;
    height: 90px;
    aspect-ratio: auto;
    border-radius: 10px;
    overflow: hidden;
}

.rpi-style-4 .rpi-post-title {
    margin: 0;
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: #1a1a1a;
}

.rpi-style-4 .rpi-post-link:hover {
    background: #f0f7ff;
    border-radius: 12px;
}

.rpi-style-4 .rpi-post-link:hover .rpi-post-title {
    color: #0066cc;
}

/* Desktop: Even larger images */
@media screen and (min-width: 768px) {
    .rpi-style-4 .rpi-posts-grid {
        flex-direction: column;
    }

    .rpi-style-4 .rpi-post-item {
        max-width: 100%;
        padding: 20px;
    }

    .rpi-style-4 .rpi-post-thumbnail {
        width: 200px;
        min-width: 200px;
        height: 120px;
    }

    .rpi-style-4 .rpi-post-title {
        font-size: 18px;
    }
}

/* ========================================
   STYLE 5: Glassmorphism
   Modern frosted glass effect
   ======================================== */

.rpi-style-5 {
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    background-color: rgba(245, 247, 250, 0.95);
}

.rpi-style-5 .rpi-box-title {
    color: #6366f1;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.rpi-style-5 .rpi-post-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.rpi-style-5 .rpi-post-thumbnail {
    border-radius: 0;
}

.rpi-style-5 .rpi-post-link:hover {
    transform: translateY(-4px) scale(1.02);
}

.rpi-style-5 .rpi-post-link:hover .rpi-post-thumbnail img {
    transform: scale(1.08);
}

.rpi-style-5 .rpi-post-title {
    padding: 12px 14px 14px;
    margin: 0;
    font-size: 14px;
    color: #374151;
}

.rpi-style-5 .rpi-post-link:hover .rpi-post-title {
    color: #6366f1;
}

@media screen and (min-width: 768px) {
    .rpi-style-5 .rpi-post-title {
        font-size: 15px;
    }
}

/* ========================================
   NO POSTS MESSAGE
   ======================================== */

.rpi-no-posts {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}