/* ============================================================
   BNS CONSULTANCY — AI Search Assistant Widget Styles
   ============================================================ */

/* Chat Floating Action Button */
.ai-chat-fab {
  position: fixed;
  bottom: 1.75rem;
  left: 1.75rem;
  z-index: 999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--navy-mid));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 206, 209, 0.35);
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  outline: none;
}

.ai-chat-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 206, 209, 0.5);
}

.ai-chat-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(0, 206, 209, 0.35);
  animation: ai-pulse-ring 2.2s ease-out infinite;
  pointer-events: none;
}

.ai-chat-fab i {
  transition: transform 0.4s ease;
}

.ai-chat-fab.open i {
  transform: rotate(90deg);
}

/* Chat Window Container */
.ai-chat-window {
  position: fixed;
  bottom: 6.25rem;
  left: 1.75rem;
  width: 380px;
  height: min(520px, calc(100vh - 140px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 998;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  transform-origin: bottom left;
}

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

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 1.25rem;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chat-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-chat-avatar-main {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 206, 209, 0.15);
  border: 1px solid rgba(0, 206, 209, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-size: 1.1rem;
}

.ai-chat-title-info {
  line-height: 1.2;
}

.ai-chat-title-info h4 {
  color: var(--white);
  font-size: 0.95rem;
  margin: 0;
  font-weight: 600;
}

.ai-chat-title-info span {
  font-size: 0.72rem;
  color: var(--teal);
  font-weight: 500;
}

.ai-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color var(--transition);
  padding: 4px;
}

.ai-chat-close:hover {
  color: var(--white);
}

/* Chat Messages */
.ai-chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

/* Scrollbar styling */
.ai-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--grey-mid);
  border-radius: 99px;
}

/* Message Bubbles */
.ai-message {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  animation: ai-bubble-appear 0.25s cubic-bezier(0.1, 0.8, 0.3, 1) both;
}

.ai-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: var(--white);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 206, 209, 0.15);
}

.ai-message.assistant {
  align-self: flex-start;
  background: var(--white);
  color: var(--dark-text);
  border: 1px solid var(--grey-light);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 43, 72, 0.05);
}

.ai-message.assistant a.ai-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
}

.ai-message.assistant a.ai-btn-link:hover {
  background: var(--teal);
  box-shadow: var(--shadow-teal);
}

/* Typing Indicator */
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  align-items: center;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--grey-text);
  border-radius: 50%;
  display: inline-block;
  animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* Chat Footer / Input */
.ai-chat-footer {
  padding: 1rem;
  border-top: 1px solid var(--grey-light);
  background: var(--white);
}

.ai-chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ai-chat-input {
  flex: 1;
  border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  outline: none;
  background: var(--off-white);
  transition: all var(--transition);
}

.ai-chat-input:focus {
  border-color: var(--teal);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0, 206, 209, 0.1);
}

.ai-chat-send {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.ai-chat-send:hover {
  background: var(--teal);
  transform: translateY(-1px);
  box-shadow: var(--shadow-teal);
}

/* Animations */
@keyframes ai-pulse-ring {
  0% { transform: scale(0.95); opacity: 0.85; }
  50% { opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 0; }
}

@keyframes ai-bubble-appear {
  from { transform: translateY(10px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes ai-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Responsive / Mobile styles */
@media (max-width: 480px) {
  .ai-chat-window {
    width: 100%;
    height: 100%;
    bottom: 0;
    left: 0;
    border-radius: 0;
    border: none;
  }
}
