/* ============================================
 * Feedback Widget (ADR-0011 + ADR-0012 모바일 반응형)
 * 우하단 fixed launcher + 모달 폼
 * OKLCH 토큰 / 모션 ≤200ms / prefers-reduced-motion 존중 / 모바일 ≥ 44px 히트 타깃
 * ============================================ */

.feedback-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent-deep);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 4px 16px oklch(20% 0.01 60 / 0.18);
  transition: transform 150ms cubic-bezier(0.2, 0, 0, 1),
              box-shadow 150ms cubic-bezier(0.2, 0, 0, 1);
}
.feedback-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px oklch(20% 0.01 60 / 0.25);
}
.feedback-launcher:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}
.feedback-launcher-icon {
  /* Unit 4 (dev-14, ADR-0017): Lucide SVG 호환 — font-size 대신 width/height */
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.feedback-launcher-text {
  letter-spacing: -0.005em;
}

.feedback-modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.01 60 / 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: feedback-fade-in 180ms cubic-bezier(0.2, 0, 0, 1);
}

@keyframes feedback-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.feedback-modal {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg, 14px);
  padding: 28px 24px 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 40px oklch(20% 0.01 60 / 0.25);
}

.feedback-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  font-size: 18px;
  color: var(--ink-mute);
  cursor: pointer;
  border-radius: 6px;
  transition: background 150ms cubic-bezier(0.2, 0, 0, 1),
              color 150ms cubic-bezier(0.2, 0, 0, 1);
}
.feedback-close:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.feedback-close:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

.feedback-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: -0.01em;
  word-break: keep-all;
  line-height: 1.4;
}
.feedback-desc {
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0 0 20px;
  line-height: 1.6;
  word-break: keep-all;
}

.feedback-types {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
}
.feedback-legend {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 0;
  margin-bottom: 8px;
}
.feedback-types-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.feedback-type-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  min-height: 36px;
  transition: background 150ms cubic-bezier(0.2, 0, 0, 1),
              border-color 150ms cubic-bezier(0.2, 0, 0, 1);
}
.feedback-type-option:hover {
  background: var(--paper-2);
}
.feedback-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.feedback-type-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.feedback-type-icon {
  /* Unit 4 (dev-14, ADR-0017): Lucide SVG 호환 */
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.feedback-field {
  display: block;
  margin-bottom: 14px;
}
.feedback-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.feedback-required {
  color: var(--accent);
  margin-left: 2px;
}
.feedback-optional {
  color: var(--ink-mute);
  font-weight: 400;
  font-size: 12px;
}

.feedback-textarea,
.feedback-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md, 10px);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 150ms cubic-bezier(0.2, 0, 0, 1),
              box-shadow 150ms cubic-bezier(0.2, 0, 0, 1);
}
.feedback-textarea {
  min-height: 100px;
  resize: vertical;
}
.feedback-textarea:focus,
.feedback-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.feedback-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.feedback-error {
  /* WCAG AA 4.5:1 — oklch(43%) ≈ 5.5:1 vs --card 배경 (H-D 권고, ADR-0013) */
  color: oklch(43% 0.18 28);
  font-size: 13px;
  margin: 8px 0 12px;
  padding: 8px 12px;
  background: oklch(43% 0.18 28 / 0.08);
  border-radius: 6px;
  border-left: 3px solid oklch(43% 0.18 28);
  word-break: keep-all;
}

.feedback-submit {
  width: 100%;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: var(--radius-md, 10px);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background 150ms cubic-bezier(0.2, 0, 0, 1);
}
.feedback-submit:hover:not(:disabled) {
  background: var(--accent-deep);
}
.feedback-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.feedback-submit:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

.feedback-success {
  padding: 24px 12px;
  text-align: center;
}
.feedback-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 24px;
  font-weight: 700;
}
.feedback-success-text {
  font-size: 16px;
  color: var(--ink);
  margin: 0 0 4px;
  font-weight: 500;
}
.feedback-success-sub {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0;
}

/* ============================================
 * 모바일 반응형 (ADR-0012)
 * iOS auto-zoom 방지: input/textarea 16px (mobile 한정)
 * 히트 타깃: button/touch target ≥ 44px (WCAG 2.5.5)
 * launcher: 작은 화면에서 패딩 축소
 * modal: 작은 화면에서 bottom sheet 스타일
 * ============================================ */
@media (max-width: 640px) {
  .feedback-launcher {
    right: 14px;
    bottom: 14px;
    padding: 12px 16px;
  }
  .feedback-modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .feedback-modal {
    max-width: 100%;
    max-height: 92vh;
    padding: 24px 18px 20px;
    border-radius: 14px 14px 0 0;
  }
  .feedback-close {
    width: 44px;
    height: 44px;
    top: 8px;
    right: 8px;
  }
  .feedback-title {
    font-size: 18px;
  }
  .feedback-desc {
    font-size: 13px;
    margin-bottom: 16px;
  }
  .feedback-types-row {
    gap: 6px;
  }
  .feedback-type-option {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 44px;
    font-size: 13px;
  }
  /* iOS auto-zoom 방지: input·textarea 16px+ */
  .feedback-textarea,
  .feedback-input {
    font-size: 16px;
    padding: 12px;
  }
  .feedback-submit {
    padding: 14px 16px;
    font-size: 15px;
    min-height: 48px;
  }
}

/* 안전 영역 (iOS 노치 / 홈 인디케이터) */
@supports (padding: max(0px)) {
  .feedback-launcher {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
  }
  @media (max-width: 640px) {
    .feedback-launcher {
      right: max(14px, env(safe-area-inset-right));
      bottom: max(14px, env(safe-area-inset-bottom));
    }
    .feedback-modal {
      padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
  }
}

/* Reduced motion: 모든 transition·animation 제거 */
@media (prefers-reduced-motion: reduce) {
  .feedback-launcher,
  .feedback-modal-backdrop,
  .feedback-close,
  .feedback-type-option,
  .feedback-textarea,
  .feedback-input,
  .feedback-submit {
    transition: none !important;
    animation: none !important;
  }
}
