/* 기본 스타일 */
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: #f5f5f5;
  font-family: 'Arial', sans-serif;
  color: #333;
}

/* 앱 컨테이너 */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 헤더 */
.header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header h1 {
  margin: 0;
  font-size: 1.8rem;
}

/* 메인 콘텐츠 */
.main-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 1rem;
  height: calc(100vh - 120px); /* 헤더와 푸터를 제외한 전체 높이 */
}

@media (min-width: 768px) {
  .main-content {
    flex-direction: row;
  }
  
  /* 제품 쇼케이스와 선택 영역의 비율 조정 */
  .product-showcase {
    flex: 4; /* 더 많은 공간 할당 */
  }
  
  .product-selection {
    flex: 1;
  }
}

@media (min-width: 1200px) {
  .product-showcase {
    height: 800px;
  }
  
  .main-content {
    padding: 1.5rem;
  }
}

/* 제품 쇼케이스 */
.product-showcase {
  flex: 3;
  height: 80vh; /* 뷰포트 높이의 80%로 설정 */
  min-height: 400px; /* 최소 높이 보장 */
  background-color: #eee;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .product-showcase {
    margin-right: 1rem;
    margin-bottom: 0;
    height: 700px;
  }
}

/* 제품 선택 영역 */
.product-selection {
  flex: 1;
  background-color: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  max-height: 800px; /* 최대 높이 설정 */
}

.product-selection h2 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
  color: #2c3e50;
}

/* 제품 목록 */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: 600px; /* 400px에서 600px로 증가 */
}

/* 제품 아이템 */
.product-item {
  display: flex;
  background-color: #f9f9f9;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #eee;
  min-height: 150px; /* 100px에서 150px로 증가 */
}

.product-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-item.selected {
  border: 2px solid #3498db;
  background-color: #ecf0f1;
}

.product-thumb {
  width: 150px; /* 100px에서 150px로 증가 */
  height: 150px; /* 100px에서 150px로 증가 */
  background-color: #ddd;
  flex-shrink: 0; /* 크기 고정 */
}

.thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-image {
  width: 100%;
  height: 100%;
  background-color: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-info {
  padding: 0.75rem; /* 패딩 증가 */
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center; /* 수직 중앙 정렬 */
}

.product-info h3 {
  margin: 0 0 0.5rem 0; /* 마진 증가 */
  font-size: 1rem;
}

.product-info p {
  margin: 0;
  font-size: 0.85rem; /* 폰트 크기 증가 */
  color: #666;
  line-height: 1.3; /* 줄 간격 추가 */
}

/* 푸터 */
.footer {
  background-color: #2c3e50;
  color: white;
  padding: 1rem;
  text-align: center;
  margin-top: auto;
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
}

/* 로딩 인디케이터 */
.loading-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(240, 240, 240, 0.8);
  z-index: 10;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loading-text {
  font-size: 1rem;
  color: #333;
  margin-top: 10px;
  font-weight: bold;
}

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

/* 사용 안내 */
.controls-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
}

.controls-info span {
  margin: 2px 0;
}

/* 드래그 가능한 캔버스 */
#product-container canvas {
  cursor: grab; /* 기본 커서 - 잡을 수 있음 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: none; /* 터치 기본 동작 방지 */
}

#product-container canvas:active {
  cursor: grabbing; /* 드래그 중 커서 - 잡는 중 */
}

/* 애니메이션 토글 버튼 */
.animation-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s;
}

.animation-toggle:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.animation-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.5);
}

/* 카메라 리셋 버튼 */
.camera-reset {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s;
}

.camera-reset:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.camera-reset:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.5);
}

/* 미디어 쿼리 추가 - 대형 화면에서 더 많은 공간 */
@media (min-width: 1200px) {
  .product-list {
    max-height: 700px; /* 대형 화면에서는, 더 많은 모델을 볼 수 있게 함 */
  }
  
  .product-selection {
    flex: 1.2; /* 비율 약간 증가 */
  }
}

/* 크레딧 아이콘 */
.credit-icon {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  font-weight: bold;
  font-family: 'Arial', sans-serif;
  text-decoration: none;
  border: none;
}

.credit-icon:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* 툴팁 스타일 */
.credit-tooltip {
  display: none;
  position: absolute;
  right: 40px;
  bottom: 10px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  max-width: 250px;
  z-index: 11;
  text-align: left;
  line-height: 1.4;
}

.credit-tooltip a {
  color: #3498db;
  text-decoration: none;
}

.credit-tooltip a:hover {
  text-decoration: underline;
}

/* 모바일 설정 추가 - 작은 화면 */
@media (max-width: 767px) {
  .product-showcase {
    height: 70vh; /* 모바일에서는 뷰포트 높이의 70% */
    min-height: 350px;
    margin-bottom: 1rem;
  }
  
  .main-content {
    height: auto; /* 고정 높이 대신 콘텐츠에 맞춤 */
    padding: 0.5rem; /* 패딩 줄임 */
  }
  
  .product-selection {
    max-height: none; /* 최대 높이 제한 해제 */
  }
  
  .product-list {
    max-height: 400px; /* 모바일에서는 목록 높이 줄임 */
  }
  
  /* 모바일에서는 제품 아이템 레이아웃 최적화 */
  .product-item {
    min-height: 120px;
  }
  
  .product-thumb {
    width: 120px;
    height: 120px;
  }
  
  .header h1 {
    font-size: 1.5rem; /* 모바일에서 헤더 크기 줄임 */
  }
  
  /* 컨트롤 정보 크기 조정 */
  .controls-info {
    font-size: 0.7rem;
    padding: 0.4rem;
  }
  
  /* 버튼 크기 조정 */
  .animation-toggle, .camera-reset {
    padding: 6px 10px;
    font-size: 0.7rem;
  }
}

/* 태블릿 설정 */
@media (min-width: 768px) and (max-width: 1199px) {
  .product-showcase {
    height: 75vh; /* 태블릿에서는 뷰포트 높이의 75% */
    min-height: 500px;
    margin-right: 1rem;
    margin-bottom: 0;
  }
  
  .main-content {
    padding: 1rem;
  }
}

/* 데스크탑 설정 */
@media (min-width: 1200px) {
  .product-showcase {
    height: 80vh; /* 데스크탑에서는 뷰포트 높이의 80% */
    min-height: 700px;
  }
  
  .main-content {
    padding: 1.5rem;
    height: calc(100vh - 120px); /* 헤더와 푸터를 제외한 전체 높이 */
  }
  
  .product-list {
    max-height: 700px; /* 대형 화면에서는, 더 많은 모델을 볼 수 있게 함 */
  }
  
  .product-selection {
    flex: 1.2; /* 비율 약간 증가 */
  }
}

/* 가로 모드 모바일 최적화 */
@media (max-height: 500px) and (orientation: landscape) {
  .product-showcase {
    height: 85vh;
    min-height: 300px;
  }
  
  .header {
    padding: 0.5rem;
  }
  
  .header h1 {
    font-size: 1.2rem;
  }
  
  .footer {
    padding: 0.5rem;
  }
  
  .main-content {
    padding: 0.4rem;
  }
} 