/**
 * ========================================
 * Review Board Style - 리뷰 게시판 전용 스타일
 * ========================================
 * 작성일: 2025-01-13
 * 설명: Bootstrap 및 기존 스킨과 충돌 방지를 위한 네임스페이스 적용
 * 접두사: .rb- (review-board)
 */

/* ========================================
 * 전역 스타일 - 리뷰 보드 컨테이너 내부로 제한
 * ======================================== */
.rb-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    color: #333;
    line-height: 1.6;
    font-size: 16px !important; /* 테마의 14px 덮어쓰기 */
}

.rb-wrapper * {
    box-sizing: border-box;
}

/* ========================================
 * 컨테이너 (Bootstrap 충돌 방지)
 * ======================================== */
.rb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ========================================
 * 헤더 섹션
 * ======================================== */
.rb-header {
    text-align: center;
    margin-bottom: 50px;
}

.rb-header h1 {
    font-size: 2.5em; /* 40px (16px 기준) */
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 40px;
    margin-top: 0;
}

.rb-overall-rating {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 500px;
}

.rb-overall-rating .rb-score {
    font-size: 3.5em; /* 56px (16px 기준) */
    font-weight: bold;
    color: #2d3748;
    margin-right: 20px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rb-overall-rating .rb-stars {
    display: inline-block;
    vertical-align: middle;
}

.rb-overall-rating .rb-review-count {
    color: #718096;
    margin-top: 15px;
    font-size: 1.1em;
    font-weight: 500;
}

/* ========================================
 * 평점 분포
 * ======================================== */
.rb-rating-distribution {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.rb-rating-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.rb-rating-bar .rb-label {
    width: 40px;
    font-size: 0.9em;
    color: #4a5568;
}

.rb-rating-bar .rb-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 0 10px;
    position: relative;
    overflow: hidden;
}

.rb-rating-bar .rb-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffc107);
    border-radius: 4px;
    transition: width 0.3s;
}

.rb-rating-bar .rb-count {
    width: 50px;
    text-align: right;
    font-size: 0.85em;
    color: #718096;
}

/* ========================================
 * 별점 스타일
 * ======================================== */
.rb-stars {
    display: inline-flex;
    gap: 2px;
}

.rb-star {
    font-size: 24px;
    color: #FFD700;
    position: relative;
}

.rb-star.rb-half::after {
    content: '★';
    position: absolute;
    left: 0;
    color: #ddd;
    clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%);
}

.rb-star.rb-empty {
    color: #ddd;
}

/* ========================================
 * 필터 섹션
 * ======================================== */
.rb-filter-section {
    background: #f8fafc;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
}

.rb-filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.rb-filter-btn {
    padding: 10px 24px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
    font-weight: 500;
    color: #4a5568;
}

.rb-filter-btn:hover {
    border-color: #4299e1;
    color: #4299e1;
    background: #ebf8ff;
    text-decoration: none;
}

.rb-filter-btn.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

/* ========================================
 * 리뷰 그리드 - 카드형 레이아웃
 * ======================================== */
.rb-reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.rb-review-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.rb-review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #cbd5e0;
}

/* ========================================
 * 인증 배지
 * ======================================== */
.rb-verified-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 10;
}

/* ========================================
 * 리뷰 카드 헤더
 * ======================================== */
.rb-review-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.rb-reviewer-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    margin-right: 15px;
    flex-shrink: 0;
}

.rb-reviewer-info {
    flex: 1;
}

.rb-reviewer-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 3px;
}

.rb-review-date {
    color: #999;
    font-size: 0.9em;
}

/* ========================================
 * 리뷰 평점
 * ======================================== */
.rb-review-rating {
    margin-bottom: 15px;
}

.rb-review-rating .rb-stars {
    margin-right: 10px;
}

.rb-rating-text {
    display: inline-block;
    color: #666;
    font-weight: 500;
    font-size: 1em; /* 16px 명시적 설정 */
}

/* ========================================
 * 서비스 태그
 * ======================================== */
.rb-service-tag {
    display: inline-block;
    background: #f7fafc;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    color: #4a5568;
    margin-bottom: 15px;
    margin-right: 8px;
    border: 1px solid #e2e8f0;
}

/* ========================================
 * 리뷰 내용
 * ======================================== */
.rb-review-content {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    word-break: keep-all;
    overflow-wrap: break-word;
    font-size: 1em; /* 16px 명시적 설정 */
}

/* ========================================
 * 리뷰 이미지
 * ======================================== */
.rb-review-images {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.rb-review-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: #f7fafc;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s;
    border: 1px solid #e2e8f0;
}

.rb-review-image:hover {
    transform: scale(1.1);
}

/* ========================================
 * 도움이 되셨나요 섹션
 * ======================================== */
.rb-helpful-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

