/**
 * 킹스머니 리뷰 시스템 CSS
 * 렌탈, 상조, 마이페이지 리뷰 기능 스타일
 * 
 * @author AI Assistant
 * @version 1.2
 * @date 2025-02-13
 */

/* ===== 기본 리뷰 시스템 스타일 ===== */

.review-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-stats {
    background-color: #f9fafb !important;
    border-radius: 8px !important;
    padding: 16px !important;
    border: 1px solid #e5e7eb !important;
    margin-bottom: 24px !important;
}

.rating-summary {
    display: flex !important;
    align-items: flex-start !important;
    gap: 24px !important;
    margin-bottom: 0 !important;
}

.avg-rating {
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
    text-align: center !important;
    margin-bottom: 8px !important;
}

.rating-breakdown {
    flex: 1 !important;
    padding-left: 16px !important;
}

.rating-breakdown > div {
    display: block !important;
}

.rating-bar {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    font-size: 12px !important;
    margin-bottom: 4px !important;
}

.rating-bar .star-number {
    width: 12px !important;
    text-align: right !important;
    font-weight: 500 !important;
    color: #374151 !important;
    flex-shrink: 0 !important;
}

.rating-bar .count-number {
    width: 32px !important;
    text-align: left !important;
    color: #6b7280 !important;
    font-weight: 500 !important;
    flex-shrink: 0 !important;
}

.rating-bar-bg {
    flex: 1 !important;
    height: 8px !important;
    background-color: #e5e7eb !important;
    border-radius: 9999px !important;
    overflow: hidden !important;
    position: relative !important;
    min-width: 80px !important;
}

.rating-bar-fill {
    height: 100% !important;
    background-color: #fbbf24 !important;
    border-radius: 9999px !important;
    transition: width 0.3s ease !important;
}

/* ===== 리뷰 필터 ===== */

.review-filters {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.review-filters::-webkit-scrollbar {
    display: none;
}

.review-filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    white-space: nowrap;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.review-filter-btn:hover {
    background-color: #f9fafb;
}

.review-filter-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6, 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.review-filter-btn.active {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

.review-filter-btn.active:hover {
    background-color: #1d4ed8;
}

/* ===== 리뷰 아이템 ===== */

.review-item {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    transition: box-shadow 0.2s ease;
}

.review-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.reviewer-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reviewer-name {
    font-weight: 500;
    color: #111827;
    font-size: 0.875rem;
}

.reviewer-date {
    font-size: 0.75rem;
    color: #6b7280;
}

.buyer-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background-color: #dcfce7;
    color: #166534;
    border-radius: 9999px;
    font-weight: 500;
}

.recommend-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background-color: #fed7aa;
    color: #9a3412;
    border-radius: 9999px;
    font-weight: 500;
}

.review-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.review-content {
    color: #374151;
    line-height: 1.625;
    margin-bottom: 0.75rem;
}

