/* 现代化前端样式 - 优化间距和布局 */

.cpo-custom-options {
  margin: 40px 0;
  padding: 0;
}

/* Tab 切换按钮样式 */
.cpo-mode-toggle-wrapper {
  margin-bottom: 30px;
}

.cpo-mode-toggle-title {
  font-size: 24px;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 20px 0;
  color: #fff;
  letter-spacing: 0.5px;
}

.cpo-mode-toggle {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cpo-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 173px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cpo-toggle-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.cpo-toggle-btn.active {
  background: #fff;
  border-color: #fff;
  color: #000;
}

.cpo-toggle-btn:not(.active) {
  background: transparent;
  color: #fff;
}

.cpo-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.cpo-toggle-icon object,
.cpo-toggle-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* 确保 SVG 图标继承颜色 */
.cpo-toggle-icon svg {
  color: inherit;
}

.cpo-toggle-icon svg path {
  fill: currentColor;
}

.cpo-toggle-label {
  user-select: none;
}

.cpo-custom-options-container {
  margin-top: 20px;
}

.cpo-option {
  margin-bottom: 0;
  padding-bottom: 30px;
  border-bottom: none;
}

.cpo-option:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

.cpo-option-title {
  font-size: 24px;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 24px 0;
  color: #fff;
  letter-spacing: 0.5px;
}

/* 下拉选择样式 */
.cpo-select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.cpo-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.cpo-select option {
  background: #1a1a1a;
  color: #fff;
}

/* 单选按钮样式 */
.cpo-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.cpo-radio-item {
  display: flex;
  align-items: center;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  min-width: 120px;
  justify-content: center;
}

.cpo-radio-item:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.cpo-radio-item input[type="radio"] {
  margin-right: 8px;
  display: none;
}

.cpo-radio-item:has(input[type="radio"]:checked),
.cpo-radio-item.selected {
  border-color: #fff !important;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cpo-radio-item:has(input[type="radio"]:checked) .cpo-radio-label,
.cpo-radio-item.selected .cpo-radio-label {
  color: #fff;
  font-weight: 500;
}

.cpo-radio-label {
  font-size: 15px;
  line-height: 1.5;
  user-select: none;
}

/* 图片选择样式 */
.cpo-variation-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.cpo-swatch-container {
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  overflow: visible;
}

.cpo-swatch-container:hover {
  transform: translateY(-4px);
}

.cpo-swatch-container.selected {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.cpo-media-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.cpo-swatch-content {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
}

.cpo-swatch-content img {
  width: 94px;
  height: 94px;
  object-fit: cover;
  display: block;
  transition: all 0.3s ease;
  border-radius: 8px;
}

.cpo-swatch-container:hover .cpo-swatch-content img {
  transform: scale(1.05);
}

.cpo-checkmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background-image: url("https://hyperdoll.uptooto.tech/wp-content/uploads/2025/09/downarraw.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: brightness(0) invert(1);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.cpo-swatch-container.selected .cpo-checkmark {
  opacity: 1;
}

.cpo-swatch-container.selected .cpo-media-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.59);
  z-index: 5;
  border: 2px solid #fff;
  border-radius: 8px;
}

/* 子层选项样式 */
.cpo-children-levels {
  margin-top: 24px;
  padding-left: 0;
}

.cpo-level {
  margin-bottom: 24px;
  padding-left: 0;
  padding-bottom: 0;
  position: relative;
  border-left: none;
  border-bottom: none;
}

.cpo-level::before,
.cpo-level::after {
  display: none !important;
  content: none !important;
}

.cpo-level-title {
  font-size: 20px;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: #fff;
  letter-spacing: 0.5px;
}

.cpo-level .cpo-select,
.cpo-level .cpo-radio-group,
.cpo-level .cpo-variation-swatches {
  margin-bottom: 0;
}

/* 子选项样式与父选项保持一致 */
.cpo-level .cpo-select {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  padding: 14px 16px;
}

.cpo-level .cpo-select:focus {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.cpo-level .cpo-radio-item {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  padding: 14px 32px;
}

.cpo-level .cpo-radio-item:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.cpo-level .cpo-radio-item:has(input[type="radio"]:checked),
.cpo-level .cpo-radio-item.selected {
  border-color: #fff !important;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cpo-level .cpo-swatch-container {
  /* 保持原有样式，不需要特殊处理 */
}

.cpo-level .cpo-swatch-container.selected {
  /* 保持原有样式，不需要特殊处理 */
}

/* 价格统计区域 */
.cpo-price-summary {
  margin-top: 40px;
  padding-top: 30px;
  background: transparent;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.cpo-options-amount,
.cpo-final-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.cpo-options-amount {
  margin-bottom: 8px;
}

.cpo-final-total {
  margin-top: 12px;
  padding-top: 16px;
  font-weight: 600;
  border-top: none;
}

.cpo-label {
  font-weight: 500;
  color: #fff;
  font-size: 18px;
  line-height: 1.5;
}

.cpo-amount,
.cpo-total {
  font-weight: 600;
  color: #fff;
  font-size: 20px;
  line-height: 1.5;
}

.cpo-final-total .cpo-label {
  font-size: 22px;
}

.cpo-final-total .cpo-total {
  font-size: 24px;
  color: #fff;
}

/* 图片选择悬停提示框样式 */
.cpo-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #d8a93d;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.cpo-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #d8a93d;
}

.cpo-swatch-container:hover .cpo-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

.cpo-swatch-container.selected .cpo-tooltip {
  background-color: #d8a93d;
}

.cpo-swatch-container.selected .cpo-tooltip::after {
  border-top-color: #d8a93d;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .cpo-custom-options {
    margin: 30px 0;
  }

  .cpo-option {
    margin-bottom: 32px;
    padding-bottom: 24px;
  }

  .cpo-option-title {
    font-size: 20px;
    margin-bottom: 20px;
  }
  
  .cpo-mode-toggle-title {
    font-size: 20px;
    margin-bottom: 16px;
  }
  
  .cpo-toggle-btn {
    width: 135px;
    height: 40px;
  }
  
  .cpo-toggle-icon {
    width: 15px;
    height: 15px;
  }

  .cpo-radio-group {
    flex-direction: column;
    gap: 12px;
  }

  .cpo-radio-item {
    width: 100%;
    justify-content: flex-start;
  }

  .cpo-variation-swatches {
    gap: 16px;
    justify-content: center;
  }

  .cpo-swatch-content img {
    width: 80px;
    height: 80px;
  }

  .cpo-level {
    padding-left: 0;
    margin-bottom: 20px;
  }

  .cpo-level-title {
    font-size: 18px;
    margin-bottom: 14px;
  }

  .cpo-price-summary {
    margin-top: 32px;
    padding-top: 24px;
  }

  .cpo-label {
    font-size: 16px;
  }

  .cpo-amount,
  .cpo-total {
    font-size: 18px;
  }

  .cpo-final-total .cpo-label {
    font-size: 18px;
  }

  .cpo-final-total .cpo-total {
    font-size: 20px;
  }

  .cpo-tooltip {
    font-size: 12px;
    padding: 6px 12px;
  }
}
