/* ── ConexChat Omnichannel Store Chat Styles ── */
:root {
  --cx-chat-primary: #10b981;
  --cx-chat-wa: #25D366;
  --cx-chat-tg: #0088cc;
  --cx-chat-live: #059669;
}

/* Hide default livechat bubble so unified store button controls it */
html body #cx-livechat-container #cx-livechat-bubble,
html body #cx-livechat-bubble,
#cx-livechat-container #cx-livechat-bubble,
#cx-livechat-bubble {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Navbar Chat Button */
.chat-btn, .whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--primary, #10b981);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.8125rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.chat-btn:hover, .whatsapp-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Floating Chat Trigger Button */
.store-floating-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000; /* Stays below modals and cart drawer (z-index: 100000) */
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px 10px 14px;
  border-radius: 32px;
  box-shadow: 0 8px 28px -4px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Ensure Chat Kami widget UI is behind Cart UI and hidden when cart or drawer is open */
body.cart-open .store-floating-chat,
body.menu-open .store-floating-chat,
body:has(.cart-overlay.open) .store-floating-chat,
body:has(.mobile-menu-overlay.open) .store-floating-chat,
.cart-overlay.open ~ .store-floating-chat,
.cart-overlay.open ~ #store-floating-chat {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(20px) scale(0.9) !important;
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s !important;
}
.store-floating-chat:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 36px -4px rgba(16, 185, 129, 0.4), 0 0 0 2px var(--primary, #10b981);
  background: #090d16;
}
.floating-chat-icon-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary, #10b981);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.floating-chat-icon-wrap svg {
  width: 20px;
  height: 20px;
}
.floating-chat-pulse {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: cx-pulse-green 2s infinite;
}
@keyframes cx-pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.floating-chat-label-box {
  display: flex;
  flex-direction: column;
}
.floating-chat-title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
}
.floating-chat-status {
  font-size: 0.7rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}
.floating-chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

/* Modal Overlay */
.store-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 99995;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: cx-fade-in 0.2s ease-out;
}
@media (min-width: 640px) {
  .store-chat-overlay {
    align-items: center;
  }
}
.store-chat-overlay.open {
  display: flex;
}
@keyframes cx-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Card */
.store-chat-modal {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  animation: cx-slide-modal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #1e293b;
}
@keyframes cx-slide-modal {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Modal Header */
.store-chat-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(99, 102, 241, 0.08));
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.store-chat-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.store-chat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}
.store-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.store-chat-header-info {
  display: flex;
  flex-direction: column;
}
.store-chat-store-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.store-chat-store-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: #ecfdf5;
  color: #059669;
  font-weight: 700;
}
.store-chat-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}
.store-chat-close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.store-chat-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

/* Modal Body / Channel List */
.store-chat-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.store-chat-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 2px;
}

/* Channel Card */
.store-channel-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.store-channel-item:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

/* Channel Specific Hovers */
.store-channel-item.channel-wa:hover {
  border-color: #25D366;
  box-shadow: 0 8px 24px -4px rgba(37, 211, 102, 0.25);
}
.store-channel-item.channel-tg:hover {
  border-color: #0088cc;
  box-shadow: 0 8px 24px -4px rgba(0, 136, 204, 0.25);
}
.store-channel-item.channel-live:hover {
  border-color: var(--primary, #10b981);
  box-shadow: 0 8px 24px -4px rgba(16, 185, 129, 0.25);
}

/* Channel Icon Wrap */
.store-channel-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  transition: transform 0.2s;
}
.store-channel-item:hover .store-channel-icon-wrap {
  transform: scale(1.08);
}
.store-channel-icon-wrap.icon-wa {
  background: #25D366;
}
.store-channel-icon-wrap.icon-tg {
  background: #0088cc;
}
.store-channel-icon-wrap.icon-live {
  background: linear-gradient(135deg, #10b981, #059669);
}

.store-channel-info {
  flex: 1;
  min-width: 0;
}
.store-channel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.store-channel-name {
  font-size: 0.925rem;
  font-weight: 700;
  color: #0f172a;
}
.store-channel-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}
.badge-wa { background: #dcfce7; color: #15803d; }
.badge-tg { background: #e0f2fe; color: #0369a1; }
.badge-live { background: #f3e8ff; color: #7e22ce; }

.store-channel-desc {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-channel-arrow {
  color: #94a3b8;
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
}
.store-channel-item:hover .store-channel-arrow {
  color: #0f172a;
  transform: translateX(3px);
}

/* Modal Footer */
.store-chat-footer {
  padding: 12px 24px 16px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  background: #fafafa;
}
.store-chat-footer strong {
  color: #64748b;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .store-floating-chat {
    bottom: 16px;
    right: 16px;
    padding: 8px 14px 8px 10px;
  }
  .floating-chat-icon-wrap {
    width: 34px;
    height: 34px;
  }
  .floating-chat-icon-wrap svg {
    width: 18px;
    height: 18px;
  }
  .floating-chat-title {
    font-size: 0.8rem;
  }
  .store-chat-modal {
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
  }
}
