* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, "Microsoft JhengHei", BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header 樣式 */
#header {
  width: 100%;
  height: 100px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between; /* 改為兩端對齊 */
  padding: 0 50px;
  position: relative;
  z-index: 20;
  flex-shrink: 0;
}

.logo {
  height: 80px;
}

.menu-content {
  display: flex;
  align-items: center;
  gap: 400px;
}
.Alltitle {
  display: flex;
  padding: 0;
}
.title {
  padding: 0 40px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.iconimg {
  height: 30px;
  padding: 0 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.board-shape-section {
  margin-bottom: 32px;
}

/* 桌板形狀下拉選單樣式 */
.board-shape-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.board-shape-select:hover {
  border-color: #007bff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.board-shape-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 漢堡選單按鈕 (桌面版隱藏) */
.hamburger-menu {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 10px;
  z-index: 30;
}

.hamburger-menu span {
  width: 25px;
  height: 3px;
  background-color: #333;
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* 漢堡選單動畫 */
.hamburger-menu.active span:nth-child(1) {
  transform: rotate(-45deg) translate(-6px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(45deg) translate(-6px, -6px);
}
/* 主要內容區域 */
#main-content {
  flex: 1;
  display: flex;
  height: calc(100vh - 110px); /* 扣除header和footer高度 */
  overflow: hidden;
}

/* 3D 畫面容器 - 修正尺寸和定位 */
#three-container {
  flex: 1;
  height: 100%;
  background: rgb(255, 255, 255);
  position: relative;
  overflow: hidden;
}

/* 右側控制面板 - 固定寬度和位置 */
#control-panel {
  width: auto;
  min-width: 350px;
  height: 100%;
  flex-shrink: 0;
  background: #ffffff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  padding: 25px;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}
#collision-warning {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%); /* 完全居中 */
  color: rgb(255, 0, 0);
  font-size: 16px;
  font-weight: bold;
  z-index: 99;
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
}
#footer {
  width: 100%;
  height: 50px;
  background: #455f79;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  z-index: 20;
}

/* 價格顯示 */
.price-section {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e0e0e0;
}

.price-label {
  font-size: 16px;
  color: #666;
  margin-bottom: 8px;
}

.price-value {
  font-size: 28px;
  font-weight: bold;
  color: #2c3e50;
}

/* 桌腳樣式選擇 */
.leg-style-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
}

