/* Related Posts Manager - Grid Creative Theme */
/* 창의적이고 독특한 그리드 레이아웃 - 다양한 카드 크기와 컬러풀한 디자인 */

/* CSS 리셋 및 기본 스타일 */
.rpm-related-container,
.rpm-related-container *,
.rpm-related-container *::before,
.rpm-related-container *::after {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border: none !important;
    background: none !important;
    text-decoration: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    text-align: left !important;
    vertical-align: baseline !important;
    list-style: none !important;
    float: none !important;
    position: static !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

/* 메인 컨테이너 - 창의적 배경 */
.rpm-related-container {
    margin: 40px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    position: relative !important;
}

.rpm-related-container::before {
    content: '' !important;
    position: absolute !important;
    top: -10px !important;
    left: -10px !important;
    right: -10px !important;
    bottom: -10px !important;
    background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 25%, #fecfef 50%, #f093fb 75%, #f5576c 100%) !important;
    background-size: 400% 400% !important;
    animation: rpm-creative-gradient 15s ease infinite !important;
    border-radius: 20px !important;
    opacity: 0.1 !important;
    z-index: -1 !important;
}

@keyframes rpm-creative-gradient {
    0% { background-position: 0% 50% !important; }
    50% { background-position: 100% 50% !important; }
    100% { background-position: 0% 50% !important; }
}

/* 제목 스타일 - 창의적이고 컬러풀한 디자인 */
.rpm-related-container .rpm-title {
    margin: 0 0 18px 0 !important;
    padding: 16px 24px !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    color: #ffffff !important;
    text-align: center !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
    border: none !important;
    border-radius: 25px !important;
    position: relative !important;
    display: block !important;
    letter-spacing: -0.8px !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3) !important;
    overflow: hidden !important;
}

.rpm-title::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent) !important;
    animation: rpm-title-shine 3s infinite !important;
}

@keyframes rpm-title-shine {
    0% { left: -100% !important; }
    100% { left: 100% !important; }
}

.rpm-title::after {
    content: '🎨' !important;
    position: absolute !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 18px !important;
    opacity: 0.8 !important;
}

/* 글 목록 컨테이너 - 창의적 그리드 */
.rpm-posts-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    width: 100% !important;
}

/* 개별 글 아이템 - 다양한 색상의 창의적 카드 */
.rpm-post-item {
    display: block !important;
    position: relative !important;
    background: #ffffff !important;
    border: none !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    transform-origin: center !important;
}

/* 각 카드에 다른 색상 테두리 */
.rpm-post-item:nth-child(4n+1) {
    border-top: 4px solid #ff6b6b !important;
}

.rpm-post-item:nth-child(4n+2) {
    border-top: 4px solid #4ecdc4 !important;
}

.rpm-post-item:nth-child(4n+3) {
    border-top: 4px solid #45b7d1 !important;
}

.rpm-post-item:nth-child(4n+4) {
    border-top: 4px solid #96ceb4 !important;
}

.rpm-post-item:hover {
    transform: translateY(-12px) rotate(2deg) scale(1.03) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
}

.rpm-post-item:nth-child(even):hover {
    transform: translateY(-12px) rotate(-2deg) scale(1.03) !important;
}

/* 링크 */
.rpm-post-link {
    display: block !important;
    text-decoration: none !important;
    color: inherit !important;
    width: 100% !important;
    height: 100% !important;
}

.rpm-post-link:hover {
    text-decoration: none !important;
    color: inherit !important;
}

/* 썸네일 래퍼 - 창의적 형태 */
.rpm-thumbnail-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 200px !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 12px 12px 0 0 !important;
}

.rpm-thumbnail-wrapper::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 40px !important;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3) 0%, transparent 100%) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    z-index: 1 !important;
}

.rpm-post-item:hover .rpm-thumbnail-wrapper::after {
    opacity: 1 !important;
}

/* 썸네일 이미지 */
.rpm-thumbnail {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    transition: all 0.4s ease !important;
    filter: saturate(1.2) contrast(1.1) !important;
}

.rpm-post-item:hover .rpm-thumbnail {
    transform: scale(1.1) rotate(2deg) !important;
    filter: saturate(1.4) contrast(1.2) brightness(1.05) !important;
}

/* 급상승 배지 - 창의적 디자인 */
.rpm-trending-badge {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%) !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 8px 12px !important;
    border-radius: 50px !important;
    line-height: 1.0 !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 15px rgba(238, 90, 82, 0.4) !important;
    z-index: 2 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    animation: rpm-trending-pulse 2s infinite !important;
}

