/* ═══════════════════════════════════════════════════════════════════
   CinQ — Live Support Chat Widget  ·  Premium Dark-Native Design
   Senior UI v3 — fully dark, glassmorphism, native mobile feeling
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Design tokens ────────────────────────────────────────────────── */
:root {
  --cs-violet: #e8192c;
  /* brand crimson */
  --cs-violet-deep: #991b1b;
  /* brand dark red */
  --cs-violet-glow: rgba(232, 25, 44, 0.35);
  --cs-violet-soft: rgba(232, 25, 44, 0.12);
  --cs-green: #10b981;
  --cs-red: #ef4444;

  /* Chat surface colours */
  --cs-bg: #09090a;
  /* deepest bg */
  --cs-surface: rgba(15, 15, 16, 0.95);
  /* panel bg */
  --cs-card: #1a1a1c;
  /* inner cards */
  --cs-border: rgba(255, 255, 255, 0.06);
  --cs-border-hi: rgba(255, 255, 255, 0.12);

  /* Bubble colours */
  --cs-bubble-out: linear-gradient(135deg, #e8192c 0%, #991b1b 100%);
  /* user */
  --cs-bubble-in: #222226;
  /* agent */
  --cs-bubble-sys: rgba(255, 255, 255, 0.04);

  /* Text */
  --cs-text: #f1f0fb;
  --cs-text-muted: rgba(240, 238, 255, 0.45);
  --cs-text-meta: rgba(240, 238, 255, 0.32);

  /* Composer */
  --cs-composer-bg: rgba(255, 255, 255, 0.04);
  --cs-composer-focused: rgba(232, 25, 44, 0.04);

  /* Sizing */
  --cs-radius: 20px;
  --cs-radius-bubble: 16px;
  --cs-header-h: 56px;
  --cs-footer-h: 52px;
}

/* ─── Root Widget Container ─────────────────────────────────────────── */
#cinq-support-widget {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  z-index: 2147483647; /* max z-index — always on top */
  font-family: 'Inter', 'Noto Sans Bengali', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  gap: 12px;
  /* Prevent parent overflow clipping on mobile browsers */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

#cinq-support-widget.pos-bottom-left {
  right: auto;
  left: calc(24px + env(safe-area-inset-left, 0px));
  align-items: flex-start;
}

#cinq-support-widget.pos-bottom-left #cinq-support-window {
  transform-origin: bottom-left;
}

/* ─── Floating Controls Stack ───────────────────────────────────────── */
.support-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}

/* ─── Premium FAB Button ────────────────────────────────────────────── */
.cinq-support-fab {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  height: 52px;
  min-width: 130px;
  border-radius: 26px;
  color: #fff;
  border: none;
  background: linear-gradient(135deg, var(--cs-violet) 0%, var(--cs-violet-deep) 100%);
  box-shadow:
    0 0 0 0 var(--cs-violet-glow),
    0 10px 30px var(--cs-violet-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease,
    filter 0.2s ease;
  position: relative;
  overflow: visible;
  outline: none;
  animation: csFabRingPulse 2.6s ease-in-out infinite;
}

/* Shimmer overlay */
.cinq-fab-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.18) 0%,
      rgba(255, 255, 255, 0.06) 40%,
      transparent 70%);
  pointer-events: none;
}

