/* 상품 상세 뷰 스타일 */

.product-detail-view {
  position: fixed;
  top: 60px;
  left: 150px;
  right: 0;
  bottom: 0;
  background: var(--bg-primary, #f5f5f5);
  z-index: 100;
  overflow: hidden;
}

.product-detail-container {
  display: flex;
  height: 100%;
}

/* 사이드바 - 왼쪽에 위치 */
.product-detail-sidebar {
  width: 360px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* 사이드바 헤더 */
.product-detail-sidebar .sidebar-header-section {
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.product-detail-sidebar .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0f0f0;
  border: none;
  border-radius: 6px;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 12px;
}

.product-detail-sidebar .back-btn:hover {
  background: #e0e0e0;
}

/* 헤더 상단 행: 뒤로가기 + 수정/삭제 버튼 */
.product-detail-sidebar .header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-detail-sidebar .header-top-row .back-btn {
  margin-bottom: 0;
}

/* 소유자 전용: 수정/삭제 버튼 */
.product-header-actions {
  display: flex;
  gap: 6px;
}

.product-header-actions button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #555;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.product-header-actions button:hover {
  background: #e8e8e8;
  color: #333;
}

.product-header-actions .delete-product-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.product-detail-sidebar .product-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin: 0;
  line-height: 1.4;
}

/* 사이드바 섹션 공통 */
.product-detail-sidebar .sidebar-section {
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.product-detail-sidebar .sidebar-section:last-child {
  border-bottom: none;
}

.product-detail-sidebar .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0 0 16px 0;
}

.product-detail-sidebar .section-title svg {
  color: #666;
}

/* 판매자 정보 */
.product-seller-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.seller-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFE66D, #f39c12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.seller-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.seller-name {
  font-size: 15px;
  font-weight: 600;
  color: #333 !important;
  background: transparent;
}

.seller-occupation {
  font-size: 12px;
  color: #888;
}

.product-detail-sidebar .add-friend-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.2s;
  flex-shrink: 0;
}

.product-detail-sidebar .add-friend-btn:hover {
  background: var(--primary-color, #F56342);
  color: #fff;
}

.product-description {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin: 0;
}

/* 가격 정보 */
.price-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.price-grid.single-price {
  grid-template-columns: 1fr;
}

.price-grid.single-price .price-item {
  padding: 20px;
}

.price-grid.single-price .price-value {
  font-size: 24px;
}

.price-item {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 10px;
  text-align: center;
}

.price-item.company {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
}

.price-item.general {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
}

.price-item .price-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}

.price-item .price-value {
  font-size: 18px;
  font-weight: 700;
}

.price-item.company .price-value {
  color: #00a896;
}

.price-item.general .price-value {
  color: #e67e22;
}

/* 판매 정보 */
.sales-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sales-info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
}

.sales-info-row:last-child {
  border-bottom: none;
}

.sales-label {
  color: #888;
}

.sales-value {
  color: #333;
  font-weight: 500;
}

/* 연결된 라이브러리 */
.linked-libraries-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.linked-library-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.linked-library-card:hover {
  background: #e3f2fd;
  transform: translateX(4px);
}

.library-thumbnail {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: linear-gradient(135deg, #4ECDC4, #2b8a82);
}

.library-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.library-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.library-author {
  font-size: 12px;
  color: #888;
}

.library-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #4ECDC4;
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  width: fit-content;
}

/* 구매 버튼 */
.purchase-section {
  padding: 20px;
  background: #fafafa;
  border-top: 1px solid #eee;
  position: sticky;
  bottom: 0;
}

.purchase-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary-color, #F56342), #d94a2e);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.purchase-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 99, 66, 0.4);
}

.purchase-btn:active {
  transform: translateY(0);
}

/* 상품 콘텐츠 영역 (오른쪽) */
.product-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #fff;
}

/* 이미지 갤러리 */
.product-gallery {
  padding: 24px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.main-image-container {
  width: 100%;
  margin: 0 auto 16px;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.main-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumbnail-list {
  display: flex;
  gap: 10px;
  justify-content: center;
  overflow-x: auto;
  padding: 8px 0;
}

.thumbnail-list img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

.thumbnail-list img:hover,
.thumbnail-list img.active {
  border-color: var(--primary-color, #F56342);
  transform: scale(1.05);
}

/* 상세 설명 */
.product-detail-content {
  flex: 1;
  width: 100%;
  padding: 24px;
  background: #fff;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #eee;
  margin-bottom: 24px;
}

.detail-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.detail-tab:hover {
  color: #333;
}

.detail-tab.active {
  color: var(--primary-color, #F56342);
}

.detail-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-color, #F56342);
}

.detail-tab-content {
  min-height: 200px;
  background: #fff;
}

#product-long-description,
#product-return-description {
  font-size: 15px;
  line-height: 1.8;
  color: #444;
}

#product-long-description img,
#product-return-description img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
}

/* 카테고리/키워드 분리 표시 */
.product-category-row,
.product-keyword-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.product-label {
  font-size: 12px;
  color: #888;
  min-width: 55px;
}

.product-category-value {
  font-size: 13px;
  color: #4A90E2;
  font-weight: 500;
}

.product-keyword-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-keyword-value .product-tag {
  background: #f0f0f0;
  color: #666;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
}

/* 반응형 - 태블릿 (메인 사이드바 축소형 옆에 배치) */
@media (min-width: 769px) and (max-width: 1024px) {
  .product-detail-view {
    left: var(--sidebar-collapsed-width, 80px);
    top: 60px;
  }

  .product-detail-sidebar {
    width: 320px;
  }
}

@media (max-width: 768px) {
  .product-detail-view {
    left: 0;
    top: 60px;
  }

  .product-detail-container {
    flex-direction: column;
  }

  .product-detail-sidebar {
    width: 100%;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .product-content-area {
    flex: 1;
    min-height: 50vh;
  }

  .price-grid {
    grid-template-columns: 1fr;
  }
}
