/**
 * 商品页「未购买原因」匿名问卷
 * 视觉与主题保持一致：暖白背景、深紫主色、浅棕边框。
 */

.bw-feedback {
  --bw-feedback-x: 0;
  --bw-feedback-y: 0px;
  --bw-feedback-offset: 16px;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: min(360px, calc(100vw - 32px));
  opacity: 0;
  transform: translateX(var(--bw-feedback-x)) translateY(calc(var(--bw-feedback-y) + var(--bw-feedback-offset)));
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

/* 桌面端位置：右下角 / 底部居中 / 左下角 */
.bw-feedback--bottom-right {
  right: 24px;
  left: auto;
  --bw-feedback-x: 0;
}

.bw-feedback--bottom-left {
  left: 24px;
  right: auto;
  --bw-feedback-x: 0;
}

.bw-feedback--center {
  left: 50%;
  right: auto;
  --bw-feedback-x: -50%;
}

/* 屏幕正中间：水平 + 垂直居中 */
.bw-feedback--screen-center {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  --bw-feedback-x: -50%;
  --bw-feedback-y: -50%;
}

.bw-feedback[hidden] {
  display: none !important;
}

.bw-feedback.is-visible {
  opacity: 1;
  transform: translateX(var(--bw-feedback-x)) translateY(var(--bw-feedback-y));
  pointer-events: auto;
}

.bw-feedback__card {
  position: relative;
  box-sizing: border-box;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 20px;
  background: #FFFFFF;
  border: 1px solid #D9D0D3;
  box-shadow: 0 10px 32px rgba(45, 36, 38, 0.14);
  color: #2D2426;
  font-family: inherit;
}

.bw-feedback__card:focus {
  outline: none;
}

.bw-feedback__close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7A6B6E;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.bw-feedback__close:hover,
.bw-feedback__close:focus-visible {
  color: #5D2E57;
}

.bw-feedback__eyebrow {
  margin: 0 44px 8px 0;
  color: #5D2E57;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bw-feedback__title {
  margin: 0 44px 8px 0;
  color: #2D2426;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 600;
}

.bw-feedback__desc {
  margin: 0 0 14px;
  color: #7A6B6E;
  font-size: 13px;
  line-height: 1.5;
}

.bw-feedback__form {
  margin: 0;
}

.bw-feedback__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bw-feedback__option {
  box-sizing: border-box;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #D9D0D3;
  background: #FAF7F4;
  color: #2D2426;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.bw-feedback__option:hover,
.bw-feedback__option:focus-visible {
  background: #F3EBDD;
  border-color: #5D2E57;
  outline: none;
}

.bw-feedback__option:disabled {
  opacity: 0.55;
  cursor: default;
}

.bw-feedback__option--other {
  grid-column: 1 / -1;
}

.bw-feedback__other {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #E8E0D8;
}

.bw-feedback__other[hidden] {
  display: none !important;
}

.bw-feedback__label {
  display: block;
  margin-bottom: 6px;
  color: #5D4E37;
  font-size: 12px;
  font-weight: 600;
}

.bw-feedback__textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 64px;
  padding: 9px 10px;
  border: 1px solid #D9D0D3;
  background: #FFFFFF;
  color: #2D2426;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.bw-feedback__textarea:focus {
  border-color: #5D2E57;
  outline: none;
  box-shadow: 0 0 0 2px rgba(93, 46, 87, 0.12);
}

.bw-feedback__submit {
  margin-top: 8px;
  padding: 9px 18px;
  border: 0;
  background: #5D2E57;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.bw-feedback__submit:hover,
.bw-feedback__submit:focus-visible {
  background: #4A2345;
  outline: none;
}

.bw-feedback__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.bw-feedback__message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #7A6B6E;
  font-size: 12px;
  line-height: 1.4;
}

.bw-feedback__message.is-success {
  color: #2F6B3A;
}

.bw-feedback__message.is-error {
  color: #B3261E;
}

.bw-feedback__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.bw-feedback__dismiss,
.bw-feedback__privacy {
  padding: 0;
  border: 0;
  background: transparent;
  color: #7A6B6E;
  font-family: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.bw-feedback__dismiss:hover,
.bw-feedback__privacy:hover,
.bw-feedback__dismiss:focus-visible,
.bw-feedback__privacy:focus-visible {
  color: #5D2E57;
  outline: none;
}

.bw-feedback__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 1023px) {
  .bw-feedback,
  .bw-feedback--bottom-right,
  .bw-feedback--bottom-left,
  .bw-feedback--center {
    --bw-feedback-x: 0;
    --bw-feedback-y: 0px;
    top: auto;
    right: 16px;
    left: 16px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  /* 移动端屏幕中间居中 */
  .bw-feedback--screen-center {
    --bw-feedback-x: -50%;
    --bw-feedback-y: -50%;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(360px, calc(100vw - 32px));
  }

  .bw-feedback__card {
    max-height: calc(100vh - 140px);
    padding: 18px;
  }

  .bw-feedback__option {
    min-height: 44px;
  }
}

/* 键盘焦点统一增加可见轮廓 */
.bw-feedback__close:focus-visible,
.bw-feedback__option:focus-visible,
.bw-feedback__submit:focus-visible,
.bw-feedback__dismiss:focus-visible,
.bw-feedback__privacy:focus-visible {
  outline: 2px solid #5D2E57;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bw-feedback {
    transition: none;
  }
}
