/* ===================================================================
   MK SPICEPOD TRADERS - Live Chat Widget Styles
   Persistent, Responsive & Modern Customer Support Experience
   =================================================================== */

:root {
  --chat-primary: #064e3b;
  --chat-primary-dark: #022c22;
  --chat-accent: #10b981;
  --chat-gold: #f59e0b;
  --chat-bg: #ffffff;
  --chat-surface: #f8fafc;
  --chat-border: #e2e8f0;
  --chat-text: #0f172a;
  --chat-text-muted: #64748b;
  --chat-user-msg: #064e3b;
  --chat-agent-msg: #f1f5f9;
}

/* ===================================================================
   FLOATING CIRCULAR LIVE CHAT ICON & TEASER TOOLTIP
   =================================================================== */

/* Teaser Callout Tooltip (Left of the circular icon) */
.mk-chat-teaser-bubble {
  position: fixed;
  bottom: 30px;
  right: 95px;
  z-index: 9997;
  background: #ffffff;
  color: #064e3b;
  padding: 10px 16px 10px 14px;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  animation: mkTeaserBounce 3s infinite ease-in-out;
  transition: all 0.3s ease;
  user-select: none;
}

.mk-chat-teaser-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(6, 78, 59, 0.18);
  border-color: #10b981;
}

.mk-chat-teaser-bubble::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 0 8px 8px;
  border-style: solid;
  border-color: transparent transparent transparent #ffffff;
}

.mk-chat-teaser-close {
  color: #94a3b8;
  font-size: 0.8rem;
  margin-left: 6px;
  padding: 2px 4px;
  border-radius: 50%;
  transition: color 0.2s;
}

.mk-chat-teaser-close:hover {
  color: #ef4444;
}

@keyframes mkTeaserBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Floating Circular Chat Trigger Button */
.mk-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 25px rgba(6, 78, 59, 0.45);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  outline: none;
  padding: 0;
}

.mk-chat-launcher:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 15px 32px rgba(6, 78, 59, 0.55);
}

.mk-chat-launcher:active {
  transform: scale(0.95);
}

/* Icon Switching (Chat <-> Close) */
.mk-chat-icon-msg,
.mk-chat-icon-close {
  position: absolute;
  font-size: 1.55rem;
  color: #ffffff;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.mk-chat-icon-msg {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.mk-chat-icon-close {
  opacity: 0;
  transform: scale(0.4) rotate(-90deg);
  font-size: 1.4rem;
}

/* When chat window is active, rotate and show Close icon */
.mk-chat-launcher.open {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.mk-chat-launcher.open .mk-chat-icon-msg {
  opacity: 0;
  transform: scale(0.4) rotate(90deg);
}

.mk-chat-launcher.open .mk-chat-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Unread Badge */
.mk-chat-launcher-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
  display: none;
  animation: mkBadgePop 0.3s ease;
}

@keyframes mkBadgePop {
  0% { transform: scale(0); }
  80% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Online Status Dot Indicator on Icon */
.mk-launcher-online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border-radius: 50%;
  border: 2.5px solid #064e3b;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
}

.mk-launcher-online-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: mkPulse 2s infinite;
}

.mk-chat-launcher.open .mk-launcher-online-dot {
  display: none;
}

/* Online Pulse Indicator */
.mk-online-dot {
  width: 9px;
  height: 9px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: mkPulse 2s infinite;
}

@keyframes mkPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Chat Container Window */
.mk-chat-window {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.mk-chat-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.mk-chat-header {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mk-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mk-chat-header-avatar {
  width: 42px;
  height: 42px;
  background: #ffffff;
  color: #064e3b;
  font-weight: 800;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

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

.mk-chat-header-status {
  font-size: 0.78rem;
  color: #a7f3d0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.mk-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mk-chat-btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.mk-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Body */
.mk-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Chat Messages */
.mk-chat-message-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: mkFadeIn 0.25s ease forwards;
}

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

.mk-chat-message-row.customer {
  align-self: flex-end;
  align-items: flex-end;
}

.mk-chat-message-row.agent,
.mk-chat-message-row.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.mk-chat-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
}

.mk-chat-message-row.customer .mk-chat-bubble {
  background: #064e3b;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.mk-chat-message-row.agent .mk-chat-bubble {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.mk-chat-message-row.bot .mk-chat-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.mk-chat-meta {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mk-chat-message-row.customer .mk-chat-meta {
  color: #64748b;
}

/* Quick Action Chips */
.mk-chat-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

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

.mk-chat-chip:hover {
  background: #064e3b;
  color: #ffffff;
  border-color: #064e3b;
  transform: translateY(-1px);
}

/* Onboarding Registration Form Card inside Chat */
.mk-chat-onboarding {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.mk-chat-onboarding h4 {
  margin: 0 0 6px 0;
  font-size: 0.95rem;
  color: #064e3b;
}

.mk-chat-onboarding p {
  margin: 0 0 12px 0;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.35;
}

.mk-chat-input-field {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 8px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.mk-chat-input-field:focus {
  border-color: #064e3b;
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.1);
}

.mk-chat-btn-submit {
  width: 100%;
  background: #064e3b;
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.mk-chat-btn-submit:hover {
  background: #047857;
}

/* Chat Footer & Message Input Area */
.mk-chat-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mk-chat-msg-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;
  box-sizing: border-box;
}

.mk-chat-msg-input:focus {
  border-color: #064e3b;
  box-shadow: 0 0 0 2px rgba(6, 78, 59, 0.15);
}

.mk-chat-btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #064e3b;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mk-chat-btn-send:hover {
  background: #047857;
  transform: scale(1.05);
}

/* Customer details banner inside chat */
.mk-customer-active-badge {
  background: #ecfdf5;
  border-bottom: 1px solid #a7f3d0;
  padding: 6px 14px;
  font-size: 0.75rem;
  color: #065f46;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mk-customer-active-badge strong {
  font-weight: 700;
}

/* WhatsApp Quick Connect Strip in Chat */
.mk-chat-wa-strip {
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #166534;
}

.mk-chat-wa-link {
  color: #15803d;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mk-chat-wa-link:hover {
  text-decoration: underline;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
  .mk-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .mk-chat-launcher {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
  }
}