.leg-style-btn {
  aspect-ratio: 1;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.leg-style-btn:hover {
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.leg-style-btn.active {
  border-color: #007bff;
  background: #e3f2fd;
}

.leg-style-btn svg {
  width: 24px;
  height: 24px;
  fill: #666;
}

/* 桌腳顏色選擇 */
.leg-color-section {
  margin-bottom: 32px;
}

.leg-color-btn {
  aspect-ratio: 1;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.leg-color-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leg-color-btn.active {
  border-color: #007bff;
  border-width: 3px;
}

/* 桌腳顏色定義 */
.leg-color-white {
  background: #ffffff;
  border-color: #ddd;
}
.leg-color-gray {
  background: #9e9e9e;
}
.leg-color-black {
  background: #2c2c2c;
}

/* 配件選擇 - 優化設計 */
.accessory {
  margin-bottom: 32px;
  justify-items: center;
}

/* 配件顏色選擇按鈕 */
.accessory-btn {
  width: 100%;
  min-height: 200px; /* 改為最小高度而非固定高度 */
  height: auto; /* 允許自動調整高度 */
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible; /* 改為可見，避免內容被裁切 */
  background-color: #f8f9fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* 改為從上開始排列 */
  padding: 16px 100px; /* 增加上下padding */
  box-sizing: border-box;
}

.accessory-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 配件圖片容器 */
.accessory-image {
  background-size: contain;
  flex-shrink: 0; /* 防止圖片被壓縮 */
}

/* 配件網格佈局 - 改為一排兩個 */
/* .accessory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
} */

/* 配件標籤 */
.accessory-label {
  position: static;
  background: none;
  color: #333;
  padding: 0;
  border-radius: 0;
  font-size: 16px;
  text-align: center;
  font-weight: 500;
  line-height: 1.3;
}
/* 配件描述文字 */
.accessory-desc {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin-top: 2px;
}

/* 下拉選單樣式 */
.accessory-select {
  width: calc(100% - 8px); /* 稍微縮小避免溢出 */
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 13px;
  margin-top: 8px;
  box-sizing: border-box;
  flex-shrink: 0;
}
/* 尺寸調整滑桿 */
.dimension-section {
  margin-bottom: 32px;
}

.slider-container {
  margin-bottom: 24px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: #555;
}

.slider-value {
  font-weight: 600;
  color: #333;
}

.custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  transition: all 0.2s ease;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #007bff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
  transition: all 0.2s ease;
}

.custom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.custom-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #007bff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

/* 桌板顏色選擇 */
.tabletop-color-section {
  margin-bottom: 32px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(7, 2fr);
  gap: 8px;
}

.color-btn {
  aspect-ratio: 1;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn.active {
  border-color: #007bff;
  border-width: 3px;
}

/* 桌板顏色定義 */
.color-elegant-walnut {
  background: #6b340d;
}
.color-european-walnut {
  background: #a0522d;
}
.color-nordic-white-oak {
  background: #fae4b6;
}
.color-snow-white-teak {
  background: #eeeede;
}
.color-tobacco-oak {
  background: #d2691e;
}
.color-carbon {
  background: #2c2c2c;
}
.color-black {
  background: #000000;
}
.color-white {
  background: #ffffff;
}

/* 功能按鈕 */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary {
  background: #000000;
  color: white;
}

.btn-primary:hover {
  background: #cc0001;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(206, 0, 0, 0.3);
}

.btn-secondary {
  background: #f8f9fa;
  color: #333;
  border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
  background: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.accessory-image img {
  width: 150px;
  height: 150px;
  padding: 10px 0 10px 0;
}

/* AR 模式容器 */
#ar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: black;
}
/* 位置選擇群組 */
.socket-position-group {
  display: flex;
  justify-content: center; /* 水平置中 */
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  width: 100%;
  max-width: 100%;
  flex-wrap: nowrap; /* 防止換行 */
  flex-shrink: 0;
}

/* 複選框標籤容器 */
.socket-checkbox-label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex: 1;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  font-size: 14px;
  color: #333;
  min-width: 0; /* 允許收縮 */
  white-space: nowrap; /* 防止文字換行 */
}

.socket-checkbox-label:hover {
  background-color: #f0f0f0;
}

/* 隱藏原生複選框 */
.socket-checkbox {
  appearance: none;
  width: 12px;
  height: 12px;
  border: 2px solid #ddd;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
  flex-shrink: 0;
}

.socket-checkbox:checked {
  background-color: #007bff;
  border-color: #007bff;
}

.socket-checkbox:checked::after {
  content: "✓";
  position: absolute;
  top: -2px;
  left: 1px;
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.socket-checkbox:hover {
  border-color: #007bff;
}

/* 複選框文字 */
.socket-checkbox-text {
  font-size: 12px;
  color: #333;
  user-select: none;
}

.pegboard-position-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
  width: 100%;
}

/* 洞洞板位置行 */
.pegboard-position-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

/* 洞洞板複選框標籤 (稍微調整以適應四個位置) */
.pegboard-position-group .socket-checkbox-label {
  flex: 1;
  padding: 3px 4px;
  font-size: 10px;
  min-width: 0;
  text-align: center;
}
.open-trunk-position-group,
.cup-holder-position-group,
.computer-hanging-position-group {
  display: flex;
  justify-content: space-around; /* 左右分布 */
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  width: 100%;
}

/* 開放式集線槽複選框標籤 */
.open-trunk-position-group,
.cup-holder-position-group,
.computer-hanging-position-group .socket-checkbox-label {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  min-width: 0;
  text-align: center;
  justify-content: center;
}
.double-drawer-position-group {
  display: flex;
  justify-content: space-between; /* 三個位置平均分布 */
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  width: 100%;
}

/* 雙層式抽屜複選框標籤 */
.double-drawer-position-group .socket-checkbox-label {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
  min-width: 0;
  text-align: center;
  justify-content: center;
}

/* 響應式設計 */
@media (max-width: 768px) {
  #header {
    height: 70px;
    padding: 0 20px;
    justify-content: center;
  }

  #three-container {
    height: 40%;
  }

  #main-content {
    flex-direction: column;
  }

  #control-panel {
    height: 60%;
  }

  #collision-warning {
    font-weight: 500;
    font-size: 14px;
    padding: 10px 8px;
    white-space: normal;
    width: 60%;
    border: 1px solid #ff0000;
  }

  #footer {
    font-size: 10px;
    height: 40px;
  }

  /* .accessory-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  } */

  .accessory-btn {
    width: 100%;
    padding: 20px 100px; /* 增加上下padding */
  }
  /* 手機版配件圖片調整 */
  .accessory-image {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .accessory-image img {
    width: 150px;
    height: 150px;
    padding: 5px 0 5px 0;
  }

  /* 手機版配件標籤調整 */
  .accessory-label {
    font-size: 16px;
    line-height: 1.2;
    text-align: center;
  }

  /* 手機版下拉選單調整 */
  .accessory-select {
    width: 100%;
    padding: 6px 8px; /* 增加padding讓觸控更容易 */
    font-size: 14px; /* 防止iOS自動縮放 */
    margin-top: 8px;
    min-height: 36px; /* iOS建議的最小觸控區域 */
  }

  .board-shape-select {
    padding: 12px 16px;
    font-size: 16px; /* 防止iOS自動縮放 */
    min-height: 48px; /* iOS建議的最小觸控區域 */
  }

  .logo {
    height: 50px; /* 縮小 Logo */
  }

  /* 顯示漢堡選單按鈕 */
  .hamburger-menu {
    display: flex;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }

  /* 隱藏桌面版選單 */
  .menu-content {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: #ffffff;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 25;
  }

  /* 顯示手機版選單 */
  .menu-content.active {
    display: flex;
  }

  .Alltitle {
    flex-direction: column;
    padding: 0;
    margin-bottom: 40px;
  }

  .title {
    padding: 20px 40px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
    font-size: 18px;
  }

  .title:last-child {
    border-bottom: none;
  }

  .icon {
    display: flex;
    justify-content: center;
    gap: 20px;
  }

  .iconimg {
    height: 40px;
    padding: 0;
  }

  .socket-position-group {
    gap: 6px;
    margin: 10px 0 6px 0;
  }

  .socket-checkbox-label {
    padding: 8px 6px;
    font-size: 11px;
  }

  .socket-checkbox {
    width: 16px;
    height: 16px;
  }

  .socket-checkbox:checked::after {
    top: -1px;
    left: 2px;
    font-size: 11px;
  }

  .pegboard-position-group {
    gap: 3px;
    margin: 6px 0;
  }

  .pegboard-position-row {
    gap: 3px;
  }

  .pegboard-position-group .socket-checkbox-label {
    padding: 4px 2px;
    font-size: 9px;
  }
  .open-trunk-position-group,
  .cup-holder-position-group,
  .computer-hanging-position-group {
    gap: 8px;
    margin: 10px 0 6px 0;
  }

  .open-trunk-position-group,
  .cup-holder-position-group,
  .computer-hanging-position-group .socket-checkbox-label {
    padding: 8px 10px;
    font-size: 11px;
  }
  .double-drawer-position-group {
    gap: 4px;
    margin: 15px 0 6px 0;
  }

  .double-drawer-position-group .socket-checkbox-label {
    padding: 6px 4px;
    font-size: 10px;
  }
}

/* 平板版 */
@media (min-width: 769px) and (max-width: 1024px) {
  #main-content {
    max-width: 100vw;
    max-height: calc(100vh - 110px);
  }

  #three-container {
    max-width: calc(100vw - 320px);
    max-height: 100%;
  }

  #control-panel {
    max-height: 100%;
  }
  .accessory-btn {
    height: 180px;
  }

  .accessory-image img {
    width: 100px;
    height: 100px;
    padding: 10px 0 10px 0;
  }

  .pegboard-position-group .socket-checkbox-label {
    font-size: 10px;
    padding: 3px 3px;
  }

  .open-trunk-position-group,
  .cup-holder-position-group,
  .computer-hanging-position-group .socket-checkbox-label {
    font-size: 11px;
    padding: 6px 10px;
  }

  .double-drawer-position-group .socket-checkbox-label {
    font-size: 10px;
    padding: 4px 5px;
  }
}