.rb-helpful-text {
    color: #999;
    font-size: 0.9em;
}

.rb-helpful-buttons {
    display: flex;
    gap: 10px;
}

.rb-helpful-btn {
    background: none;
    border: 1px solid #e2e8f0;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    color: #718096;
}

.rb-helpful-btn:hover {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
    text-decoration: none;
}

.rb-helpful-btn.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

/* ========================================
 * 더보기 버튼
 * ======================================== */
.rb-load-more {
    text-align: center;
    margin-top: 50px;
    padding-bottom: 50px;
}

.rb-load-more-btn {
    background: #4299e1;
    color: white;
    padding: 15px 50px;
    border: 2px solid #4299e1;
    border-radius: 30px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.rb-load-more-btn:hover {
    background: #3182ce;
    border-color: #3182ce;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
    text-decoration: none;
    color: white;
}

/* ========================================
 * 반응형 미디어쿼리
 * ======================================== */
@media (max-width: 768px) {
    .rb-reviews-grid {
        grid-template-columns: 1fr;
    }

    .rb-header h1 {
        font-size: 2em;
    }

    .rb-overall-rating {
        padding: 20px;
        max-width: 100%;
    }

    .rb-overall-rating .rb-score {
        font-size: 2.5em;
    }

    .rb-filter-buttons {
        justify-content: flex-start;
    }

    .rb-helpful-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .rb-helpful-buttons {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .rb-container {
        padding: 0 10px;
    }

    .rb-header h1 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .rb-overall-rating .rb-score {
        font-size: 2em;
        margin-right: 10px;
    }

    .rb-review-card {
        padding: 20px;
    }

    .rb-reviewer-avatar {
        width: 40px;
        height: 40px;
        font-size: 1em;
        margin-right: 10px;
    }

    .rb-reviewer-name {
        font-size: 1em;
    }

    .rb-filter-btn {
        padding: 8px 16px;
        font-size: 0.85em;
    }
}

/* ========================================
 * 인쇄 스타일
 * ======================================== */
@media print {
    .rb-filter-section,
    .rb-helpful-section,
    .rb-load-more {
        display: none;
    }

    .rb-review-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
 * 접근성 개선
 * ======================================== */
.rb-filter-btn:focus,
.rb-helpful-btn:focus,
.rb-load-more-btn:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

.rb-review-image:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

/* 스크린 리더 전용 텍스트 */
.rb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
 * 애니메이션
 * ======================================== */
@keyframes rb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rb-review-card {
    animation: rb-fadeIn 0.5s ease-out;
}

.rb-review-card:nth-child(1) { animation-delay: 0.05s; }
.rb-review-card:nth-child(2) { animation-delay: 0.1s; }
.rb-review-card:nth-child(3) { animation-delay: 0.15s; }
.rb-review-card:nth-child(4) { animation-delay: 0.2s; }
.rb-review-card:nth-child(5) { animation-delay: 0.25s; }
.rb-review-card:nth-child(6) { animation-delay: 0.3s; }

/* ========================================
 * 유틸리티 클래스
 * ======================================== */
.rb-text-center {
    text-align: center;
}

.rb-text-left {
    text-align: left;
}

.rb-text-right {
    text-align: right;
}

.rb-mt-10 { margin-top: 10px; }
.rb-mt-20 { margin-top: 20px; }
.rb-mt-30 { margin-top: 30px; }

.rb-mb-10 { margin-bottom: 10px; }
.rb-mb-20 { margin-bottom: 20px; }
.rb-mb-30 { margin-bottom: 30px; }

.rb-p-10 { padding: 10px; }
.rb-p-20 { padding: 20px; }
.rb-p-30 { padding: 30px; }

/* ========================================
 * 이미지 확대 모달
 * ======================================== */
.rb-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rb-image-modal.rb-modal-show {
    opacity: 1;
}

.rb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.rb-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 10000;
    animation: rb-modalZoom 0.3s ease;
}

.rb-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.rb-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.rb-modal-close:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
}

@keyframes rb-modalZoom {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
 * 스크롤 애니메이션
 * ======================================== */
.rb-review-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.rb-review-card.rb-animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
 * 로딩 상태
 * ======================================== */
.rb-loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait !important;
}

/* ========================================
 * 상단 스크롤 버튼
 * ======================================== */
.rb-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    transition: all 0.3s ease;
}

.rb-scroll-top:hover {
    background: #3182ce;
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.6);
}

@media (max-width: 768px) {
    .rb-scroll-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }
}

/* ========================================
 * 버튼 클릭 효과
 * ======================================== */
.rb-filter-btn:active,
.rb-helpful-btn:active {
    transform: scale(0.95);
}

/* ========================================
 * 로딩 스피너 (선택사항)
 * ======================================== */
.rb-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: rb-spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes rb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
