/* =====================================================
   CHAT UI STYLING
   Description: Floating AI chat widget styles
   Author: Harish AI Assistant
===================================================== */


/* =====================================================
   1️⃣ FLOATING CHAT BUBBLE
   ===================================================== */

#chat-bubble {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  padding: 14px 18px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  transition: all 0.3s ease;
  z-index: 10000;
}

#chat-bubble:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(14,165,233,0.4);
}


/* =====================================================
   2️⃣ CHAT WINDOW CONTAINER
   ===================================================== */

#chat-window {
  position: fixed;
  bottom: 90px;
  right: 25px;
  width: 370px;
  height: 500px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  font-family: 'Inter', sans-serif;
  animation: fadeInUp 0.3s ease;
  z-index: 10000;
}


/* =====================================================
   3️⃣ CHAT HEADER
   ===================================================== */

#chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0ea5e9;
padding: 12px;
color: white;
font-weight: bold;
}

/* Close Button */
#chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

#chat-close:hover {
  opacity: 0.7;
}


/* =====================================================
   4️⃣ MESSAGE AREA CONTAINER
   ===================================================== */

#chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.6;
  display: flex;
  flex-direction: column; 
}

/* User strong text inside messages */
#chat-messages p strong {
  color: #38bdf8;
}


/* =====================================================
   5️⃣ INPUT AREA
   ===================================================== */

#chat-input-area {
  display: flex;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(15,23,42,0.95);
}

#chat-input {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: white;
  font-family: 'Inter', sans-serif;
  outline: none;
}

#chat-input::placeholder {
  color: #94a3b8;
}

#chat-send {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  border: none;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

#chat-send:hover {
  opacity: 0.85;
}


/* =====================================================
   6️⃣ OPEN ANIMATION
   ===================================================== */

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


/* =====================================================
   7️⃣ TYPING DOT ANIMATION
   ===================================================== */

.dot {
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) {
  animation-delay: -0.32s;
}

.dot:nth-child(2) {
  animation-delay: -0.16s;
}

.dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}


/* =====================================================
   8️⃣ MESSAGE BUBBLES
   ===================================================== */

.user-message {
  background: #0ea5e9;
  color: black;
  padding: 10px 14px;
  border-radius: 14px;
  margin: 8px 0;
  align-self: flex-end;
  max-width: 80%;
  font-size: 14px;
}

.ai-message {
  background: #1e293b;
  color: white;
  padding: 10px 14px;
  border-radius: 14px;
  margin: 8px 0;
  align-self: flex-start;
  max-width: 85%;
  font-size: 14px;
}


/* =====================================================
   9️⃣ MARKDOWN FORMATTING INSIDE AI MESSAGE
   ===================================================== */

.ai-message h1,
.ai-message h2,
.ai-message h3 {
  font-size: 15px;
  margin-top: 8px;
  margin-bottom: 4px;
  color: #38bdf8;
}

.ai-message p {
  margin-bottom: 6px;
  line-height: 1.4;
}

.ai-message ul {
  margin-left: 16px;
  margin-bottom: 6px;
}

.ai-message li {
  margin-bottom: 4px;
}

.ai-message strong {
  color: #38bdf8;
}


/* =====================================================
   🔟 TYPING INDICATOR CONTAINER
   ===================================================== */

.typing-indicator {
  display: inline-flex;
  gap: 6px;
  padding: 12px 14px;
  background: #1e293b;
  border-radius: 14px;
  margin: 8px 0;
  align-self: flex-start;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0s;
}


/* =====================================================
   1️⃣1️⃣ MESSAGE WRAPPER & LABEL SYSTEM
   ===================================================== */

.message-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 6px 0;
}

.message-wrapper.user {
  align-items: flex-end;
}

.message-wrapper.ai {
  align-items: flex-start;
}

.label {
  font-size: 13px;      
  font-weight: 600; 
  letter-spacing: 0.3px; 
  margin-bottom: 4px;
}

.message-wrapper.user .label {
  color: #38bdf8;      
}

.message-wrapper.ai .label {
  color: #94a3b8;    
}
/* Desktop behavior */

#chat-window {
  display: none;
}

#chat-window.active {
  display: flex;
}
/* ========================================
   PREMIUM MOBILE CHAT EXPERIENCE
======================================== */


/* Overlay default (desktop) */
#chat-overlay {
  display: none;
}
/* Overlay only for mobile */
@media (max-width: 768px) {

  #chat-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
    z-index: 9998;
  }

  #chat-overlay.active {
    opacity: 1;
    visibility: visible;
  }

}

@media (max-width: 768px) {

  #chat-window {
    width: 100%;
    height: 92vh;
    right: 0;
    bottom: 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  #chat-window.active {
    display: flex;
    transform: translateY(0);
  }

  #chat-header {
    padding: 18px;
    font-size: 16px;
  }

  #chat-input-area {
    padding: 10px;
    padding-bottom: 24px; /* iPhone safe area */
  }

  #chat-input {
    font-size: 16px; /* prevents iOS zoom */
  }
}
/* ===== Premium WhatsApp Widget ===== */

.wa-widget {
   position: fixed;
   top: 55px;
   right: 25px;
   z-index: 20000;
   font-family: 'Inter', sans-serif;
}

.wa-button {
   display: flex;
   align-items: center;
   gap: 8px;
   background: linear-gradient(135deg, #25D366, #128C7E);
   color: #fff;
   padding: 12px 18px;
   border-radius: 30px;
   cursor: pointer;
   font-size: 14px;
   font-weight: 600;
   box-shadow: 0 10px 25px rgba(0,0,0,0.4);
   transition: 0.3s ease;
}

.wa-button:hover {
   transform: translateY(-4px);
   box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

.wa-svg {
   width: 18px;
   height: 18px;
}

.wa-chat {
   display: none;
   position: absolute;
   top: 70px;
   right: 0;
   width: 280px;
   background: rgba(15, 23, 42, 0.95);
   backdrop-filter: blur(16px);
   border: 1px solid rgba(255,255,255,0.08);
   border-radius: 18px;
   padding: 18px;
   box-shadow: 0 30px 60px rgba(0,0,0,0.6);
   animation: fadeInUp 0.3s ease;
}

.wa-chat .wa-header {
   font-weight: 600;
   font-size: 14px;
   color: #25D366;
   margin-bottom: 12px;
}

.wa-chat input {
   width: 100%;
   padding: 10px 12px;
   background: rgba(255,255,255,0.05);
   border: 1px solid rgba(255,255,255,0.08);
   border-radius: 10px;
   color: #fff;
   outline: none;
   font-size: 14px;
}

.wa-chat input::placeholder {
   color: #94a3b8;
}

.wa-chat button {
   margin-top: 12px;
   width: 100%;
   padding: 10px;
   background: linear-gradient(135deg, #25D366, #128C7E);
   color: #fff;
   border: none;
   border-radius: 10px;
   font-weight: 600;
   cursor: pointer;
   transition: 0.3s ease;
}

.wa-chat button:hover {
   opacity: 0.85;
}
/* ===============================
   WhatsApp Mobile Optimization
================================= */

@media (max-width: 768px) {

  .wa-widget {
     top: 70px;
     right: 15px;
  }

  .wa-text {
     display: none;
  }

  .wa-button {
     width: 52px;
     height: 52px;
     padding: 0;
     border-radius: 50%;
     justify-content: center;
  }

  .wa-svg {
     width: 20px;
     height: 20px;
  }

  .wa-chat {
     width: 92vw;
     right: 0;
  }

}