@keyframes csFabRingPulse {
  0% {
    box-shadow: 0 0 0 0 var(--cs-violet-glow), 0 10px 30px var(--cs-violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(232, 25, 44, 0.00), 0 14px 38px var(--cs-violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }

  100% {
    box-shadow: 0 0 0 0 var(--cs-violet-glow), 0 10px 30px var(--cs-violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
}

.cinq-support-fab:hover {
  transform: translateY(-3px) scale(1.04);
  filter: brightness(1.12);
  animation-play-state: paused;
}

.cinq-support-fab:active {
  transform: translateY(1px) scale(0.95);
  filter: brightness(0.92);
}

.cinq-support-fab svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cinq-support-fab:hover svg {
  transform: rotate(-8deg) scale(1.1);
}

.support-label {
  font-family: 'Noto Sans Bengali', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* ─── Unread Badge — premium redesign ──────────────────────────────── */
.cinq-support-fab .unread-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: linear-gradient(135deg, #ff6b35 0%, #f03 55%, #c00 100%);
  color: #fff;
  font-family: 'Inter', 'Outfit', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #09090a;
  box-shadow:
    0 0 0 1.5px rgba(255, 60, 0, 0.35),
    0 4px 12px rgba(255, 60, 0, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.4);
  animation: csBadgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    csBadgePulse 2.2s 0.4s ease-in-out infinite;
  z-index: 10;
  letter-spacing: -0.02em;
}

@keyframes csBadgePop {
  0% {
    transform: scale(0) rotate(-15deg);
    opacity: 0;
  }

  60% {
    transform: scale(1.25) rotate(5deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes csBadgePulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 1.5px rgba(255, 60, 0, 0.35), 0 4px 12px rgba(255, 60, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
  }

  50% {
    transform: scale(1.12);
    box-shadow: 0 0 0 3px rgba(255, 60, 0, 0.20), 0 6px 18px rgba(255, 60, 0, 0.70), 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

/* ─── Chat Window Panel ──────────────────────────────────────────────── */
#cinq-support-widget {
  pointer-events: none;
}

#cinq-support-widget .support-controls,
#cinq-support-window.open {
  pointer-events: auto;
}

#cinq-support-window {
  width: min(360px, calc(100vw - 24px));
  height: min(480px, calc(100dvh - 180px));
  margin-bottom: 10px;
  border-radius: var(--cs-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--cs-surface);
  border: 1px solid var(--cs-border-hi);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(232, 25, 44, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);

  /* Enter animation */
  transform: scale(0.95) translateY(24px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.28s ease,
    visibility 0s linear 0.35s;
  transform-origin: bottom right;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  pointer-events: none;
}

#cinq-support-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.24s ease,
    visibility 0s linear 0s;
  pointer-events: auto;
}

.support-theme-dark,
.support-theme-light {
  background: var(--cs-surface) !important;
  color: var(--cs-text) !important;
}

/* ─── Chat body layout ─────────────────────────────────────────────── */
.support-chat-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* ─── Header ────────────────────────────────────────────────────────── */
.support-header {
  padding: 10px 12px;
  min-height: var(--cs-header-h);
  box-sizing: border-box;
  background: linear-gradient(135deg, #180507 0%, #3a080d 50%, #6b0c14 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border-bottom: 1px solid var(--cs-border);
}

.support-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.support-header>* {
  position: relative;
  z-index: 1;
}

.support-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.support-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  flex-shrink: 0;
}

.support-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.support-header-avatar .status-dot {
  width: 11px;
  height: 11px;
  background: var(--cs-green);
  border: 2px solid #3a080d;
  border-radius: 50%;
  position: absolute;
  bottom: -1px;
  right: -1px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.support-header-avatar .status-dot.offline {
  background: rgba(255, 255, 255, 0.3);
  border-color: #3a080d;
  box-shadow: none;
}

.support-header-title {
  min-width: 0;
}

.support-header-title h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.support-header-title p {
  margin: 2px 0 0;
  font-size: 10px;
  color: var(--cs-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.support-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.support-header-btn {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.support-header-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.06);
}

.support-header-btn:active {
  transform: scale(0.94);
}

/* ─── Init / Registration Screen ───────────────────────────────────── */
.support-init-screen {
  flex: 1;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--cs-surface);
  overflow-y: auto;
}

.support-init-screen h5 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 800;
  color: var(--cs-text);
  letter-spacing: -0.3px;
}

.support-init-screen p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--cs-text-muted);
}

.support-field {
  margin-bottom: 14px;
}

.support-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  color: var(--cs-text-muted);
}

.support-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--cs-border-hi);
  font-size: 14px;
  box-sizing: border-box;
  background: var(--cs-card);
  color: var(--cs-text);
  transition: all 0.2s ease;
  outline: none;
}

.support-field input::placeholder {
  color: rgba(240, 238, 255, 0.25);
}

.support-field input:focus {
  border-color: rgba(232, 25, 44, 0.6);
  background: rgba(232, 25, 44, 0.03);
  box-shadow: 0 0 0 3px var(--cs-violet-soft);
}

.support-btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cs-violet) 0%, var(--cs-violet-deep) 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 10px 24px rgba(153, 27, 27, 0.35);
  transition: all 0.25s ease;
}

.support-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(153, 27, 27, 0.45);
  filter: brightness(1.05);
}

.support-btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 6px 14px rgba(153, 27, 27, 0.25);
}

/* ─── Message Area ──────────────────────────────────────────────────── */
.support-messages-container {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 10px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--cs-bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(153, 27, 27, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(232, 25, 44, 0.03) 0%, transparent 50%);
}

.support-messages-container::-webkit-scrollbar {
  width: 4px;
}

