/* 基礎重置樣式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft JhengHei", Arial, sans-serif;
  height: 100vh;
  overflow-y: auto;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 無商品訊息樣式 */
.no-products-message {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin: 0 auto 25px;
  max-width: 600px;
}

.no-products-message h3 {
  color: #666;
  font-size: 24px;
  margin-bottom: 15px;
}

.no-products-message p {
  color: #999;
  font-size: 16px;
  line-height: 1.6;
}

.no-products-message .admin-link {
  display: inline-block;
  margin-top: 20px;
  background: #007bff;
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.no-products-message .admin-link:hover {
  background: #0056b3;
  transform: translateY(-2px);
}

/* Logo 容器樣式 */
.logo-container {
  margin-bottom: 25px;
  padding: 20px 0;
  display: flex;
  flex-shrink: 0;
  align-items: center;
}

.logo {
  width: auto;
  height: auto;
  object-fit: contain;
  transition: all 0.3s ease;
}

/* 商品輪播樣式 */
.product-carousel {
  position: relative;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin: 0 auto 25px;
  max-width: 600px;
  width: 60%;
  min-width: 400px;
  height: 300px;
  flex-shrink: 0;
}

.product-main {
  position: relative;
  width: 100%;
  height: calc(100% - 40px);
  overflow: hidden;
}

.single-product .product-main {
  height: 100%;
}

.product-slide {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
}

.product-slide.active {
  display: block;
}

.product-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 商品資訊樣式 */
.product-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  color: white;
  padding: 10px 15px 5px;
}

.product-name {
  margin-bottom: 3px;
}

.product-price {
  /* 動態樣式將由 PHP 設定 */
}

/* 商品選擇按鈕 */
.product-select-btn {
  margin-top: 8px;
}

