/* Live Support Widget (Smartsupp launcher) */
.live-support {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2147483000;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Smartsupp default bubble is hidden via smartsupp('widget:hide') — backup CSS */
iframe#chat-widget-minimized,
#smartsupp-widget-container .widget-label {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.live-support-fab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem 0.75rem 0.85rem;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.45);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  position: relative;
}

.live-support-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.5);
}

.live-support-fab.hidden-fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.live-support-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(37, 99, 235, 0.4);
  animation: support-pulse 2s ease infinite;
  pointer-events: none;
}

@keyframes support-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.08); }
}

.live-support-fab-svg,
.live-support-fab-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.live-support-fab-text {
  white-space: nowrap;
}

.live-support-panel {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  max-height: 520px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  overflow: hidden;
}

.live-support-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.live-support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.85rem;
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  color: #fff;
}

.live-support-agent {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.live-support-avatar {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-support-avatar-icon,
.live-support-avatar svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #fff;
}

.live-support-online {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border: 2px solid #1d4ed8;
  border-radius: 50%;
}

.live-support-agent-name {
  font-size: 0.9rem;
  font-weight: 800;
}

.live-support-agent-status {
  font-size: 0.68rem;
  color: #bfdbfe;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.live-support-status-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
}

.live-support-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-support-close-icon,
.live-support-close svg {
  width: 1rem;
  height: 1rem;
}

.live-support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 200px;
  max-height: 280px;
  background: #f8fafc;
}

.live-support-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.live-support-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.live-support-msg.agent {
  align-self: flex-start;
}

.live-support-msg-bubble {
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.live-support-msg.user .live-support-msg-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 0.2rem;
}

.live-support-msg.agent .live-support-msg-bubble {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 0.2rem;
}

.live-support-msg-bubble p + p {
  margin-top: 0.35rem;
}

.live-support-msg-time {
  font-size: 0.6rem;
  color: #94a3b8;
  margin-top: 0.2rem;
  padding: 0 0.25rem;
}

.live-support-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0;
}

.live-support-quick button {
  padding: 0.3rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  cursor: pointer;
}

.live-support-quick button:hover {
  background: #dbeafe;
}

.live-support-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f5f9;
  background: #fff;
}

.live-support-form input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  outline: none;
}

.live-support-form input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.live-support-form button {
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 0.55rem;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.live-support-send-icon,
.live-support-form button svg {
  width: 1rem;
  height: 1rem;
}

.live-support-foot {
  padding: 0.5rem 1rem 0.75rem;
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: center;
  background: #fff;
}

.live-support-foot a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 1023px) {
  body.udash-body .live-support,
  body.admin-body .live-support {
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .live-support {
    bottom: 1rem;
    right: 1rem;
  }
  .live-support-fab-text {
    display: none;
  }
  .live-support-fab {
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .live-support-panel {
    width: calc(100vw - 2rem);
    right: 0;
  }
}
