/**
 * Related Posts Popup - Styles
 * 洗練されたポップアップデザイン
 */

/* オーバーレイ */
.rpp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999998;
}

.rpp-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ポップアップ本体 */
.rpp-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 420px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999999;
    overflow: hidden;
}

.rpp-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ヘッダー */
.rpp-popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.rpp-popup-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    flex-shrink: 0;
}

.rpp-popup-icon svg {
    width: 20px;
    height: 20px;
}

.rpp-popup-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

/* 閉じるボタン */
.rpp-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.rpp-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.rpp-close svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
}

/* 記事リスト */
.rpp-posts {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
}

/* 記事アイテム */
.rpp-post-item {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.rpp-post-item:hover {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(4px);
}

/* サムネイル */
.rpp-post-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: #e2e8f0;
}

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

.rpp-post-item:hover .rpp-post-thumbnail img {
    transform: scale(1.08);
}

/* 記事コンテンツ */
.rpp-post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

/* カテゴリー */
.rpp-post-category {
    display: inline-block;
    padding: 3px 8px;
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
    width: fit-content;
}

/* タイトル */
.rpp-post-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.rpp-post-item:hover .rpp-post-title {
    color: #667eea;
}

/* ローディング */
.rpp-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.rpp-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: rpp-spin 0.8s linear infinite;
}

@keyframes rpp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* スクロールバー */
.rpp-posts::-webkit-scrollbar {
    width: 6px;
}

.rpp-posts::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.rpp-posts::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.rpp-posts::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .rpp-popup {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .rpp-popup.active {
        transform: translateY(0);
    }

    .rpp-popup-header {
        padding: 18px 20px;
    }

    .rpp-popup-title {
        font-size: 15px;
    }

    .rpp-posts {
        padding: 14px;
        max-height: 60vh;
    }

    .rpp-post-item {
        padding: 10px;
        gap: 12px;
    }

    .rpp-post-thumbnail {
        width: 70px;
        height: 70px;
    }

    .rpp-post-title {
        font-size: 13px;
    }
}

/* アニメーション */
@keyframes rpp-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rpp-posts .rpp-post-item {
    animation: rpp-fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.rpp-posts .rpp-post-item:nth-child(1) {
    animation-delay: 0.1s;
}

.rpp-posts .rpp-post-item:nth-child(2) {
    animation-delay: 0.15s;
}

.rpp-posts .rpp-post-item:nth-child(3) {
    animation-delay: 0.2s;
}

.rpp-posts .rpp-post-item:nth-child(4) {
    animation-delay: 0.25s;
}

.rpp-posts .rpp-post-item:nth-child(5) {
    animation-delay: 0.3s;
}

.rpp-posts .rpp-post-item:nth-child(6) {
    animation-delay: 0.35s;
}

/* ダークモード対応（必要に応じて） */
@media (prefers-color-scheme: dark) {
    .rpp-popup {
        background: #1e293b;
    }

    .rpp-post-item {
        background: #334155;
    }

    .rpp-post-item:hover {
        background: #475569;
        border-color: #475569;
    }

    .rpp-post-title {
        color: #f1f5f9;
    }

    .rpp-post-item:hover .rpp-post-title {
        color: #a5b4fc;
    }

    .rpp-post-thumbnail {
        background: #475569;
    }
}
