/* Profile Popup — Simple 스타일 기본, Retro 오버라이드 */

/* ── 오버레이 ── */
.profile-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ── 팝업 박스 (심플 기본) ── */
.profile-popup-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    font-family: 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #1e293b;
}

/* ── 닫기 버튼 ── */
.profile-popup-close {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    z-index: 1;
    transition: color 0.15s;
}

.profile-popup-close:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* ── 헤더 ── */
.pp-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.2rem 1.2rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

.pp-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.pp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pp-header-info {
    flex: 1;
    min-width: 0;
}

.pp-display-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pp-bio {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pp-joined {
    font-size: 0.73rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

/* ── 섹션 ── */
.pp-section {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid #f1f5f9;
}

.pp-section:last-child {
    border-bottom: none;
}

.pp-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.pp-section-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0;
}

/* ── 랭킹 배지 ── */
.pp-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
}

/* TOP 1 — 황금 글로우, 애니메이션 */
.pp-rank-badge.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffb300, #ffd700);
    background-size: 200% 200%;
    color: #5a3e00;
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    box-shadow: 0 0 8px rgba(255, 185, 0, 0.7), 0 0 2px rgba(255, 185, 0, 0.4);
    animation: pp-shimmer 2s ease-in-out infinite;
    letter-spacing: 0.02em;
}

@keyframes pp-shimmer {
    0%, 100% { background-position: 0% 50%; box-shadow: 0 0 8px rgba(255, 185, 0, 0.7); }
    50%       { background-position: 100% 50%; box-shadow: 0 0 14px rgba(255, 185, 0, 1); }
}

/* TOP 2-3 — 은/동 메달 */
.pp-rank-badge.rank-top3 {
    background: linear-gradient(135deg, #e8e8e8, #c8c8c8);
    color: #374151;
    font-weight: 700;
    font-size: 0.82rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* TOP 4-10 — 앰버 별 */
.pp-rank-badge.rank-top10 {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* TOP 11-50 — 블루 */
.pp-rank-badge.rank-top50 {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

/* TOP 51-100 — 라이트 그린 */
.pp-rank-badge.rank-top100 {
    background: #dcfce7;
    color: #166534;
    font-weight: 500;
}

/* TOP 101+ — 평범한 회색 */
.pp-rank-badge.rank-normal {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 400;
}

/* ── 통계 그리드 ── */
.pp-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.pp-stat-item {
    text-align: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.3rem;
}

.pp-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}

.pp-stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

/* ── 최근 책 그리드 ── */
.pp-books-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.pp-book-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 2/3;
    background: #dbeafe;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #3b82f6;
    cursor: pointer;
    text-decoration: none;
}

.pp-book-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pp-book-title {
    font-size: 0.67rem;
    color: #64748b;
    text-align: center;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pp-book-genre {
    font-size: 0.62rem;
    color: #2b6dab;
    background: #eff6ff;
    text-align: center;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── 더보기 버튼 ── */
.pp-more-btn {
    display: block;
    width: 100%;
    margin-top: 0.7rem;
    padding: 0.45rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #2b6dab;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}

.pp-more-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* ── 업적 배지 ── */
.pp-achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.pp-achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    font-size: 0.78rem;
    color: #475569;
    cursor: default;
    position: relative;
}

.pp-achievement-badge:hover .pp-achievement-tip {
    display: block;
}

.pp-achievement-tip {
    display: none;
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
    border-radius: 5px;
    white-space: nowrap;
    z-index: 10;
}

/* ── 로딩 ── */
.pp-loading {
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* ══════════════════════════════════════════
   Retro 테마 오버라이드
   ══════════════════════════════════════════ */
[data-theme="retro"] .profile-popup-box {
    background: #fff8e8;
    border: 3px solid #2c2c54;
    border-radius: 0;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
    font-family: 'DungGeunMo', monospace;
}

[data-theme="retro"] .profile-popup-close {
    border-radius: 0;
    color: #2c2c54;
}

[data-theme="retro"] .profile-popup-close:hover {
    background: #e84040;
    color: #fff;
}

[data-theme="retro"] .pp-header {
    border-bottom: 2px solid #2c2c54;
}

[data-theme="retro"] .pp-avatar {
    border: 2px solid #2c2c54;
    border-radius: 0;
    background: #4488cc;
}

[data-theme="retro"] .pp-display-name { color: #2c2c54; }

[data-theme="retro"] .pp-section {
    border-bottom: 1px dashed #ccc;
}

[data-theme="retro"] .pp-rank-badge {
    border: 2px solid #2c2c54;
    border-radius: 0;
    background: #fff8e8;
    color: #2c2c54;
}

[data-theme="retro"] .pp-rank-badge.gold   { background: #ffd700; border-color: #b8860b; color: #5a4000; }
[data-theme="retro"] .pp-rank-badge.silver { background: #c0c0c0; border-color: #808080; color: #2c2c2c; }
[data-theme="retro"] .pp-rank-badge.bronze { background: #cd7f32; border-color: #8b4513; color: #fff; }

[data-theme="retro"] .pp-stat-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0;
}

[data-theme="retro"] .pp-book-thumb {
    border: 2px solid #2c2c54;
    border-radius: 0;
    background: #4488cc;
    color: #fff;
}

[data-theme="retro"] .pp-more-btn {
    border: 2px solid #2c2c54;
    border-radius: 0;
    background: #fff8e8;
    color: #2c2c54;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

[data-theme="retro"] .pp-more-btn:hover {
    background: #2c2c54;
    color: #fff8e8;
}

[data-theme="retro"] .pp-achievement-badge {
    border: 1px solid #ccc;
    border-radius: 0;
    background: #fff;
}

[data-theme="retro"] .pp-achievement-tip {
    background: #2c2c54;
    border-radius: 0;
}
