/**
 * 학습교안 상세 페이지 - 리뷰 섹션 스타일
 */

/* 리뷰 섹션 */
#reviews {
    scroll-margin-top: 100px;
}

/* 이미지 업로드 영역 - 카드 그리드 */
.review-image-previews {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.review-image-previews.drag-over {
    background-color: #f5f3ff;
    border: 2px dashed #6440fb;
    border-radius: 8px;
    padding: 10px;
}

@media (max-width: 768px) {
    .review-image-previews {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .review-image-previews {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 이미지 카드 공통 */
.review-image-card {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 비율 */
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

/* + 추가 카드 */
.review-image-card.add-card {
    border: 2px dashed #d1d5db;
    background-color: #f9fafb;
    transition: all 0.3s ease;
}

.review-image-card.add-card:hover {
    border-color: #6440fb;
    background-color: #f5f3ff;
}

.review-image-card.add-card .add-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: #9ca3af;
    pointer-events: none;
}

.review-image-card.add-card:hover .add-icon {
    color: #6440fb;
}

/* 이미지 프리뷰 카드 */
.review-image-card.preview-card {
    background-color: #f3f4f6;
}

.review-image-card.preview-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-image-card.preview-card .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: background-color 0.2s;
    z-index: 10;
}

.review-image-card.preview-card .remove-image:hover {
    background-color: rgba(220, 38, 38, 0.9);
}

.review-image-card.preview-card .upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 5;
}

.review-image-card.preview-card .upload-progress-bar {
    height: 100%;
    background-color: #6440fb;
    transition: width 0.3s;
}

/* 리뷰 이미지 갤러리 */
.review-images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.review-images-gallery img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    cursor: pointer;
    transition: transform 0.2s;
}

.review-images-gallery img:hover {
    transform: scale(1.05);
}

/* 리뷰 목록 */
.comments__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comments__item {
    border-bottom: 1px solid #e5e7eb;
    padding: 30px 0;
}

.comments__item:last-child {
    border-bottom: none;
}

.comments__item-inner {
    display: flex;
    gap: 20px;
}

.comments__img {
    flex-shrink: 0;
}

.comments__img .bg-image,
.comments__img .rounded-full {
    width: 60px;
    height: 60px;
    background-size: cover;
    background-position: center;
}

.comments__body {
    flex: 1;
}

.comments__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.comments__helpful {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* 리뷰 작성 폼 */
.review-rating-stars {
    display: flex;
    gap: 10px;
}

.review-rating-stars .icon-star {
    cursor: pointer;
    transition: all 0.2s ease;
}

.review-rating-stars .icon-star:hover {
    transform: scale(1.2);
}

.review-rating-stars .icon-star.text-yellow-1 {
    color: #ffc107;
}

.review-rating-stars .icon-star.text-light-1 {
    color: #d1d5db;
}

#review-form input[type="text"],
#review-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

#review-form input[type="text"]:focus,
#review-form textarea:focus {
    outline: none;
    border-color: #6c5ce7;
}

#review-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* 버튼 스타일 */
.btn-review-helpful {
    padding: 0;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-review-helpful.-purple-1 {
    background-color: #6c5ce7;
    color: white;
    border-color: #6c5ce7;
}

.btn-review-helpful.-light-7 {
    background-color: #f3f4f6;
    color: #6c5ce7;
    border-color: #e5e7eb;
}

.btn-review-helpful:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 페이지네이션 */
.review-pagination {
    margin-top: 30px;
}

.review-pagination .pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.review-pagination .page-item {
    display: inline-block;
}

.review-pagination .page-link {
    display: block;
    padding: 8px 16px;
    background-color: #f3f4f6;
    color: #374151;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.review-pagination .page-link:hover {
    background-color: #6440fb;
    color: white !important;
}

.review-pagination .page-item.active .page-link {
    background-color: #6440fb;
    color: white !important;
}

/* 알림 메시지 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

.btn-close::before {
    content: '×';
    font-size: 24px;
    line-height: 1;
}

/* 로딩 스피너 */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

.spinner-border.text-purple-1 {
    color: #6c5ce7;
}

.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;
}

/* 반응형 */
@media (max-width: 768px) {
    .comments__item-inner {
        flex-direction: column;
    }
    
    .comments__header {
        flex-direction: column;
        gap: 10px;
    }
    
    .review-pagination .page-link {
        padding: 6px 12px;
        font-size: 14px;
    }
}

/* 구매 확인 배지 */
.badge.bg-success {
    background-color: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
