/* ============================================================
   客服系统 - 右侧悬浮按钮 + 弹窗
   ============================================================ */

/* ============================================================
   可折叠微信二维码侧边栏
   ============================================================ */

/* ===== 外层容器 ===== */
.chat-widget {
  position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px;
}

/* ===== 展开的二维码卡片面板 ===== */
.chat-widget-panel {
  width: 240px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  overflow: hidden;
  transition: all .35s cubic-bezier(.4,0,.2,1);
  transform-origin: top right;
}
.chat-widget-panel.collapsed {
  width: 0;
  opacity: 0;
  pointer-events: none;
  margin-bottom: 0;
}
.chat-widget-panel-inner {
  padding: 20px 18px 16px;
  display: flex; flex-direction: column; align-items: center;
}

/* 标题栏 */
.chat-widget-title {
  width: 100%;
  display: flex; align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #07c160;
  font-size: 15px;
  font-weight: 600;
}
.chat-widget-title span {
  flex: 1;
}
.chat-widget-fold {
  width: 28px; height: 28px;
  border: none; background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #999;
  transition: all .2s;
}
.chat-widget-fold:hover {
  background: #e8e8e8;
  color: #555;
}

/* 二维码 */
.chat-widget-qr {
  width: 170px; height: 170px;
  background: #f9f9f9;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #f0f0f0;
  overflow: hidden;
  margin-bottom: 12px;
}
.chat-widget-qr img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.chat-widget-qr-placeholder {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #bbb;
  font-size: 12px;
}

/* 微信号 */
.chat-widget-wechat-info {
  display: flex; align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px 14px;
  background: #f5f5f5;
  border-radius: 8px;
  width: 100%;
  justify-content: center;
}
.chat-widget-wechat-label {
  font-size: 12px; color: #999;
}
.chat-widget-wechat-num {
  font-size: 14px; font-weight: 600;
  color: #333;
  user-select: all;
}

/* 电话 */
.chat-widget-phone {
  display: flex; align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  background: #f0f7ff;
  border-radius: 8px;
  text-decoration: none;
  color: #3388ff;
  font-size: 15px;
  font-weight: 600;
  transition: background .2s;
}
.chat-widget-phone:hover {
  background: #e0efff;
}

