/* ============================================================
 * 在线客服浮窗样式 · 沿用官网 navy/blue/gold 配色
 * 被 chat/widget.blade.php 通过 <link> 引入
 * ============================================================ */

.cx-chat-root {
  position: fixed; z-index: 9999; right: 22px; bottom: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
.cx-chat-fab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 20px 13px 14px; border-radius: 999px;
  background: linear-gradient(135deg, #0f2d4f, #1e6bb8);
  color: #fff; font-weight: 800; font-size: 15px; cursor: pointer;
  box-shadow: 0 18px 36px rgba(15, 45, 79, .28);
  border: none; min-height: 48px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.cx-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 22px 44px rgba(15, 45, 79, .34); }
.cx-chat-fab .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #c99a3a, #d9ad54); color: #152238; font-size: 18px; }
.cx-chat-fab .dot { width: 8px; height: 8px; border-radius: 50%; background: #43c878; box-shadow: 0 0 0 3px rgba(67, 200, 120, .25); }
.cx-chat-fab .dot.off { background: #98a2b3; box-shadow: 0 0 0 3px rgba(152, 162, 179, .25); }
.cx-chat-fab .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 12px; display: inline-grid; place-items: center; margin-left: 2px; }

.cx-chat-panel {
  position: absolute; right: 0; bottom: 72px;
  width: 360px; max-width: calc(100vw - 28px);
  height: 520px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 18px;
  box-shadow: 0 30px 70px rgba(15, 45, 79, .28);
  display: none; flex-direction: column; overflow: hidden;
  border: 1px solid rgba(229, 234, 240, .9);
}
.cx-chat-panel.open { display: flex; }
.cx-chat-head {
  padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #0f2d4f, #1e6bb8);
  display: flex; align-items: center; gap: 10px;
}
.cx-chat-head .avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #c99a3a, #d9ad54); color: #152238; font-weight: 900; }
.cx-chat-head .ttl b { display: block; font-size: 15px; line-height: 1.2; }
.cx-chat-head .ttl small { color: rgba(255, 255, 255, .78); font-size: 12px; }
.cx-chat-head .close {
  margin-left: auto; background: rgba(255, 255, 255, .14);
  border: none; color: #fff; width: 40px; height: 40px;
  border-radius: 10px; cursor: pointer; font-size: 18px;
  transition: background .15s ease;
}
.cx-chat-head .close:hover { background: rgba(255, 255, 255, .24); }
.cx-chat-head .close:focus-visible { outline: 2px solid #c99a3a; outline-offset: 2px; }

.cx-chat-body { flex: 1; overflow-y: auto; padding: 16px; background: #f5f8fb; }
.cx-chat-body::-webkit-scrollbar { width: 6px; }
.cx-chat-body::-webkit-scrollbar-thumb { background: #c2ccd9; border-radius: 3px; }
.cx-msg { display: flex; margin-bottom: 12px; gap: 8px; }
.cx-msg .b { max-width: 78%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.cx-msg.guest { justify-content: flex-end; }
.cx-msg.guest .b { background: linear-gradient(135deg, #1e6bb8, #2f7fc9); color: #fff; border-bottom-right-radius: 4px; }
.cx-msg.admin .b, .cx-msg.system .b { background: #fff; color: #1f2937; border: 1px solid #e5eaf0; border-bottom-left-radius: 4px; }
.cx-msg.system .b { background: #fff7e8; border-color: #f3e2bd; color: #8a6a1f; font-size: 13px; }
.cx-msg .time { font-size: 11px; color: #98a2b3; align-self: flex-end; padding-bottom: 2px; }
.cx-chat-empty { text-align: center; color: #475467; font-size: 13px; padding: 30px 0; }
.cx-chat-error { text-align: center; color: #b42318; font-size: 13px; padding: 8px 10px; margin: 6px 0 0; background: #fdeeec; border: 1px solid #f5c6c0; border-radius: 10px; display: none; }
.cx-chat-error.show { display: block; }

.cx-chat-form { padding: 10px 12px; border-top: 1px solid #e5eaf0; background: #fff; }
#cxChatRoot .cx-chat-form textarea {
  width: 100%; min-height: 44px; max-height: 90px; resize: none;
  border: 1px solid #e5eaf0; border-radius: 12px; padding: 10px 12px;
  font: inherit; font-size: 14px; outline: none; box-sizing: border-box;
  background: #fff; color: #1f2937;
}
#cxChatRoot .cx-chat-form textarea:focus { border-color: #1e6bb8; background: #fff; }
#cxChatRoot .cx-chat-form textarea::placeholder { color: #98a2b3; }
.cx-chat-form .row { display: flex; gap: 8px; margin-top: 8px; }
.cx-chat-form .meta { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
#cxChatRoot .cx-chat-form .meta input {
  flex: 1 1 30%; width: auto; min-width: 0;
  border: 1px solid #e5eaf0; border-radius: 9px; padding: 8px 10px;
  font: inherit; font-size: 13px; outline: none;
  background: #fff; color: #1f2937; box-sizing: border-box;
}
#cxChatRoot .cx-chat-form .meta input:focus { border-color: #1e6bb8; background: #fff; }
#cxChatRoot .cx-chat-form .meta input::placeholder { color: #98a2b3; }
.cx-chat-form .send {
  background: linear-gradient(135deg, #c99a3a, #dfb45a); color: #152238;
  border: none; padding: 0 18px; border-radius: 10px; font-weight: 800; cursor: pointer; font-size: 14px;
  min-height: 40px;
}
.cx-chat-form .send:disabled { opacity: .6; cursor: not-allowed; }
.cx-chat-hint { font-size: 11px; color: #667085; margin-top: 6px; }

.cx-chat-end { text-align: center; padding: 8px 0 2px; }
.cx-chat-end button { background: none; border: none; color: #98a2b3; font-size: 12px; cursor: pointer; text-decoration: underline; }
.cx-chat-end button.restart { color: #1e6bb8; font-weight: 700; margin-left: 8px; }

@media (max-width: 560px) {
  .cx-chat-root { right: 12px; bottom: 12px; }
  .cx-chat-panel { width: calc(100vw - 24px); height: calc(100vh - 96px); bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-chat-fab, .cx-chat-head .close, input, textarea { transition: none !important; }
  .cx-chat-fab:hover { transform: none !important; }
}
#cxChatRoot input:focus-visible,
#cxChatRoot textarea:focus-visible,
#cxChatRoot button:focus-visible {
  outline: 2px solid #c99a3a; outline-offset: 2px;
}
