/**
 * 虚拟试戴组件样式
 */

/* 浮动试戴按钮 */
.gls-wzt-tryon-float {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  transition: box-shadow 0.2s, background 0.2s;
  user-select: none;
}

.gls-wzt-tryon-float:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  background: #fff;
}

.gls-wzt-tryon-float svg {
  flex-shrink: 0;
}

/* 移动端：左下角定位 */
.gls-wzt-tryon-float.gls-wzt-tryon-float-m {
  top: auto;
  bottom: 12px;
  right: auto;
  left: 12px;
}

/* 弹窗遮罩 */
.gls-tryon-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gls-tryon-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

/* 弹窗内容 */
.gls-tryon-modal-content {
  position: relative;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.gls-tryon-modal-content h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 600;
  color: #222;
}

/* 关闭按钮 */
.gls-tryon-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.gls-tryon-close:hover {
  background: #e8e8e8;
  color: #333;
}

/* 预览区域 */
.gls-tryon-preview {
  position: relative;
  width: 100%;
  min-height: 300px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 16px;
}

.gls-tryon-preview canvas {
  max-width: 100%;
  max-height: 460px;
  height: auto;
  display: block;
  touch-action: none;
}

/* 拖拽提示 */
.gls-tryon-drag-hint {
  display: none;
  margin: 8px 0;
  padding: 0;
  font-size: 12px;
  color: #999;
  text-align: center;
  user-select: none;
}

.gls-tryon-drag-hint svg {
  vertical-align: middle;
  stroke: #999;
}

/* Loading State */
.gls-tryon-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(249, 249, 249, 0.9);
  z-index: 2;
}

.gls-tryon-loading .spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid #e0e0e0;
  border-top-color: #333;
  border-radius: 50%;
  animation: tryon-spin 0.8s linear infinite;
}

.gls-tryon-loading p {
  margin: 16px 0 0;
  font-size: 14px;
  color: #666;
}

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

/* Error State */
.gls-tryon-error {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  text-align: center;
  z-index: 3;
}

/* Thumbnail Bar */
.gls-tryon-thumbs-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gls-tryon-thumbs {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.gls-tryon-thumbs::-webkit-scrollbar {
  display: none;
}

.gls-tryon-thumb-item {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.gls-tryon-thumb-item:hover {
  border-color: #bbb;
  transform: scale(1.05);
}

.gls-tryon-thumb-item.active {
  border-color: #222;
}

.gls-tryon-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Scroll Arrow Buttons */
.gls-tryon-thumb-arrow {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.gls-tryon-thumb-arrow:hover {
  background: #f5f5f5;
  border-color: #bbb;
}

/* Upload Button in Thumbnail Bar */
.gls-tryon-thumb-upload {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border: 2px dashed #ccc;
  background: #fafafa;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.gls-tryon-thumb-upload:hover {
  border-color: #888;
  background: #f0f0f0;
}

.gls-tryon-thumb-upload svg {
  color: #888;
}

/* Responsive */
@media (max-width: 768px) {
  .gls-tryon-modal-content {
    width: 95%;
    padding: 24px 16px;
    max-height: 90vh;
  }

  .gls-tryon-modal-content h3 {
    font-size: 18px;
    margin-bottom: 14px;
  }

  .gls-tryon-preview {
    min-height: 220px;
  }

  .gls-tryon-preview canvas {
    max-height: 320px;
  }

  .gls-tryon-thumb-item {
    width: 48px;
    height: 48px;
  }

  .gls-tryon-thumb-upload {
    width: 48px;
    height: 48px;
  }
}