.support-messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.support-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.support-messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ─── Message Rows ──────────────────────────────────────────────────── */
.support-message-row {
  display: flex;
  width: 100%;
  animation: csMsgIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes csMsgIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.support-message-row.user {
  justify-content: flex-end;
}

.support-message-row.agent {
  justify-content: flex-start;
}

.support-message-row.system {
  justify-content: center;
  margin: 2px 0;
}

/* ─── Bubbles ───────────────────────────────────────────────────────── */
.support-bubble {
  max-width: 86%;
  padding: 8px 11px;
  border-radius: var(--cs-radius-bubble);
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
  word-break: break-word;
}

/* User bubble */
.support-message-row.user .support-bubble {
  background: var(--cs-bubble-out);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(153, 27, 27, 0.25);
}

/* Agent bubble */
.support-message-row.agent .support-bubble {
  background: var(--cs-bubble-in);
  color: var(--cs-text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* System status messages */
.support-message-row.system .support-bubble {
  background: var(--cs-bubble-sys);
  color: var(--cs-text-meta);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  max-width: 94%;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  letter-spacing: 0.02em;
}

/* Message Meta */
.support-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 9px;
  margin-top: 3px;
  color: var(--cs-text-meta);
}

.support-message-row.user .support-meta {
  color: rgba(255, 255, 255, 0.5);
}

.support-message-row.agent .support-meta {
  justify-content: flex-start;
}

.support-meta .seen-icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* ─── Image & File Attachments ──────────────────────────────────────── */
.support-attachment-img {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 6px;
  cursor: pointer;
  display: block;
  border: 1px solid var(--cs-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.support-attachment-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cs-border-hi);
  border-radius: 12px;
  margin-top: 6px;
  color: var(--cs-text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.support-attachment-file:hover {
  background: rgba(255, 255, 255, 0.1);
}

.support-attachment-file svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--cs-violet);
}

.support-attachment-file span {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Typing Indicator ──────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: var(--cs-bubble-in);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--cs-radius-bubble);
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  animation: csTypingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes csTypingBounce {

  0%,
  80%,
  100% {
    transform: scale(0.4);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── Footer / Composer ─────────────────────────────────────────────── */
.support-footer {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--cs-border);
  background: var(--cs-surface);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: var(--cs-footer-h);
  box-sizing: border-box;
}

.support-footer-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.support-footer-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: var(--cs-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.support-footer-btn:hover {
  background: var(--cs-violet-soft);
  color: var(--cs-violet);
  border-color: rgba(232, 25, 44, 0.25);
  transform: scale(1.05);
}

.support-footer-btn:active {
  transform: scale(0.95);
}

/* Composer input pill */
.support-composer {
  flex: 1;
  border-radius: 18px;
  background: var(--cs-composer-bg);
  border: 1px solid var(--cs-border-hi);
  padding: 7px 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 36px;
  max-height: 88px;
  transition: all 0.25s ease;
}

.support-composer:focus-within {
  border-color: rgba(232, 25, 44, 0.5);
  background: var(--cs-composer-focused);
  box-shadow: 0 0 12px rgba(232, 25, 44, 0.15);
}

.support-composer textarea {
  width: 100%;
  border: none;
  background: none;
  resize: none;
  outline: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
  max-height: 72px;
  color: var(--cs-text);
  caret-color: var(--cs-violet);
}

.support-composer textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* Send button */
.support-send-btn,
#support-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cs-violet), var(--cs-violet-deep));
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 3px 10px rgba(153, 27, 27, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.support-send-btn:hover,
#support-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 5px 14px rgba(153, 27, 27, 0.42);
}

.support-send-btn:active,
#support-send-btn:active {
  transform: scale(0.94);
}

.support-send-btn svg,
#support-send-btn svg {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  width: 16px;
  height: 16px;
}

/* ─── Quick reply suggestions (above composer) ─────────────────────── */
.support-suggestions-dock {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 6px;
  border-top: 1px solid var(--cs-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, var(--cs-surface) 100%);
  flex-shrink: 0;
}

.support-suggestions-dock.is-visible {
  display: flex;
  animation: supportDockIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.support-suggestions-dock.is-dismissed {
  animation: supportDockOut 0.22s ease forwards;
}

@keyframes supportDockIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes supportDockOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

.support-suggestions-label {
  font-family: 'Noto Sans Bengali', 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cs-text-meta);
  padding: 0 2px;
}

.support-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.support-chips-bar::-webkit-scrollbar {
  display: none;
}

.support-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  max-width: min(240px, 78vw);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 25, 44, 0.28);
  background: rgba(232, 25, 44, 0.08);
  color: var(--cs-text);
  font-family: 'Noto Sans Bengali', 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.support-chip:hover {
  background: rgba(232, 25, 44, 0.14);
  border-color: rgba(232, 25, 44, 0.45);
}

.support-chip:active {
  transform: scale(0.97);
}

/* ─── Upload Preview Bar ────────────────────────────────────────────── */
.support-upload-preview {
  position: relative;
  margin: 0 10px 6px;
  background: var(--cs-card);
  border: 1px solid rgba(232, 25, 44, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 10;
  animation: csMsgIn 0.2s ease;
}

.support-preview-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--cs-text);
  width: calc(100% - 32px);
}

