/* ============================================================
   Customer System Popup — standalone styles
   Original icon visual style preserved (same 62px blue circle with support_agent icon)
   All other chat UI is rebuilt from scratch with .cs- prefix
   ============================================================ */

/* hide the original Vue float_cs_btn (no modification to Vue source) */
[data-v-80b9017e].float_cs_btn,
.float_cs_btn[data-v-80b9017e] {
  display: none !important;
}

/* ---- Floating Button (exact same visual as original) ---- */
.cs-float-btn {
  position: fixed;
  left: 20px;
  top: 50%;
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #0062e9;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: left 0.2s ease, top 0.2s ease, transform 0.15s ease;
}
.cs-float-btn:active {
  transform: scale(0.92);
}
.cs-float-btn.is-dragging {
  transition: none !important;
  cursor: grabbing;
}
.cs-float-btn .material-icons {
  color: #fff;
  font-size: 28px;
  line-height: 1;
}
/* tiny pulse ring */
.cs-float-btn::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(0, 98, 233, 0.45);
  pointer-events: none;
  animation: cs-pulse 2.4s ease-out infinite;
}
@keyframes cs-pulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(1.25); opacity: 0;   }
  100% { transform: scale(1.25); opacity: 0;   }
}

/* ---- Overlay & Popup container ---- */
.cs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 20, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.cs-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cs-popup {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0d1b34 0%, #071226 100%);
  border: 1px solid rgba(86, 202, 254, 0.18);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  z-index: 100000;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform: translateY(40px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.25s ease;
}
.cs-popup.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ---- Chat header ---- */
.cs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 98, 233, 0.22), rgba(0, 98, 233, 0));
  border-bottom: 1px solid rgba(86, 202, 254, 0.14);
  flex-shrink: 0;
}
.cs-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cs-header-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #0062e9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-header-icon .material-icons {
  color: #fff;
  font-size: 18px;
}
.cs-title {
  color: #e5f2ff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.cs-title-sub {
  color: rgba(180, 210, 250, 0.55);
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
}
.cs-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b8d8ff;
  background: rgba(86, 202, 254, 0.08);
  border: 1px solid rgba(86, 202, 254, 0.18);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.cs-close:hover {
  background: rgba(86, 202, 254, 0.18);
}
.cs-close:active {
  transform: scale(0.92);
}
.cs-close .material-icons {
  font-size: 18px;
}

/* ---- Messages area ---- */
.cs-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.cs-msgs::-webkit-scrollbar { width: 5px; }
.cs-msgs::-webkit-scrollbar-track { background: transparent; }
.cs-msgs::-webkit-scrollbar-thumb { background: rgba(86,202,254,0.2); border-radius: 4px; }

/* ---- Single message ---- */
.cs-msg {
  display: flex;
  max-width: 82%;
  animation: cs-msg-in 0.2s ease;
}
@keyframes cs-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cs-msg-self {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.cs-msg-other {
  align-self: flex-start;
}
.cs-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(86, 202, 254, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}
.cs-msg-avatar .material-icons {
  color: #56cafe;
  font-size: 16px;
}
.cs-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.cs-msg-self .cs-msg-bubble {
  background: linear-gradient(135deg, #0062e9, #56cafe);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cs-msg-other .cs-msg-bubble {
  background: rgba(255, 255, 255, 0.07);
  color: #e5f0ff;
  border-bottom-left-radius: 4px;
}
.cs-msg-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: pointer;
  display: block;
}
.cs-msg-time {
  font-size: 10px;
  color: rgba(200, 220, 250, 0.4);
  margin-top: 4px;
}
.cs-msg-self .cs-msg-time { text-align: right; }
.cs-msg-other .cs-msg-time { text-align: left; }

/* ---- Typing indicator ---- */
.cs-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.cs-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(200, 220, 250, 0.55);
  animation: cs-typing-dot 1.2s infinite;
}
.cs-typing span:nth-child(2) { animation-delay: 0.15s; }
.cs-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cs-typing-dot {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---- Welcome card inside chat ---- */
.cs-welcome {
  background: rgba(0, 98, 233, 0.08);
  border: 1px solid rgba(86, 202, 254, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.cs-welcome-title {
  color: #e5f2ff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.cs-welcome-text {
  color: rgba(200, 220, 250, 0.65);
  font-size: 12px;
  line-height: 1.6;
}

/* ---- Quick reply buttons ---- */
.cs-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.cs-quick-btn {
  background: rgba(86, 202, 254, 0.1);
  color: #b8d8ff;
  border: 1px solid rgba(86, 202, 254, 0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cs-quick-btn:hover {
  background: rgba(86, 202, 254, 0.22);
  border-color: rgba(86, 202, 254, 0.4);
}

/* ---- Input area ---- */
.cs-input-area {
  padding: 12px 14px;
  border-top: 1px solid rgba(86, 202, 254, 0.1);
  background: rgba(5, 12, 28, 0.6);
  flex-shrink: 0;
}
.cs-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.cs-textarea {
  flex: 1;
  min-height: 40px;
  max-height: 100px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(86, 202, 254, 0.18);
  border-radius: 20px;
  padding: 10px 16px;
  color: #e5f0ff;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
}
.cs-textarea::placeholder {
  color: rgba(200, 220, 250, 0.4);
}
.cs-textarea:focus {
  border-color: rgba(86, 202, 254, 0.4);
  background: rgba(255, 255, 255, 0.09);
}
.cs-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0062e9, #56cafe);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  transition: transform 0.15s, opacity 0.15s;
}
.cs-send-btn:active { transform: scale(0.92); }
.cs-send-btn:disabled  { opacity: 0.5; cursor: default; }
.cs-send-btn .material-icons {
  color: #fff;
  font-size: 20px;
}
.cs-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.cs-tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(86, 202, 254, 0.08);
  border: 1px solid rgba(86, 202, 254, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.cs-tool-btn:hover {
  background: rgba(86, 202, 254, 0.18);
}
.cs-tool-btn .material-icons {
  color: rgba(180, 210, 250, 0.7);
  font-size: 18px;
}
.cs-tool-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ---- Emoji panel ---- */
.cs-emoji-panel {
  display: none;
  background: rgba(5, 12, 28, 0.95);
  border: 1px solid rgba(86, 202, 254, 0.12);
  border-radius: 12px;
  padding: 10px;
  gap: 4px;
  flex-wrap: wrap;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.cs-emoji-panel.is-open {
  display: flex;
}
.cs-emoji {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}
.cs-emoji:hover {
  background: rgba(86, 202, 254, 0.15);
}

/* ---- Connection status bar ---- */
.cs-status-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(255, 180, 60, 0.12);
  border-top: 1px solid rgba(255, 180, 60, 0.2);
  color: #f0c060;
  font-size: 11px;
  flex-shrink: 0;
}
.cs-status-bar.is-visible { display: flex; }
.cs-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f0a030;
  flex-shrink: 0;
  animation: cs-blink 1.2s infinite;
}
@keyframes cs-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
