/* ==============================================================================
   C.W. ELECTRICAL LTD — SMART COMMERCIAL AI CHAT, SCROLL-TO-TOP & STICKY EMAIL
   ============================================================================== */

/* ── 1. Sticky Bottom-Left Single Email Pill (Electric Navy & Amber) ── */
.cwe-email-sticky-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  background: linear-gradient(135deg, #1b2a47 0%, #0b1329 100%);
  color: #ffb600 !important;
  border: 1.5px solid #ffb600;
  padding: 10px 18px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(11, 19, 41, 0.55), 0 0 0 1px rgba(255, 182, 0, 0.3);
  text-decoration: none !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.cwe-email-sticky-btn i {
  font-size: 18px;
  color: #ffb600;
  transition: color 0.2s ease;
}

.cwe-email-sticky-btn:hover {
  transform: translateY(-3px) scale(1.04);
  background: #ffb600 !important;
  color: #1b2a47 !important;
  border-color: #ffffff;
  box-shadow: 0 12px 30px rgba(255, 182, 0, 0.55), 0 0 0 2px #ffb600;
}

.cwe-email-sticky-btn:hover i {
  color: #1b2a47 !important;
}

.cwe-email-sticky-btn::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 34px;
  border: 2px solid #ffb600;
  animation: cwePulseRadar 2.2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  opacity: 0;
}

/* ── 2. Sticky Bottom-Right "Go to Top" Favicon Arrow Button ── */
.cwe-scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9997;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0b1329 0%, #030712 100%);
  border: 2px solid #ffb600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 15px rgba(255, 182, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.9);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none !important;
}

.cwe-scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.cwe-scroll-top-btn:hover {
  background: #ffb600;
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 14px 32px rgba(255, 182, 0, 0.6);
  border-color: #ffffff;
}

.cwe-scroll-top-favicon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 2px;
  transition: transform 0.25s ease;
}

.cwe-scroll-top-arrow {
  color: #ffb600;
  font-size: 11px;
  line-height: 1;
  transition: color 0.25s ease, transform 0.25s ease;
}

.cwe-scroll-top-btn:hover .cwe-scroll-top-arrow {
  color: #0b1329;
  transform: translateY(-2px);
}

.cwe-scroll-top-tooltip {
  position: absolute;
  right: 64px;
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #ffb600;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  border: 1px solid rgba(255, 182, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cwe-scroll-top-btn:hover .cwe-scroll-top-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-6px);
}


/* ── 3. Smart AI Chatbot Launcher (Positioned ABOVE Bottom-Right Arrow) ── */
.cwe-ai-chat-launcher {
  position: fixed;
  bottom: 88px; /* Stationed cleanly ABOVE the bottom-right arrow */
  right: 24px;
  z-index: 9998;
  background: linear-gradient(135deg, #0b1528 0%, #060a14 100%);
  color: #ffb600 !important;
  border: 2px solid #ffb600;
  padding: 10px 18px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75), 0 0 20px rgba(255, 182, 0, 0.35);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none !important;
}

.cwe-ai-chat-launcher:hover {
  transform: translateY(-3px) scale(1.04);
  background: #ffb600;
  color: #060a14 !important;
  box-shadow: 0 14px 36px rgba(255, 182, 0, 0.6);
}

.cwe-ai-launcher-icon {
  font-size: 17px;
  animation: cweSparkle 2.5s infinite ease-in-out;
}

@keyframes cweSparkle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2) rotate(10deg); }
}


/* ── 4. Smart AI Chat Window (Positioned ABOVE Launcher & Arrow) ── */
.cwe-ai-chat-window {
  position: fixed;
  bottom: 148px; /* Positioned gracefully ABOVE launcher and bottom-right arrow */
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 175px);
  background: #080f1d;
  border: 2px solid #ffb600;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(255, 182, 0, 0.25);
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  animation: cweChatSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cweChatSlideUp {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.cwe-ai-header {
  background: linear-gradient(135deg, #0b1528 0%, #060b14 100%);
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 182, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cwe-ai-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cwe-ai-avatar {
  width: 38px;
  height: 38px;
  background: rgba(255, 182, 0, 0.15);
  border: 1.5px solid #ffb600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffb600;
  font-size: 16px;
}

.cwe-ai-header-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.cwe-ai-header-sub {
  color: #94a3b8;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

.cwe-ai-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

.cwe-ai-close-btn:hover {
  color: #ffb600;
}

/* ── Chat Message Body ── */
.cwe-ai-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(circle at top right, #0d1a33 0%, #060a14 100%);
}

.cwe-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  line-height: 1.5;
  font-size: 13.5px;
}

.cwe-msg-bot {
  align-self: flex-start;
}

.cwe-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.cwe-msg-content {
  padding: 12px 16px;
  border-radius: 16px;
}

.cwe-msg-bot .cwe-msg-content {
  background: #0d182e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-top-left-radius: 4px;
}

.cwe-msg-user .cwe-msg-content {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #030712;
  font-weight: 600;
  border-top-right-radius: 4px;
}

/* ── Chat Links & WhatsApp Clickables ── */
.cwe-chat-link {
  color: #ffb600 !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
  transition: all 0.2s ease;
  word-break: break-word;
}

.cwe-chat-link:hover {
  color: #ffffff !important;
  text-shadow: 0 0 8px rgba(255, 182, 0, 0.8);
}

.cwe-chat-wa-link {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 12.5px !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 6px 0 !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  transition: all 0.2s ease;
}

.cwe-chat-wa-link:hover {
  background: #22c55e !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.55);
  color: #ffffff !important;
}

.cwe-chat-wa-link i {
  font-size: 15px;
}

.cwe-whatsapp-banner {
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cwe-whatsapp-link-btn {
  background: #25D366;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cwe-whatsapp-link-btn:hover {
  background: #128C7E;
}

/* ── Suggested Chips ── */
.cwe-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.cwe-chip {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 182, 0, 0.35);
  color: #fde047;
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cwe-chip:hover {
  background: #ffb600;
  color: #0f172a;
  border-color: #ffb600;
}

/* ── Chat Input Footer ── */
.cwe-ai-footer {
  padding: 12px 16px;
  background: #080f1d;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cwe-ai-input {
  flex: 1;
  background: #0e172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  outline: none;
}

.cwe-ai-input:focus {
  border-color: #ffb600;
}

.cwe-ai-send-btn {
  background: #ffb600;
  color: #0f172a;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cwe-ai-send-btn:hover {
  transform: scale(1.06);
  background: #fbbf24;
}

@media (max-width: 480px) {
  .cwe-email-sticky-btn {
    bottom: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
    font-size: 24px;
  }
  .cwe-scroll-top-btn {
    bottom: 16px;
    right: 16px;
    width: 46px;
    height: 46px;
  }
  .cwe-ai-chat-launcher {
    bottom: 74px;
    right: 16px;
    padding: 8px 14px;
    font-size: 12.5px;
  }
  .cwe-ai-chat-window {
    bottom: 130px;
    right: 12px;
    left: 12px;
    width: auto;
    height: 480px;
  }
}
