/* ============================================================
   STSPL LIVE CHATBOT & SUPPORT DESK WIDGET STYLES
   ============================================================ */

/* Chat Widget Window */
.stspl-chat-widget {
  position: fixed !important;
  right: 24px !important;
  bottom: 24px !important;
  width: 380px !important;
  max-width: calc(100vw - 32px) !important;
  height: 560px !important;
  max-height: calc(100vh - 60px) !important;
  background: #ffffff !important;
  border-radius: 20px !important;
  box-shadow: 0 16px 48px rgba(11, 37, 69, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.1) !important;
  display: none !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 999999 !important;
  font-family: var(--font-body, system-ui, -apple-system, sans-serif) !important;
}

.stspl-chat-widget.is-open {
  display: flex !important;
}

/* Chat Header */
.stspl-chat-header {
  background: linear-gradient(135deg, #0B2545 0%, #134074 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.stspl-chat-header__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stspl-chat-header__avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.stspl-chat-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stspl-chat-header__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  line-height: 1.2;
}

.stspl-chat-header__status {
  font-size: 0.75rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.stspl-chat-header__status-dot {
  width: 8px;
  height: 8px;
  background-color: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  display: inline-block;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.stspl-chat-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stspl-chat-btn-admin {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.stspl-chat-btn-admin:hover {
  background: #235FE2;
  color: #ffffff;
}

.stspl-chat-btn-close {
  background: transparent;
  border: none;
  color: #CBD5E1;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.stspl-chat-btn-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Chat Message Body */
.stspl-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8FAFC;
}

.stspl-chat-timestamp-badge {
  text-align: center;
  font-size: 0.7rem;
  color: #94A3B8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 6px 0;
}

.stspl-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: slide-up 0.25s ease forwards;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stspl-msg--bot,
.stspl-msg--admin {
  align-self: flex-start;
}

.stspl-msg--visitor {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.stspl-msg__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #0B2545;
  color: #ffffff;
}

.stspl-msg--admin .stspl-msg__avatar {
  background: #235FE2;
}

.stspl-msg--visitor .stspl-msg__avatar {
  background: #E2E8F0;
  color: #0B2545;
}

.stspl-msg__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.stspl-msg--bot .stspl-msg__bubble,
.stspl-msg--admin .stspl-msg__bubble {
  background: #ffffff;
  color: #1E293B;
  border-top-left-radius: 4px;
  border: 1px solid #E2E8F0;
}

.stspl-msg--admin .stspl-msg__bubble {
  border-left: 3px solid #235FE2;
}

.stspl-msg--visitor .stspl-msg__bubble {
  background: #235FE2;
  color: #ffffff;
  border-top-right-radius: 4px;
}

.stspl-msg__sender {
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 3px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stspl-msg--bot .stspl-msg__sender { color: #64748B; }
.stspl-msg--admin .stspl-msg__sender { color: #235FE2; }
.stspl-msg--visitor .stspl-msg__sender { color: rgba(255,255,255,0.75); }

.stspl-msg__time {
  font-size: 0.65rem;
  opacity: 0.7;
  display: block;
  margin-top: 4px;
  text-align: right;
}

/* Quick Inquiry Chips */
.stspl-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.stspl-chat-chip {
  background: #ffffff;
  border: 1px solid #CBD5E1;
  color: #1E293B;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stspl-chat-chip:hover {
  background: #EFF6FF;
  border-color: #235FE2;
  color: #235FE2;
  transform: translateY(-1px);
}

/* Chat Input Bar */
.stspl-chat-input-bar {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stspl-chat-input {
  flex: 1;
  border: 1px solid #CBD5E1;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.stspl-chat-input:focus {
  border-color: #235FE2;
  box-shadow: 0 0 0 3px rgba(35, 95, 226, 0.12);
}

.stspl-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #235FE2;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.stspl-chat-send-btn:hover {
  background: #1D4ED8;
  transform: scale(1.06);
}

.stspl-chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  margin-left: 2px;
}

/* Chat Unread Floating Badge */
.chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #EF4444;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}
