/* ===== ShiftCare 線上客服小視窗 ===== */
.scw-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  height: 56px;
  border-radius: 999px;
  padding: 0 22px 0 18px;
  background: linear-gradient(135deg, var(--primary, #1A3B6B), var(--primary-light, #2A5298));
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(26, 59, 107, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  z-index: 9998;
  transition: transform .2s, box-shadow .2s;
  font-family: 'Noto Sans TC', 'Inter', sans-serif;
}
.scw-btn:hover { transform: scale(1.05); box-shadow: 0 10px 28px rgba(26,59,107,0.45); }
.scw-btn svg { width: 24px; height: 24px; flex: none; }
.scw-btn-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}
/* 呼吸光暈：載入後跑幾輪吸引視線，之後停止 */
.scw-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  animation: scwPulse 2.2s ease-out 5;
  pointer-events: none;
}
@keyframes scwPulse {
  0%   { box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.55); }
  70%  { box-shadow: 0 0 0 14px rgba(78, 205, 196, 0); }
  100% { box-shadow: 0 0 0 0 rgba(78, 205, 196, 0); }
}

/* 首訪招呼泡泡 */
.scw-teaser {
  position: fixed;
  right: 24px;
  bottom: 92px;
  max-width: 250px;
  background: #fff;
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 14px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
  padding: 13px 34px 13px 15px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text, #1A1A2E);
  cursor: pointer;
  z-index: 9998;
  font-family: 'Noto Sans TC', 'Inter', sans-serif;
  animation: scwSlideUp .3s ease;
}
.scw-teaser-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--text-light, #9CA3AF);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.scw-teaser-close:hover { background: var(--bg-alt, #F0F4F8); color: var(--text, #1A1A2E); }
.scw-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--cta, #FF6B35);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scw-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 130px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Noto Sans TC', 'Inter', sans-serif;
}
.scw-panel.open { display: flex; animation: scwSlideUp .25s ease; }
@keyframes scwSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.scw-header {
  background: linear-gradient(135deg, var(--primary, #1A3B6B), var(--primary-light, #2A5298));
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.scw-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.scw-header-avatar svg { width: 20px; height: 20px; }
.scw-header-info { flex: 1; min-width: 0; }
.scw-header-title { font-size: 15px; font-weight: 700; }
.scw-header-sub { font-size: 11.5px; opacity: .85; margin-top: 1px; display: flex; align-items: center; gap: 5px; }
.scw-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; display: inline-block; }
.scw-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  opacity: .85;
}
.scw-close:hover { background: rgba(255,255,255,0.15); opacity: 1; }
.scw-close svg { width: 18px; height: 18px; }

.scw-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: #F5F7FA;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scw-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.scw-msg.bot, .scw-msg.agent {
  align-self: flex-start;
  background: #fff;
  color: var(--text, #1A1A2E);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.scw-msg.agent { border-left: 3px solid var(--accent, #4ECDC4); }
.scw-msg.visitor {
  align-self: flex-end;
  background: var(--primary, #1A3B6B);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.scw-msg-meta {
  font-size: 10.5px;
  color: var(--text-light, #9CA3AF);
  margin: -4px 0 0 4px;
}
.scw-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.scw-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #C3CAD4;
  animation: scwBlink 1.2s infinite;
}
.scw-typing span:nth-child(2) { animation-delay: .2s; }
.scw-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes scwBlink { 0%,80%,100% { opacity: .3 } 40% { opacity: 1 } }

.scw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 2px 0;
}
.scw-chip {
  border: 1px solid var(--primary, #1A3B6B);
  color: var(--primary, #1A3B6B);
  background: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.scw-chip:hover { background: var(--primary, #1A3B6B); color: #fff; }
.scw-chip.scw-chip-cta {
  border-color: var(--cta, #FF6B35);
  color: var(--cta, #FF6B35);
}
.scw-chip.scw-chip-cta:hover { background: var(--cta, #FF6B35); color: #fff; }

.scw-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--border, #E5E7EB);
}
.scw-input {
  flex: 1;
  min-width: 0; /* Firefox：textarea 有內建最小寬度，flex 下不設會把送出鈕擠出面板 */
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 90px;
  line-height: 1.5;
}
.scw-input:focus { border-color: var(--primary, #1A3B6B); }
.scw-send {
  border: none;
  background: var(--primary, #1A3B6B);
  color: #fff;
  border-radius: 10px;
  width: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: background .15s;
}
.scw-send:hover { background: var(--primary-light, #2A5298); }
.scw-send:disabled { background: #C3CAD4; cursor: default; }
.scw-send svg { width: 18px; height: 18px; }

.scw-note {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-light, #9CA3AF);
  padding: 0 12px 8px;
  background: #fff;
}

@media (max-width: 480px) {
  .scw-btn { right: 16px; bottom: 16px; height: 50px; padding: 0 18px 0 15px; }
  .scw-btn-label { font-size: 14px; }
  .scw-teaser { right: 16px; bottom: 78px; max-width: calc(100vw - 90px); }
  .scw-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 78vh;
    max-height: 78vh;
    border-radius: 16px 16px 0 0;
  }
}
