/* ============================================================
   SirenUA — Support Chat Widget
   Glassmorphism Dark Cyber-Tech
   ============================================================ */

/* ── Floating Action Button ── */
.support-chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(18, 27, 40, 0.92), rgba(12, 19, 30, 0.95));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(56, 189, 248, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.support-chat-fab:hover {
  transform: scale(1.08);
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow:
    0 6px 32px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(56, 189, 248, 0.25);
}
.support-chat-fab:active {
  transform: scale(0.96);
}
.support-chat-fab svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #38bdf8;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}
.support-chat-fab.open svg.icon-chat {
  display: none;
}
.support-chat-fab.open svg.icon-close {
  display: block;
}
.support-chat-fab:not(.open) svg.icon-chat {
  display: block;
}
.support-chat-fab:not(.open) svg.icon-close {
  display: none;
}

/* ── Unread Badge ── */
.support-chat-fab .unread-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #0B1118;
  display: none;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

/* ── Chat Modal Container ── */
.support-chat-modal {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 140px);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  background: rgba(11, 17, 24, 0.88);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(56, 189, 248, 0.18);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.65),
    0 0 40px rgba(56, 189, 248, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* Animation */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.support-chat-modal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ── */
.support-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(18, 27, 40, 0.95), rgba(21, 34, 50, 0.9));
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
  flex-shrink: 0;
}
.support-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}
.support-chat-header-info {
  flex: 1;
  min-width: 0;
}
.support-chat-header-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.3;
}
.support-chat-header-status {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}
.support-chat-header-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}
.support-chat-clear {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.support-chat-clear:hover,
.support-chat-clear:focus-visible {
  color: #f1f5f9;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}

/* ── Messages Area ── */
.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.2) transparent;
}
.support-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.support-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.support-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 4px;
}

/* ── Message Bubble ── */
.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #f1f5f9;
  word-wrap: break-word;
  animation: msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  align-self: flex-start;
  background: rgba(21, 34, 50, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(2, 132, 199, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  display: block;
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 4px;
  text-align: right;
}
.chat-msg.bot .chat-msg-time {
  text-align: left;
}

/* ── Typing Indicator ── */
.chat-typing {
  align-self: flex-start;
  display: none;
  padding: 10px 16px;
  background: rgba(21, 34, 50, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  gap: 5px;
  align-items: center;
}
.chat-typing.active {
  display: flex;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  opacity: 0.4;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

/* ── Quick prompts ── */
.support-chat-quick-prompts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 14px 8px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.support-chat-quick-prompts::-webkit-scrollbar { display: none; }
.support-chat-prompt {
  flex: 0 0 auto;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(56, 189, 248, 0.07);
  color: #bae6fd;
  font: 500 0.68rem/1.2 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.support-chat-prompt:hover,
.support-chat-prompt:focus-visible {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
}

@keyframes typing-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ── Input Area ── */
.support-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(18, 27, 40, 0.95);
  border-top: 1px solid rgba(56, 189, 248, 0.1);
  flex-shrink: 0;
}
.support-chat-input {
  flex: 1;
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(11, 17, 24, 0.7);
  color: #f1f5f9;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}
.support-chat-input::placeholder {
  color: #64748b;
}
.support-chat-input:focus {
  border-color: rgba(56, 189, 248, 0.4);
}
.support-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  outline: none;
}
.support-chat-send:hover {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}
.support-chat-send:active {
  transform: scale(0.94);
}
.support-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.support-chat-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Powered By ── */
.support-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 0.6rem;
  color: #475569;
  font-family: 'Inter', sans-serif;
  border-top: 1px solid rgba(56, 189, 248, 0.06);
  background: rgba(11, 17, 24, 0.5);
}
.support-chat-footer span {
  color: #38bdf8;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  .support-chat-modal {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: var(--support-viewport-height, 100dvh);
    max-height: var(--support-viewport-height, 100dvh);
    border-radius: 0;
  }
  .support-chat-fab {
    bottom: 18px;
    right: 18px;
    width: 54px;
    height: 54px;
  }
}
