/* group_compare.css - 알고 싶은 사람 모달 전용 CSS */

.modal-xl {
    max-width: 1200px;
}

.member-search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    background: white;
}

.search-result-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.added-members-list {
    min-height: 80px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    background: white;
}

.added-member-item {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    margin: 4px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    font-size: 1em;
    min-width: 180px;
    max-width: 220px;
}

.member-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.member-checkbox {
    margin-right: 8px;
    margin-top: 0;
}

.member-details {
    flex: 1;
    min-width: 0;
}

.member-nick {
    font-weight: bold;
    color: #333;
    font-size: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-id {
    font-size: 0.9em;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-actions {
    margin-left: 8px;
}

/* 섹션 타이틀 스타일 */
.section-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #4a90e2;
    padding-bottom: 8px;
}

.btn-remove-member {
    padding: 2px 6px;
    font-size: 0.7em;
    border-radius: 12px;
    line-height: 1;
}

.compare-content {
    max-height: 600px;
    overflow-y: auto;
}

/* gsort.php와 완전히 동일한 평가그룹 탭 스타일 */
#groupCompareModal .review-groups-tabs {
    margin-bottom: 20px;
}

#groupCompareModal .review-tabs {
    margin-bottom: 15px;
    border-bottom: 2px solid #4a90e2;
}

#groupCompareModal .review-tabs .nav-link {
    color: #666;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 10px 15px;
    margin-right: 5px;
    font-weight: 500;
    background-color: #f8f9fa;
}

#groupCompareModal .review-tabs .nav-link.active {
    background-color: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

#groupCompareModal .review-tab-content {
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

/* gsort.php와 완전히 동일한 평가항목 레이아웃 */
#groupCompareModal .review-item {
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    background-color: #fff;
}

#groupCompareModal .review-item.has-item-image {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

#groupCompareModal .item-image-side {
    width: 70px;
    margin-right: 6px;
    flex-shrink: 0;
}

#groupCompareModal .item-content-side {
    flex-grow: 1;
}

#groupCompareModal .item-detail-image {
    width: 100%;
    height: auto;
    max-height: 70px;
    border-radius: 4px;
    object-fit: cover;
}

#groupCompareModal .review-item-title {
    display: inline-block;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

/* 비교 회원별 평가 표시 */
#groupCompareModal .member-rating-comparison {
    margin-top: 10px;
}

#groupCompareModal .member-rating-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: white;
    border: 2px solid #e9ecef;
}

#groupCompareModal .member-rating-row.current-user {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-color: #28a745;
}

#groupCompareModal .member-rating-row.compare-user {
    background: linear-gradient(135deg, #fff3cd 0%, #fef8e7 100%);
    border-color: #ffc107;
}

#groupCompareModal .user-name {
    min-width: 120px;
    font-weight: bold;
    margin-right: 20px;
    font-size: 1em;
}

#groupCompareModal .user-name.current {
    color: #28a745;
}

#groupCompareModal .user-name.compare {
    color: #856404;
}

#groupCompareModal .rating-display {
    flex-grow: 1;
}

/* gsort.css와 완전히 동일한 별점 바 스타일 */
#groupCompareModal .rating-bar-container {
    position: relative;
    height: 36px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

/* 단방향/양방향 배경 스타일 차별화 */
#groupCompareModal .star-rating.unidirectional .rating-bar-container {
    background: linear-gradient(to right, #f0f0f0, #e0f0ff);
}

#groupCompareModal .rating-range {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#groupCompareModal .drag-handle {
    position: absolute;
    top: 0;
    width: 14px;
    height: 100%;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
}

#groupCompareModal .drag-handle.left {
    background: #ff4444;
    border-radius: 4px;
}

#groupCompareModal .drag-handle.right {
    background: #4a90e2;
    border-radius: 4px;
}

#groupCompareModal .range-bar {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(74, 144, 226, 0.2);
    pointer-events: none;
}

#groupCompareModal .rating-grid {
    display: flex;
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 단방향/양방향 그리드 스타일 차별화 */
#groupCompareModal .rating-grid.bidirectional {
    justify-content: space-between;
}

#groupCompareModal .rating-grid.unidirectional {
    justify-content: space-between;
}