.support-preview-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.support-preview-info svg {
  width: 18px;
  height: 18px;
  color: var(--cs-violet);
}

/* ─── Responsive (Mobile) ─────────────────────────────────────────── */
@media (max-width: 480px) {
  #cinq-support-widget {
    /* Position FAB above bottom navigation bar (72-80px height) */
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    align-items: flex-end !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none !important;
    /* Force GPU layer to avoid iOS overflow-x:hidden clipping bug */
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    z-index: 999998;
    flex-direction: column;
    gap: 12px;
  }

  .support-controls {
    display: flex !important;
    pointer-events: auto !important;
    flex-direction: column !important;
    align-items: flex-end;
    gap: 12px;
  }

  #cinq-support-widget.pos-bottom-left {
    right: auto;
    left: 16px;
    align-items: flex-start;
  }

  #cinq-support-widget.pos-bottom-left .support-controls {
    align-items: flex-start;
  }

  /* Support Chat FAB — compact circle on mobile */
  .cinq-support-fab {
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 50%;
    padding: 0;
    background: linear-gradient(145deg, var(--cs-violet) 0%, var(--cs-violet-deep) 100%);
    box-shadow:
      0 0 0 0 var(--cs-violet-glow),
      0 8px 24px var(--cs-violet-glow),
      0 3px 12px rgba(0, 0, 0, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: csFabRingPulse 2.2s ease-in-out infinite;
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    position: relative;
    flex-shrink: 0;
  }

  .cinq-support-fab:hover {
    transform: translateY(-3px) scale(1.04);
    filter: brightness(1.08);
  }

  .cinq-support-fab .support-label {
    display: none;
  }

  .cinq-support-fab svg {
    width: 26px;
    height: 26px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  }

  .cinq-support-fab .unread-badge {
    top: -8px;
    right: -8px;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    border-width: 2px;
  }

  #cinq-support-window {
    position: relative;
    top: auto;
    left: auto;
    width: min(340px, calc(100vw - 20px));
    height: min(400px, calc(58dvh - env(safe-area-inset-top, 0px)));
    max-width: none;
    max-height: none;
    margin: 0 0 12px;
    border-radius: var(--cs-radius);
    border: 1px solid var(--cs-border-hi);
    padding: 0;
    box-shadow:
      0 24px 64px rgba(0, 0, 0, 0.8),
      0 0 0 1px rgba(232, 25, 44, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: auto;
    visibility: hidden !important;
    opacity: 0;
    transform: scale(0.95) translateY(24px);
    transform-origin: bottom right;
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
      opacity 0.28s ease,
      visibility 0s linear 0.35s;
  }

  #cinq-support-widget.pos-bottom-left #cinq-support-window {
    transform-origin: bottom left;
  }

  #cinq-support-window.open {
    transform: scale(1) translateY(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
      opacity 0.24s ease,
      visibility 0s linear 0s;
  }

  #cinq-support-window::before {
    display: none;
  }

  .support-header {
    padding: 8px 10px;
  }

  .support-footer {
    padding: 7px 8px 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  /* Drag reset is desktop-only */
  #support-reset-pos-btn {
    display: none;
  }

  .support-header-btn {
    width: 28px;
    height: 28px;
  }

  .support-header-btn svg {
    width: 15px;
    height: 15px;
  }

  .support-messages-container {
    padding: 8px 8px 6px;
    gap: 6px;
    overscroll-behavior: contain;
  }

  .support-bubble {
    max-width: 88%;
    font-size: 12.5px;
    padding: 7px 10px;
  }

  .support-composer textarea {
    font-size: 16px;
    line-height: 1.3;
  }

  .support-footer-btn,
  .support-send-btn,
  #support-send-btn {
    width: 32px;
    height: 32px;
  }

  .support-suggestions-dock {
    padding: 6px 8px 4px;
  }

  .support-chip {
    font-size: 11.5px;
    padding: 6px 10px;
    max-width: min(200px, 72vw);
  }
}

/* ─── Avoid overlap with bottom nav / install banner ─────────────── */
@media (max-width: 480px) {
  body.has-pwa-banner #cinq-support-widget {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.has-bottom-nav #cinq-support-widget {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.has-bottom-nav.has-pwa-banner #cinq-support-widget {
    bottom: calc(78px + 88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Hide duplicate FABs while chat panel is open; keep the panel anchored in-widget */
body.support-chat-open .support-controls {
  display: none !important;
}

body.support-chat-open .home-fav-fabs-wrap,
body.support-chat-open .home-support-fab-wrap {
  opacity: 0 !important;
  pointer-events: none !important;
}