/* 在线咨询按钮 */
.chat-widget-consult-btn {
  display: flex; align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.chat-widget-consult-btn:hover {
  background: #06ad56;
}

/* 工作时间 */
.chat-widget-worktime {
  font-size: 11px;
  color: #bbb;
}

/* ===== 折叠小按钮（面板收起时显示） ===== */
.chat-widget-toggle {
  width: 56px;
  padding: 10px 6px 8px;
  border: none;
  cursor: pointer;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #07c160;
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(7,193,96,.35);
  font-size: 11px;
  transition: all .2s;
  font-weight: 500;
  /* 面板收起后独立居中 */
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.chat-widget-toggle.show {
  display: flex;
}
.chat-widget-toggle:hover {
  background: #06ad56;
  transform: translateY(-50%) scale(1.05);
}

/* ===== 返回顶部按钮 ===== */
.chat-back-top {
  width: 40px; height: 40px;
  border: none; cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  background: #fff;
  color: #999;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  transition: all .2s;
}
.chat-back-top.show {
  display: flex;
}
.chat-back-top:hover {
  color: #555;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  transform: translateY(-2px);
}

/* ===== 弹窗（模态框） ===== */
.chat-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 10000; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.chat-modal.show { display: flex; }
.chat-modal-dialog {
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow: auto;
  animation: chatModalIn .25s ease;
}
@keyframes chatModalIn {
  from { transform: scale(.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.chat-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.chat-modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.chat-modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-soft); border: none; cursor: pointer;
  font-size: 16px; color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
}
.chat-modal-close:hover { background: var(--border); }
.chat-modal-body { padding: 24px; }

/* ===== 预约表单 ===== */
.appoint-form .form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 12px;
}
.appoint-form .form-group { margin-bottom: 12px; }
.appoint-form .form-group.full { grid-column: 1 / -1; }
.appoint-form label {
  display: block; font-size: 13px; color: var(--text-soft);
  margin-bottom: 6px;
}
.appoint-form .required { color: #ff3a3a; }
.appoint-form input,
.appoint-form select,
.appoint-form textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text);
  background: #fff; transition: border-color .2s;
}
.appoint-form input:focus,
.appoint-form select:focus,
.appoint-form textarea:focus {
  outline: none; border-color: var(--brand-6);
  box-shadow: 0 0 0 3px var(--brand-1);
}
.appoint-form textarea { min-height: 80px; resize: vertical; }
.appoint-form .submit {
  width: 100%; padding: 12px; margin-top: 12px;
  background: var(--cta); color: #4c4c4c;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.appoint-form .submit:hover { background: var(--cta-hover); }
.appoint-form .tip {
  font-size: 12px; color: var(--text-mute);
  text-align: center; margin-top: 10px;
}
.appoint-form .step-title {
  font-size: 14px; font-weight: 500; color: var(--text);
  margin: 16px 0 10px;
}
.appoint-form .radio-group {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.appoint-form .radio-option {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-align: center;
  font-size: 13px; background: #fff; transition: all .2s;
}
.appoint-form .radio-option:hover { border-color: var(--brand-5); }
.appoint-form .radio-option.selected {
  background: var(--brand-1); border-color: var(--brand-6);
  color: var(--brand-8); font-weight: 500;
}
.appoint-form .counter {
  text-align: center; font-size: 12px; color: var(--text-mute);
  margin-bottom: 12px; padding: 8px; background: var(--bg-soft); border-radius: var(--radius);
}
.appoint-form .counter strong { color: var(--brand-6); font-size: 14px; }
.appoint-form .success-msg {
  text-align: center; padding: 30px 0;
}
.appoint-form .success-msg .icon {
  font-size: 48px; color: #4caf50; margin-bottom: 12px;
}
.appoint-form .success-msg h4 {
  font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px;
}
.appoint-form .success-msg p { color: var(--text-soft); font-size: 14px; }

/* ===== 免费回电弹窗（优化布局） ===== */
.callback-dialog {
  max-width: 440px !important;
}
.callback-body {
  padding: 0 24px 24px !important;
}
.callback-top {
  text-align: center;
  padding: 24px 0 20px;
}
.callback-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 2px solid var(--brand-1);
}
.callback-tip {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.callback-phone {
  display: inline-block;
  font-size: 28px; font-weight: 700;
  color: var(--brand-6);
  text-decoration: none;
  letter-spacing: 1px;
}
.callback-phone:hover { color: var(--brand-8); }
.callback-time {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 6px;
}
.callback-divider {
  display: flex; align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  font-size: 13px; color: var(--text-mute);
}
.callback-divider::before,
.callback-divider::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--border);
}
.callback-divider span { white-space: nowrap; }

.callback-form .form-row-inline {
  display: flex; align-items: center;
  margin-bottom: 14px;
}
.callback-form .form-row-inline label {
  width: 80px; flex-shrink: 0;
  font-size: 14px; color: var(--text);
  text-align: right;
  margin-right: 12px;
}
.callback-form .form-row-inline label .required {
  color: #ff3a3a;
}
.callback-form .form-row-inline input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; color: var(--text);
  background: #fff;
}
.callback-form .form-row-inline input:focus {
  outline: none;
  border-color: var(--brand-6);
}
.callback-form .phone-input-row {
  flex: 1;
  display: flex; align-items: center;
  gap: 0;
}
.callback-form .phone-prefix {
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 14px; color: var(--text);
  white-space: nowrap;
}
.callback-form .phone-input-row input {
  flex: 1;
  border-radius: 0 var(--radius) var(--radius) 0 !important;
}
.callback-form .form-row-block {
  margin-bottom: 14px;
}
.callback-form .form-row-block label {
  display: block;
  font-size: 14px; color: var(--text);
  margin-bottom: 6px;
  text-align: right;
  width: 92px;
}
.callback-form .form-row-block textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; color: var(--text);
  resize: vertical;
  min-height: 70px;
}
.callback-form .form-row-block textarea:focus {
  outline: none;
  border-color: var(--brand-6);
}
.callback-submit {
  display: block;
  width: 100%;
  padding: 12px;
  background: #f5a623;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  letter-spacing: 1px;
}
.callback-submit:hover { background: #e8960a; }

/* ===== 微信弹窗（优化布局） ===== */
.wechat-dialog {
  max-width: 380px !important;
}
.wechat-body {
  padding: 24px !important;
  text-align: center;
}
.wechat-qr-wrap {
  width: 160px; height: 160px;
  margin: 0 auto 20px;
  background: #f9f9f9;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #eee;
  overflow: hidden;
}
.wechat-qr-img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.wechat-qr-placeholder {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-mute);
  font-size: 12px;
}
.wechat-info { text-align: center; }
.wechat-label {
  font-size: 13px; color: var(--text-soft);
  margin-bottom: 8px;
}
.wechat-number-box {
  display: flex; align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wechat-number {
  font-size: 16px; font-weight: 600;
  color: var(--text);
  background: #f5f5f5;
  padding: 8px 16px;
  border-radius: 8px;
}
.wechat-copy-btn {
  padding: 8px 16px;
  background: var(--brand-6);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.wechat-copy-btn:hover { background: var(--brand-8); }
.wechat-copy-btn.copied { background: #4caf50; }
.wechat-desc {
  font-size: 12px; color: var(--text-mute);
  line-height: 1.6;
}

/* ===== 旧样式兼容 ===== */
.callback-form .time-tip {
  background: var(--bg-soft); padding: 10px 14px;
  border-radius: var(--radius); font-size: 12px;
  color: var(--text-soft); margin-bottom: 16px; text-align: center;
}
.callback-form .phone-input {
  display: flex; align-items: center; gap: 8px;
}
.callback-form .phone-input .prefix {
  padding: 10px 12px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); white-space: nowrap;
}

/* ===== 在线咨询聊天 ===== */
.chat-room {
  height: 360px; display: flex; flex-direction: column;
  background: var(--bg-soft); border-radius: var(--radius);
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  max-width: 75%; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.chat-msg.from-server {
  align-self: flex-start; background: #fff;
  border-top-left-radius: 2px;
}
.chat-msg.from-server::before {
  content: '客服小腾'; display: block;
  font-size: 11px; color: var(--brand-6); margin-bottom: 2px; font-weight: 500;
}
.chat-msg.from-user {
  align-self: flex-end; background: var(--brand-6);
  color: #fff; border-top-right-radius: 2px;
}
.chat-msg.from-user::before {
  content: '我'; display: block;
  font-size: 11px; color: rgba(255,255,255,.7); margin-bottom: 2px; font-weight: 500;
  text-align: right;
}
.chat-input-bar {
  display: flex; gap: 8px; padding: 10px;
  background: #fff; border-top: 1px solid var(--border);
}
.chat-input-bar input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 18px;
  font-size: 13px;
}
.chat-input-bar input:focus { outline: none; border-color: var(--brand-6); }
.chat-input-bar button {
  padding: 0 18px; background: var(--brand-6); color: #fff;
  border: none; border-radius: 18px; cursor: pointer; font-size: 13px;
}
.chat-input-bar button:hover { background: var(--brand-8); }

@media (max-width: 480px) {
  .chat-widget { right: 8px; gap: 6px; }
  .chat-widget-panel { width: 220px; }
  .chat-widget-panel-inner { padding: 16px 14px 12px; }
  .chat-widget-qr { width: 150px; height: 150px; }
  .chat-widget-toggle { width: 48px; font-size: 10px; padding: 8px 4px 6px; }
  .chat-back-top { width: 36px; height: 36px; }
  .appoint-form .form-row { grid-template-columns: 1fr; }
  .appoint-form .radio-group { grid-template-columns: 1fr; }
}
