/* 自定义产品选项前端样式 */

.cpo-custom-options {
  margin: 30px 0;
}

.cpo-option {
  margin-bottom: 25px;
}

.cpo-option:last-child {
  margin-bottom: 0;
}

.cpo-option-title {
  font-size: 24px;
  line-height: 42px;
  font-weight: bold;
  margin: 0 0 15px 0;
  color: #fff;
}

/* 下拉选择样式 */
.cpo-select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 14px;
  background: white;
}

/* 单选按钮样式 */
.cpo-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.cpo-radio-item {
  display: flex;
  align-items: center;
  padding: 10px 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #fff;
  border: 1px solid #e4e4e480;
}

.cpo-radio-item:hover {
  border-color: #fff;
}

.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;
}

.cpo-radio-item:has(input[type="radio"]:checked) .cpo-radio-label,
.cpo-radio-item.selected .cpo-radio-label {
  color: #fff;
}
.cpo-radio-label {
  font-size: 14px;
  line-height: 20px;
}
/* 图片选择样式 */
.cpo-variation-swatches {
  display: flex;
  gap: 20px;
}

.cpo-swatch-container {
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  overflow: inherit;
}

.cpo-swatch-container:hover {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cpo-swatch-container.selected {
  box-shadow: 0 0 10px rgba(0, 115, 170, 0.3);
}

.cpo-media-container {
  position: relative;
  overflow: hidden;
}

.cpo-swatch-content {
  position: relative;
  display: block;
}

.cpo-swatch-content img {
  width: 94px;
  height: 94px;
  object-fit: cover;
  display: block;
  transition: all 0.3s ease;
}

.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: 1px solid #fff;
}

/* 价格统计区域 */
.cpo-price-summary {
  margin-top: 20px;
  padding-top: 20px;
  background: transparent;
  border-top: 1px solid #d8d8d880;
}

.cpo-options-amount,
.cpo-final-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cpo-final-total {
  margin-bottom: 0;
  padding-top: 12px;
  font-weight: bold;
}

.cpo-label {
  font-weight: 500;
  color: #fff;
  font-size: 24px;
  line-height: 42px;
}

.cpo-amount,
.cpo-total {
  font-weight: bold;
  color: #fff;
  font-size: 26px;
  line-height: 46px;
}

.cpo-final-total .cpo-total {
  color: #fff;
  font-size: 26px;
  line-height: 46px;
}

/* 图片选择悬停提示框样式 */
.cpo-swatch-container {
    position: relative;
    display: inline-block;
    margin: 5px;
    cursor: pointer;
}

.cpo-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #d8a93d;
    color: white;
    padding: 4px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cpo-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #d8a93d;
}

.cpo-swatch-container:hover .cpo-tooltip {
    opacity: 1;
    visibility: visible;
}

/* 确保tooltip在容器内正确显示 */
.cpo-variation-swatches {
    position: relative;
    overflow: visible;
}

/* 调整媒体容器样式以适应tooltip */
.cpo-media-container {
    position: relative;
    transition: transform 0.2s ease;
}

.cpo-swatch-container:hover .cpo-media-container {
    transform: translateY(-2px);
}

/* 选中状态的tooltip样式 */
.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 {
    padding: 15px;
  }

  .cpo-radio-group {
    flex-direction: column;
  }

  .cpo-variation-swatches {
    grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
    gap: 20px;
  }

  .cpo-swatch-content img {
    width: 60px;
    height: 60px;
  }

  .cpo-options-amount,
  .cpo-final-total {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .cpo-tooltip {
    font-size: 11px;
    padding: 6px 10px;
  }
}