#groupCompareModal .rating-grid-line {
    position: relative;
    flex: 1;
    pointer-events: none;
}

#groupCompareModal .rating-grid-line:after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.5);
    z-index: 2;
}

#groupCompareModal .rating-grid-line:before {
    content: '';
    position: absolute;
    right: -1px;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(0,0,0,0.08);
    z-index: 2;
}

/* 단방향 슬라이더의 왼쪽 핸들 위치 조정 */
#groupCompareModal .star-rating.unidirectional .drag-handle.left {
    min-left: 0%;
}

#groupCompareModal .rating-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 6px;
    z-index: 2;
    transition: all 0.3s ease;
}

#groupCompareModal .rating-bar.rating-positive {
    background: linear-gradient(90deg, #4a90e2 0%, #73b6ff 100%);
    box-shadow: 0 2px 4px rgba(74,144,226,0.3);
}

#groupCompareModal .rating-bar.rating-negative {
    background: linear-gradient(270deg, #ff4444 0%, #ff8c8c 100%);
    box-shadow: 0 2px 4px rgba(255,68,68,0.3);
}

#groupCompareModal .rating-bar:not(.rating-positive):not(.rating-negative) {
    background: linear-gradient(90deg, #4a90e2 0%, #73b6ff 100%);
    box-shadow: 0 2px 4px rgba(74,144,226,0.3);
}

#groupCompareModal .rating-text-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    background: rgba(255,255,255,0.9);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

/* 값 표시 스타일 */
#groupCompareModal .value-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
    font-size: 0.95em;
    color: #495057;
    line-height: 1.4;
}

/* 탭 반응형 처리 - gsort.php와 동일 */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
        margin: 10px auto;
    }
    
    #groupCompareModal .review-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    #groupCompareModal .review-tabs .nav-item {
        flex: 0 0 auto;
    }
    
    #groupCompareModal .review-tab-content {
        padding: 8px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    
    #groupCompareModal .member-rating-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    #groupCompareModal .user-name {
        min-width: auto;
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    #groupCompareModal .rating-display {
        width: 100%;
    }
    
    #groupCompareModal .item-image-side {
        width: 50px;
    }
    
    #groupCompareModal .item-detail-image {
        max-height: 50px;
    }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 사진 아래 항목명 스타일 */
#groupCompareModal .review-item-title-under-image {
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-top: 5px;
    padding: 5px;
    background: rgba(255,255,255,0.9);
    border-radius: 4px;
    line-height: 1.2;
}

/* 모바일 검색 컨테이너 */
.mobile-search-container {
    gap: 5px;
    align-items: center;
}

.mobile-select {
    flex: 0 0 70px;
    font-size: 0.8em;
    padding: 0.25rem 0.4rem;
}

.mobile-input {
    flex: 1;
    font-size: 0.8em;
    padding: 0.25rem 0.5rem;
}

.mobile-btn {
    flex: 0 0 auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.8em;
    white-space: nowrap;
}

/* 모바일 검색 영역 개선 */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
        margin: 10px auto;
    }
    
    /* 모바일 검색 폼 한 줄 배치 */
    .member-search-section .row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    
    .member-search-section .col-md-2 {
        flex: 0 0 auto;
        width: auto;
        min-width: 70px;
    }
    
    .member-search-section .col-md-6 {
        flex: 1 1 auto;
        min-width: 150px;
    }
    
    .member-search-section .col-md-4 {
        flex: 0 0 auto;
        width: auto;
    }
    
    /* 검색 타입 셀렉트 박스 작게 */
    .member-search-section select {
        font-size: 0.85em;
        padding: 0.375rem 0.5rem;
    }
    
    /* 검색 버튼 텍스트 숨기고 아이콘만 */
    .member-search-section #memberSearchBtn {
        padding: 0.375rem 0.6rem;
    }
    
    .member-search-section #memberSearchBtn .fa {
        margin-right: 0;
    }
    
    /* 추가 버튼 작게 */
    .member-search-section #addSelectedMember {
        padding: 0.375rem 0.6rem;
        font-size: 0.85em;
    }
    
    /* 회원 목록 2개씩 배치 */
    .added-members-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }
    
    .added-member-item {
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
        min-width: calc(50% - 4px);
        margin: 0;
        font-size: 0.9em;
        padding: 8px 10px;
        border-radius: 6px;
    }
    
    .added-member-item .member-nick {
        font-size: 0.95em;
    }
    
    .added-member-item .member-id {
        font-size: 0.85em;
    }
    
    .added-member-item .btn-remove-member {
        padding: 1px 4px;
        font-size: 0.65em;
    }
    
    /* 탭 관련 기존 스타일 유지 */
    #groupCompareModal .review-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    #groupCompareModal .review-tabs .nav-item {
        flex: 0 0 auto;
    }
    
    #groupCompareModal .review-tab-content {
        padding: 8px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    
    #groupCompareModal .member-rating-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    #groupCompareModal .user-name {
        min-width: auto;
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    #groupCompareModal .rating-display {
        width: 100%;
    }
    
    #groupCompareModal .item-image-side {
        width: 50px;
    }
    
    #groupCompareModal .item-detail-image {
        max-height: 50px;
    }
}

