/*
 * survey_widget.css —— 滿意度調查系統前端元件（任務#138新增）。
 *
 * 與既有「意見回饋」浮鈕（feedback_widget.js/app.css 的 .feedback-fab）
 * 互補但視覺獨立：本檔案自成一套 `.sv-survey-*` 命名空間，避免與既有
 * `.survey-*`/`.feedback-*` 類別衝突（`grep` 過全站無同名前綴）。沿用
 * app.css :root 的設計代幣（--card-bg／--border-strong／--brand-cyan／
 * --radius／--shadow-pop／--ease 等），維持全站視覺一致，但元件本身的
 * class 定義都在這個新檔，不依賴 app.css 既有元件 class（例如不重用
 * .text-input／.btn-save，因為調查卡片的互動節奏與既有表單不同——本檔
 * 要的是「一眼看懂、兩次點擊完成」的輕量感，不是標準表單樣式）。
 *
 * 品牌質感：深色系（沿用全站 --card-bg/--bg-0），青色 accent（--brand-cyan
 * #00d4ff，比 --accent 的藍更貼近規格「青色」要求）。
 */

.sv-survey-csat,
.sv-survey-nps {
  position: fixed;
  z-index: 400; /* 高於一般卡片、低於停權全頁遮罩(999999)與強制彈窗 */
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
}

/* ---------------- CSAT：右下角輕量卡 ---------------- */

.sv-survey-csat {
  right: 20px;
  bottom: 20px;
  width: 320px;
  max-width: calc(100vw - 28px);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  animation: sv-slide-up 260ms var(--ease);
}

.sv-survey-csat.sv-survey-leaving {
  animation: sv-fade-out 220ms var(--ease) forwards;
}

.sv-survey-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 26px 10px 0;
}

.sv-survey-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}

.sv-survey-close:hover {
  background: rgba(var(--surface-tint-rgb), 0.08);
  color: var(--text);
}

.sv-stars {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.sv-star {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  padding: 2px;
  color: var(--text-faint);
  transition: color 120ms var(--ease), transform 120ms var(--ease);
}

.sv-star:hover {
  transform: scale(1.12);
}

.sv-star.sv-star-filled {
  color: var(--brand-cyan-text);
  text-shadow: 0 0 10px rgba(var(--brand-cyan-rgb), 0.35);
}

.sv-comment-input {
  width: 100%;
  resize: none;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 10px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.sv-comment-input:focus {
  outline: none;
  border-color: var(--brand-cyan);
}

.sv-comment-counter {
  font-size: 10.5px;
  color: var(--text-faint);
  text-align: right;
  margin: -6px 0 8px;
}

.sv-survey-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sv-survey-status {
  font-size: 11px;
  color: var(--warn-fg);
  margin-right: auto;
}

.sv-survey-status:empty {
  display: none;
}

.sv-btn-submit {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand-cyan);
  color: var(--on-brand);
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 16px;
  cursor: pointer;
  transition: filter 150ms var(--ease), transform 150ms var(--ease);
}

.sv-btn-submit:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.sv-btn-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sv-btn-ghost {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 150ms var(--ease), border-color 150ms var(--ease);
}

.sv-btn-ghost:hover {
  color: var(--text);
  border-color: var(--brand-cyan);
}

.sv-survey-privacy {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 10px;
}

.sv-survey-thanks {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  animation: sv-pop-in 260ms var(--ease);
}

.sv-survey-thanks-icon {
  font-size: 22px;
  color: var(--brand-cyan-text);
}

/* ---------------- NPS：底部滑入條 ---------------- */

.sv-survey-nps {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 22px 16px;
  animation: sv-slide-up-full 300ms var(--ease);
}

.sv-survey-nps.sv-survey-leaving {
  animation: sv-slide-down-full 220ms var(--ease) forwards;
}

.sv-survey-nps-inner {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}

.sv-nps-scale {
  display: flex;
  gap: 6px;
  margin: 12px 0 6px;
  flex-wrap: wrap;
}

.sv-nps-btn {
  flex: 1 1 auto;
  min-width: 30px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms var(--ease), background 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}

.sv-nps-btn:hover {
  border-color: var(--brand-cyan);
  color: var(--text);
  transform: translateY(-1px);
}

.sv-nps-btn.sv-nps-selected {
  background: var(--brand-cyan);
  border-color: var(--brand-cyan);
  color: var(--on-brand);
}

.sv-nps-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.sv-nps-followup {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  animation: sv-fade-in-up 220ms var(--ease);
}

.sv-nps-followup-question {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
}

.sv-survey-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

@keyframes sv-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sv-slide-up-full {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sv-slide-down-full {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(100%); }
}

@keyframes sv-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}

@keyframes sv-fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sv-pop-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .sv-survey-csat,
  .sv-survey-nps,
  .sv-nps-followup,
  .sv-survey-thanks {
    animation: none !important;
  }
}

@media (max-width: 767px) {
  .sv-survey-csat {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-width: none;
  }

  .sv-survey-nps {
    padding: 14px 14px 16px;
  }

  .sv-nps-btn {
    min-width: 26px;
    height: 32px;
    font-size: 12px;
  }

  .sv-survey-footer-actions {
    justify-content: center;
  }
}