.review-content h4 {
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.review-images {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.review-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.review-image:hover {
    opacity: 0.8;
}

.review-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.review-helpful {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.review-helpful-btn {
    cursor: pointer;
    transition: color 0.2s ease;
}

.review-helpful-btn:hover {
    color: #2563eb;
}

/* ===== 별점 시스템 ===== */

.star-rating {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.25rem;
}

.star-rating input {
    display: none;
}

.star-rating label {
    font-size: 1.5rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.2s ease;
}

.star-rating label:hover {
    color: #fbbf24;
}

.star-rating label:focus {
    outline: none;
}

.star-rating input:checked ~ label,
.star-rating input:checked ~ label ~ label {
    color: #fbbf24;
}

.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #fbbf24;
}

.star-display {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.star-display .star {
    color: #fbbf24;
    font-size: 0.875rem;
}

.star-display .star.empty {
    color: #d1d5db;
}

/* ===== 리뷰 작성 폼 ===== */

.review-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    resize: none;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.char-counter {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: right;
    margin-top: 0.25rem;
}

.char-count {
    font-weight: 500;
}

/* ===== 이미지 업로드 ===== */

.image-upload-area {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.image-upload-item {
    aspect-ratio: 1;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.image-upload-item:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.image-upload-item.has-image {
    border-style: solid;
    border-color: #e5e7eb;
}

.image-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.preview-area {
    position: relative;
    width: 100%;
    height: 100%;
}

.preview-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

.remove-image-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.remove-image-btn:hover {
    background-color: #dc2626;
}

/* ===== 모달 ===== */

.image-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.image-modal.flex {
    display: flex;
}

.image-modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

/* ===== 버튼 스타일 ===== */

.load-more-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #6b7280;
    background-color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.load-more-btn:hover {
    background-color: #f9fafb;
}

.load-more-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px #2563eb, 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 영역별 차별화 스타일 ===== */

/* 렌탈 영역 (파란색 테마) */
.rental-review-section .review-stats {
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

.rental-review-section .avg-rating {
    color: #2563eb;
}

.rental-review-section .review-filter-btn.active {
    background-color: #2563eb;
    border-color: #2563eb;
}

.rental-review-section .review-filter-btn.active:hover {
    background-color: #1d4ed8;
}

.rental-review-section .image-upload-item:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.rental-review-section .form-input:focus,
.rental-review-section .form-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 상조 영역 (녹색 테마) */
.fservice-review-section .review-stats {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

.fservice-review-section .avg-rating {
    color: #059669;
}

.fservice-review-section .review-filter-btn.active {
    background-color: #059669;
    border-color: #059669;
}

.fservice-review-section .review-filter-btn.active:hover {
    background-color: #047857;
}

.fservice-review-section .image-upload-item:hover {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.fservice-review-section .form-input:focus,
.fservice-review-section .form-textarea:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* 마이페이지 영역 (회색 테마) */
.mypage-review-section .review-stats {
    background-color: #f9fafb;
    border-color: #e5e7eb;
}

.mypage-review-section .avg-rating {
    color: #374151;
}

.mypage-review-section .review-filter-btn.active {
    background-color: #4b5563;
    border-color: #4b5563;
}

.mypage-review-section .review-filter-btn.active:hover {
    background-color: #374151;
}

.mypage-review-section .image-upload-item:hover {
    border-color: #6b7280;
    background-color: #f9fafb;
}

.mypage-review-section .form-input:focus,
.mypage-review-section .form-textarea:focus {
    border-color: #4b5563;
    box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.1);
}

/* ===== 반응형 디자인 ===== */

@media (max-width: 640px) {
    .rating-summary {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .avg-rating {
        font-size: 1.5rem;
    }

    .review-filters {
        gap: 0.25rem;
    }

    .review-filter-btn {
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
    }

    .review-images {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .image-upload-area {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .star-rating label {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .review-item {
        padding: 0.75rem;
    }

    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .reviewer-info {
        flex-wrap: wrap;
    }

    .review-rating {
        align-self: flex-end;
    }

    .image-upload-area {
        grid-template-columns: 1fr;
    }
}

/* ===== 애니메이션 ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.review-item {
    animation: fadeIn 0.3s ease-out;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* ===== 접근성 ===== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.review-filter-btn:focus,
.load-more-btn:focus,
.remove-image-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px #2563eb, 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* ===== 터치 디바이스 최적화 ===== */

@media (hover: none) and (pointer: coarse) {
    .review-filter-btn:hover,
    .review-image:hover,
    .load-more-btn:hover {
        transform: none;
        opacity: 1;
    }

    .review-filter-btn:active,
    .load-more-btn:active {
        background-color: #f3f4f6;
    }

    .star-rating label:hover {
        color: #d1d5db;
    }
}

/* ===== 유틸리티 클래스 ===== */

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

/* ===== 프린트 스타일 ===== */

@media print {
    .review-filters,
    .load-more-btn,
    .review-helpful-btn {
        display: none;
    }

    .review-item {
        page-break-inside: avoid;
    }

    .review-images {
        display: none;
    }
} 