/* 매우 작은 화면 (360px 이하)에서 추가 최적화 */
@media (max-width: 360px) {
    .member-search-section .col-md-2 {
        min-width: 60px;
    }
    
    .member-search-section .col-md-6 {
        min-width: 120px;
    }
    
    .member-search-section select {
        font-size: 0.8em;
        padding: 0.25rem 0.4rem;
    }
    
    .member-search-section #memberSearchBtn,
    .member-search-section #addSelectedMember {
        padding: 0.25rem 0.5rem;
        font-size: 0.8em;
    }
    
    .added-member-item {
        font-size: 0.75em;
        padding: 4px 6px;
    }
}

/* 닫기 버튼 */
.btn-close {
    background: #ff4757 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 30px !important;
    height: 30px !important;
    border: none !important;
}

.btn-close:hover {
    background: #ff3742 !important;
}

/* 새로운 레이아웃 스타일 */

/* 이미지가 있을 때 상단 헤더 */
#groupCompareModal .item-header-with-image {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 12px;
}

#groupCompareModal .item-image-top {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

/* 전체 너비 평가 표시 */
#groupCompareModal .rating-display-wide {
    width: 100%;
}

/* 사용자명을 그래프 좌측에 표시 */
#groupCompareModal .rating-user-name {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    background: rgba(255,255,255,0.9);
    padding: 2px 6px;
    border-radius: 4px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 기존 user-name 클래스 숨김 */
#groupCompareModal .user-name {
    display: none;
}

/* 모바일 검색 컨테이너 */
.mobile-search-container {
    gap: 5px;
    align-items: center;
}

.mobile-select {
    flex: 0 0 70px;
    font-size: 0.8em;
    padding: 0.25rem 0.4rem;
}

.mobile-input {
    flex: 1;
    font-size: 0.8em;
    padding: 0.25rem 0.5rem;
}

.mobile-btn {
    flex: 0 0 auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.8em;
    white-space: nowrap;
}

/* 닫기 버튼 */
.btn-close {
    background: #ff4757 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 30px !important;
    height: 30px !important;
    border: none !important;
}

.btn-close:hover {
    background: #ff3742 !important;
}

/* 모바일 반응형 처리 */
@media (max-width: 768px) {
    #groupCompareModal .item-header-with-image {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    #groupCompareModal .item-image-top {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
    }
    
    #groupCompareModal .rating-user-name {
        font-size: 0.75em;
        max-width: 100px;
        left: 4px;
    }
    
    /* 회원 목록 2개씩 배치 */
    .added-members-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }
    
    .added-member-item {
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
        min-width: calc(50% - 4px);
        margin: 0;
        font-size: 0.9em;
        padding: 8px 10px;
        border-radius: 6px;
    }
}

/* 평점 바는 구분선 위로 */
#groupCompareModal .rating-bar {
    z-index: 1;
}

/* 점수 텍스트는 가장 위로 */
#groupCompareModal .rating-text-box {
    z-index: 3;
}

/* 사용자명도 위로 */
#groupCompareModal .rating-user-name {
    z-index: 4;
}