/* ============================================
 * 3D虚拟试衣间 - 样式表
 * ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- 侧边栏 ---- */
#sidebar {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 280px;
  background: rgba(20, 20, 40, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.sidebar-header {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #ffffff;
}

.sidebar-header .subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ---- 服装列表 ---- */
#garment-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.garment-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  color: #e0e0e0;
  font-family: inherit;
}

.garment-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(-4px);
}

.garment-btn.selected {
  background: rgba(100, 140, 255, 0.15);
  border-color: rgba(100, 140, 255, 0.4);
  box-shadow: 0 0 20px rgba(100, 140, 255, 0.1);
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease;
}

.garment-btn:hover .color-swatch {
  transform: scale(1.1);
}

.garment-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.garment-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.garment-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

/* ---- 控制按钮 ---- */
#controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ctrl-btn {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #c0c0c0;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.ctrl-btn.active {
  background: rgba(100, 200, 150, 0.15);
  border-color: rgba(100, 200, 150, 0.3);
  color: #8adea8;
}

/* ---- 操作说明 ---- */
#instructions {
  text-align: center;
  padding-top: 8px;
}

#instructions p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 1px;
}

/* ---- 提示 Toast ---- */
#toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 60, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 12px 28px;
  border-radius: 30px;
  font-size: 13px;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
  z-index: 100;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- 加载画面 ---- */
#loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0f0f1a;
  z-index: 1000;
  transition: opacity 0.6s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid rgba(100, 140, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

#loading p {
  margin-top: 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- 响应式 ---- */
@media (max-width: 680px) {
  #sidebar {
    top: auto;
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
    max-height: 45vh;
    padding: 16px 14px;
    border-radius: 14px;
  }

  .garment-btn {
    padding: 10px 12px;
  }

  .color-swatch {
    width: 32px;
    height: 32px;
  }
}