@keyframes rpm-trending-pulse {
    0%, 100% { transform: scale(1) !important; }
    50% { transform: scale(1.1) !important; }
}

.rpm-trending-badge::before {
    content: '⚡' !important;
    margin-right: 4px !important;
    font-size: 12px !important;
}

/* 콘텐츠 영역 */
.rpm-content {
    padding: 20px !important;
    background: #ffffff !important;
    position: relative !important;
    margin-top: 0 !important;
    border-radius: 0 0 20px 20px !important;
}

/* 글 제목 - 창의적 타이포그래피 */
.rpm-post-title {
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    color: #2c3e50 !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    word-break: keep-all !important;
    word-wrap: break-word !important;
    transition: all 0.3s ease !important;
    min-height: 44px !important;
    letter-spacing: -0.3px !important;
    position: relative !important;
}

.rpm-post-link:hover .rpm-post-title {
    color: #667eea !important;
    transform: translateX(5px) !important;
}

/* 각 제목에 다른 색상 포인트 */
.rpm-post-item:nth-child(4n+1) .rpm-post-title::before {
    content: '' !important;
    position: absolute !important;
    left: -10px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 3px !important;
    background: #ff6b6b !important;
    border-radius: 2px !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.rpm-post-item:nth-child(4n+2) .rpm-post-title::before {
    content: '' !important;
    position: absolute !important;
    left: -10px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 3px !important;
    background: #4ecdc4 !important;
    border-radius: 2px !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.rpm-post-item:nth-child(4n+3) .rpm-post-title::before {
    content: '' !important;
    position: absolute !important;
    left: -10px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 3px !important;
    background: #45b7d1 !important;
    border-radius: 2px !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.rpm-post-item:nth-child(4n+4) .rpm-post-title::before {
    content: '' !important;
    position: absolute !important;
    left: -10px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 3px !important;
    background: #96ceb4 !important;
    border-radius: 2px !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.rpm-post-link:hover .rpm-post-title::before {
    opacity: 1 !important;
}

/* 위치별 스타일 */
.rpm-position-middle,
.rpm-position-bottom {
    margin-top: 40px !important;
}

/* 데스크탑에서 더 많은 열 표시 */
@media (min-width: 1024px) {
    .rpm-posts-list {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
        gap: 24px !important;
    }
    
    .rpm-thumbnail-wrapper {
        height: 200px !important;
    }
}

/* 태블릿 반응형 */
@media (max-width: 768px) and (min-width: 481px) {
    .rpm-related-container {
        margin: 35px 0 !important;
    }
    
    .rpm-title {
        font-size: 20px !important;
        margin-bottom: 25px !important;
        padding: 14px 20px !important;
        border-radius: 20px !important;
    }
    
    .rpm-posts-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 18px !important;
    }
    
    .rpm-post-item {
        border-radius: 16px !important;
    }
    
    .rpm-thumbnail-wrapper {
        height: 140px !important;
    }
    
    .rpm-content {
        padding: 16px !important;
        margin-top: -12px !important;
        border-radius: 12px 12px 0 0 !important;
    }
    
    .rpm-post-title {
        font-size: 15px !important;
        min-height: 40px !important;
    }
}

/* 모바일 반응형 - 2열 고정 */
@media (max-width: 480px) {
    .rpm-related-container {
        margin: 30px 0 !important;
    }
    
    .rpm-related-container::before {
        top: -5px !important;
        left: -5px !important;
        right: -5px !important;
        bottom: -5px !important;
        border-radius: 15px !important;
    }
    
    .rpm-title {
        font-size: 18px !important;
        margin-bottom: 20px !important;
        padding: 12px 16px !important;
        border-radius: 18px !important;
    }
    
    .rpm-title::after {
        right: 16px !important;
        font-size: 16px !important;
    }
    
    .rpm-posts-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
    }
    
    .rpm-post-item {
        border-radius: 14px !important;
    }
    
    .rpm-post-item:hover {
        transform: translateY(-6px) rotate(1deg) scale(1.02) !important;
    }
    
    .rpm-post-item:nth-child(even):hover {
        transform: translateY(-6px) rotate(-1deg) scale(1.02) !important;
    }
    
    .rpm-thumbnail-wrapper {
        height: 140px !important;
        border-radius: 10px 10px 0 0 !important;
    }
    
    .rpm-content {
        padding: 14px !important;
        margin-top: 0 !important;
        border-radius: 0 0 14px 14px !important;
    }
    
    .rpm-post-title {
        font-size: 13px !important;
        min-height: 36px !important;
        -webkit-line-clamp: 2 !important;
    }
    
    .rpm-trending-badge {
        top: 10px !important;
        right: 10px !important;
        font-size: 9px !important;
        padding: 6px 8px !important;
        border-radius: 40px !important;
    }
    
    .rpm-trending-badge::before {
        font-size: 10px !important;
        margin-right: 2px !important;
    }
}

/* 매우 작은 모바일 화면 */
@media (max-width: 360px) {
    .rpm-posts-list {
        gap: 12px !important;
    }
    
    .rpm-thumbnail-wrapper {
        height: 100px !important;
    }
    
    .rpm-content {
        padding: 12px !important;
        margin-top: 0 !important;
    }
    
    .rpm-post-title {
        font-size: 12px !important;
        min-height: 32px !important;
    }
}

/* 로딩 스켈레톤 - 창의적 스타일 */
.rpm-skeleton {
    margin: 40px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    position: relative !important;
}

.rpm-skeleton::before {
    content: '' !important;
    position: absolute !important;
    top: -10px !important;
    left: -10px !important;
    right: -10px !important;
    bottom: -10px !important;
    background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 25%, #fecfef 50%, #f093fb 75%, #f5576c 100%) !important;
    border-radius: 20px !important;
    opacity: 0.05 !important;
    z-index: -1 !important;
}

.rpm-skeleton-title {
    width: 180px !important;
    height: 24px !important;
    background: linear-gradient(90deg, #e9ecef 25%, #ffffff 50%, #e9ecef 75%) !important;
    background-size: 200% 100% !important;
    animation: rpm-skeleton-loading 1.5s infinite !important;
    border-radius: 12px !important;
    margin: 0 auto 30px auto !important;
}

.rpm-skeleton-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 20px !important;
}

.rpm-skeleton-item {
    background: #ffffff !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.rpm-skeleton-thumb {
    width: 100% !important;
    height: 200px !important;
    background: linear-gradient(90deg, #e9ecef 25%, #ffffff 50%, #e9ecef 75%) !important;
    background-size: 200% 100% !important;
    animation: rpm-skeleton-loading 1.5s infinite !important;
    border-radius: 12px 12px 0 0 !important;
}

.rpm-skeleton-content {
    padding: 20px !important;
    margin-top: 0 !important;
    border-radius: 0 0 20px 20px !important;
    background: #ffffff !important;
}

.rpm-skeleton-text {
    height: 16px !important;
    background: linear-gradient(90deg, #e9ecef 25%, #ffffff 50%, #e9ecef 75%) !important;
    background-size: 200% 100% !important;
    animation: rpm-skeleton-loading 1.5s infinite !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
}

.rpm-skeleton-text-short {
    height: 16px !important;
    width: 60% !important;
    background: linear-gradient(90deg, #e9ecef 25%, #ffffff 50%, #e9ecef 75%) !important;
    background-size: 200% 100% !important;
    animation: rpm-skeleton-loading 1.5s infinite !important;
    border-radius: 4px !important;
    animation-delay: 0.2s !important;
}

@keyframes rpm-skeleton-loading {
    0% {
        background-position: 200% 0 !important;
    }
    100% {
        background-position: -200% 0 !important;
    }
}

/* 테마 호환성을 위한 추가적인 리셋 */
.rpm-related-container a {
    color: inherit !important;
    text-decoration: none !important;
}

.rpm-related-container a:hover,
.rpm-related-container a:focus,
.rpm-related-container a:active,
.rpm-related-container a:visited {
    color: inherit !important;
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
}

.rpm-related-container h1,
.rpm-related-container h2,
.rpm-related-container h3,
.rpm-related-container h4,
.rpm-related-container h5,
.rpm-related-container h6 {
    font-family: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

.rpm-related-container img {
    vertical-align: baseline !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

/* 썸네일 이미지만 특별히 관리 */
.rpm-related-container .rpm-thumbnail {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
}

/* 테마의 일반적인 스타일 무력화 */
.rpm-related-container,
.rpm-related-container * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* 테마의 그리드/플렉스 레이아웃 간섭 방지 */
.rpm-related-container {
    display: block !important;
    flex: none !important;
    grid-column: unset !important;
    grid-row: unset !important;
}