.select-product-btn {
  display: inline-block;
  background: rgba(0, 123, 255, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.select-product-btn:hover {
  background: rgba(0, 123, 255, 1);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* 導航按鈕 */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev {
  left: 10px;
}

.nav-btn.next {
  right: 10px;
}

.single-product .nav-btn {
  display: none;
}

/* 商品預覽 */
.product-preview {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  height: 40px;
  overflow-x: auto;
}

.preview-item {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.preview-item:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.preview-item.active {
  border-color: #007bff;
  box-shadow: 0 0 0 1px #007bff;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 文字區塊樣式 */
.chinese-text-section {
  padding: 25px 20px;
  flex-shrink: 0;
  margin-top: 10px;
  margin-bottom: 10px;
}

.chinese-text {
  line-height: 1.4;
}

.english-text-section {
  padding: 15px 20px;
  flex-shrink: 0;
  margin-bottom: 20px;
}

.english-text {
  line-height: 1.4;
  font-style: italic;
}

/* 規格選擇模態框樣式 */
.spec-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.spec-modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 800px; /* 增加電腦版寬度 */
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.spec-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.spec-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
}

.spec-modal-close {
  font-size: 28px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  line-height: 20px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.spec-modal-close:hover {
  color: #333;
  background-color: #f0f0f0;
}

/* 規格選擇區域 */
.spec-selection-area {
  margin-bottom: 20px;
}

.spec-group {
  margin-bottom: 20px;
}

.spec-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
  font-size: 16px;
}

.spec-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.spec-option {
  padding: 10px 16px;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  background: white;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  min-width: 60px;
  text-align: center;
  user-select: none;
}

.spec-option:hover {
  border-color: #007bff;
  background-color: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.spec-option.selected {
  border-color: #007bff;
  background-color: #007bff;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.spec-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f5f5f5;
  color: #999;
}

.spec-option.disabled:hover {
  border-color: #ddd;
  background-color: #f5f5f5;
  transform: none;
  box-shadow: none;
}

.spec-option small {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  opacity: 0.8;
}

/* 庫存資訊 */
.stock-info {
  margin: 15px 0;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #e9ecef;
  background-color: #f8f9fa;
  color: #495057;
}

.stock-info.low-stock {
  background-color: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.stock-info.out-of-stock {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* 價格資訊 */
.spec-price-info {
  margin: 15px 0;
  font-size: 18px;
  font-weight: bold;
  color: #28a745;
  text-align: center;
  padding: 10px;
  background-color: #f8fff9;
  border-radius: 6px;
  border: 1px solid #d4edda;
}

/* 確認按鈕 */
.confirm-selection-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s ease;
}

.confirm-selection-btn:hover:not(:disabled) {
  background: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.confirm-selection-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

/* 規格說明圖片區域 */
.spec-images-section {
  margin: 20px 0;
  padding: 15px 0;
  border-top: 2px solid #f0f0f0;
  width: 100%;
}

.spec-images-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
  text-align: center;
}

.spec-images-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 500px;
  overflow-y: auto;
  padding: 5px;
  width: 100%;
}

.spec-image-item {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: #fff;
}

.spec-image-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.spec-image-item img {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  object-fit: contain;
}

.spec-image-caption {
  background: #f8f9fa;
  padding: 10px 15px;
  border-top: 1px solid #e9ecef;
}

.spec-image-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
  font-size: 14px;
}

.spec-image-description {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

/* 圖片放大預覽 */
.image-preview-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  cursor: pointer;
  animation: fadeIn 0.3s ease;
}

.image-preview-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  max-height: 90%;
}

.image-preview-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-preview-close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.image-preview-close:hover {
  color: #ccc;
}

/* 動畫效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 響應式設計 - 平板 */
@media (max-width: 768px) {
  body {
    overflow-y: auto;
  }

  .container {
    padding: 1px;
    min-height: 100vh;
  }

  .logo-container {
    margin-bottom: 1px;
    padding: 15px 0;
  }

  .product-carousel {
    width: 60%;
    min-width: 250px;
    height: 35vh;
    margin-bottom: 25px;
  }

  .product-info {
    padding: 15px 20px 10px;
  }

  .nav-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .nav-btn.prev {
    left: 6px;
  }

  .nav-btn.next {
    right: 6px;
  }

  .chinese-text-section {
    padding: 15px 15px;
    margin-top: 30px;
    margin-bottom: 8px;
  }

  .english-text-section {
    padding: 8px 15px;
    margin-top: 15px;
    margin-bottom: 15px;
  }

  .product-preview {
    height: 50px;
    gap: 6px;
    padding: 8px;
  }

  .preview-item {
    width: 28px;
    height: 28px;
    border-radius: 2px;
  }

  .product-main {
    height: calc(100% - 50px);
  }

  .single-product .product-main {
    height: 100%;
  }

  /* 規格選擇響應式 */
  .spec-modal-content {
    margin: 5% auto;
    width: 95%;
    padding: 15px;
    max-height: 90vh;
  }

  .spec-modal-header h3 {
    font-size: 16px;
  }

  .spec-options {
    gap: 8px;
  }

  .spec-option {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 50px;
  }

  .spec-price-info {
    font-size: 16px;
    padding: 8px;
  }

  .confirm-selection-btn {
    padding: 12px;
    font-size: 15px;
  }

  /* 規格圖片響應式 */
  .spec-images-section {
    margin: 15px 0;
    padding: 12px 0;
  }

  .spec-images-title {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .spec-images-container {
    max-height: 350px;
    gap: 12px;
  }

  .spec-image-caption {
    padding: 8px 12px;
  }

  .spec-image-title {
    font-size: 13px;
  }

  .spec-image-description {
    font-size: 12px;
  }
}

/* 響應式設計 - 手機 */
@media (max-width: 480px) {
  .container {
    padding: 0px;
  }

  .logo-container {
    padding: 12px 0;
    margin-bottom: 1px;
  }

  .product-carousel {
    width: 60%;
    min-width: 200px;
    height: 30vh;
    margin-bottom: 1px;
  }

  .product-info {
    padding: 12px 15px 8px;
  }

  .nav-btn {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .chinese-text-section {
    padding: 6px 12px;
    margin-top: 40px;
    max-height: 25px;
  }

  .english-text-section {
    padding: 6px 12px;
    margin-top: 20px;
    max-height: 25px;
  }

  .preview-item {
    width: 16px;
    height: 16px;
  }

  .product-preview {
    height: 24px;
    gap: 4px;
    padding: 6px;
  }

  .product-main {
    height: calc(100% - 24px);
  }

  /* 規格選擇響應式 - 手機全螢幕 */
  .spec-modal-content {
    margin: 0;
    width: 100%;
    padding: 0;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    position: fixed;
    top: 0;
    left: 0;
  }

  .spec-modal-header {
    padding: 12px 15px;
    margin-bottom: 0;
  }

  .spec-modal-body {
    padding: 0 15px;
    height: calc(100vh - 120px);
    overflow-y: auto;
  }

  .spec-selection-area {
    margin-bottom: 15px;
  }

  .spec-option {
    flex: 1 1 calc(50% - 4px);
    min-width: auto;
  }

  .stock-info,
  .spec-price-info {
    margin-left: 0;
    margin-right: 0;
  }

  .confirm-selection-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    width: 100%;
    border-radius: 0;
  }

  /* 規格圖片響應式 - 全寬顯示 */
  .spec-images-section {
    margin: 15px -15px;
    padding: 10px 0;
    width: calc(100% + 30px);
  }

  .spec-images-title {
    font-size: 14px;
    margin-bottom: 10px;
    padding: 0 15px;
  }

  .spec-images-container {
    max-height: 300px;
    gap: 10px;
    padding: 0;
  }

  .spec-image-item {
    border-radius: 0;
    width: 100vw;
    margin: 0;
  }

  .spec-image-item img {
    width: 100vw;
    max-width: 100vw;
  }

  .spec-image-caption {
    padding: 8px 15px;
    border-radius: 0;
  }

  .spec-image-title {
    font-size: 12px;
    margin-bottom: 3px;
  }

  .spec-image-description {
    font-size: 11px;
    line-height: 1.3;
  }

  .image-preview-close {
    top: 10px;
    right: 20px;
    font-size: 30px;
  }
}

/* 響應式設計 - 小手機 */
@media (max-width: 360px) {
  .container {
    padding: 0px;
  }

  .logo-container {
    padding: 10px 0;
    margin-bottom: 0px;
  }

  .product-carousel {
    height: 28vh;
    margin-bottom: 0px;
  }

  .chinese-text-section {
    padding: 4px 10px;
    margin-top: 45px;
    max-height: 20px;
  }

  .english-text-section {
    padding: 4px 10px;
    margin-top: 25px;
    max-height: 20px;
  }

  .product-info {
    padding: 8px 12px 6px;
  }

  .nav-btn {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .nav-btn.prev {
    left: 4px;
  }

  .nav-btn.next {
    right: 4px;
  }

  .product-preview {
    gap: 2px;
    padding: 4px;
  }

  /* 規格選擇響應式 - 小手機 */
  .spec-modal-header {
    padding: 10px 12px;
  }

  .spec-modal-header h3 {
    font-size: 15px;
  }

  .spec-modal-body {
    padding: 0 12px;
  }

  /* 規格圖片響應式 - 小手機 */
  .spec-images-section {
    margin: 10px -12px;
    padding: 8px 0;
    width: calc(100% + 24px);
  }

  .spec-images-title {
    font-size: 13px;
    margin-bottom: 8px;
    padding: 0 12px;
  }

  .spec-images-container {
    max-height: 250px;
    gap: 8px;
  }

  .spec-image-caption {
    padding: 6px 12px;
  }

  .spec-image-title {
    font-size: 11px;
  }

  .spec-image-description {
    font-size: 10px;
  }
}
