/* BKB Techies Chatbot CSS - Premium & Modern */
:root {
  --bkb-primary: #6366f1;
  --bkb-secondary: #06b6d4;
  --bkb-dark: #1c1c24;
  --bkb-dark-border: rgba(255, 255, 255, 0.1);
  --bkb-text: #ffffff;
  --bkb-text-muted: #9ca3af;
  --bkb-glass-bg: rgba(20, 20, 28, 0.75);
  --bkb-glass-border: rgba(255, 255, 255, 0.08);
  --bkb-font: 'Plus Jakarta Sans', 'Inter', 'Outfit', sans-serif;
}

#bkb-chatbot-container {
  font-family: var(--bkb-font);
  color: var(--bkb-text);
  position: relative;
  /* Do not use cursor: none */
}

#bkb-chatbot-container * {
  box-sizing: border-box;
}

/* Toggle Button */
#bkb-chatbot-toggle {
  position: fixed;
  bottom: 110px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  /* Solid fallback — always visible */
  background: #5254cc;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.55), inset 0 1px 0 rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99998;
  overflow: visible;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

#bkb-chatbot-toggle:hover {
  transform: scale(1.06);
  background: rgba(99, 102, 241, 0.45);
  box-shadow: 0 12px 40px rgba(99,102,241,0.6), inset 0 1px 0 rgba(255,255,255,0.5);
}

#bkb-chatbot-toggle::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  animation: bkb-pulse-ring 2.6s ease-out infinite;
}

@keyframes bkb-pulse-ring {
  0%   { transform: scale(1); opacity: 0.6; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

#bkb-chatbot-toggle svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: absolute;
  pointer-events: none;
}

#bkb-chatbot-toggle .bkb-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

#bkb-chatbot-container.bkb-open #bkb-chatbot-toggle .bkb-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

#bkb-chatbot-container.bkb-open #bkb-chatbot-toggle .bkb-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* Chat Window */
#bkb-chatbot-window {
  position: fixed;
  bottom: 185px;
  right: 28px;
  width: 390px;
  height: 600px;
  max-height: calc(100vh - 200px);
  background: var(--bkb-glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bkb-glass-border);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px inset rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  z-index: 99997;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

#bkb-chatbot-container.bkb-open #bkb-chatbot-window {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.bkb-chat-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bkb-glass-border);
  background: rgba(0,0,0,0.2);
}

.bkb-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bkb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bkb-primary), var(--bkb-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.bkb-title-block {
  display: flex;
  flex-direction: column;
}

.bkb-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.3px;
}

.bkb-subtitle {
  font-size: 12px;
  color: var(--bkb-text-muted);
  margin: 2px 0 0 0;
}

.bkb-close-btn {
  background: transparent;
  border: none;
  color: var(--bkb-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.bkb-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Disclaimer Bar */
.bkb-disclaimer {
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  color: var(--bkb-text-muted);
  background: rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--bkb-glass-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Messages Area */
.bkb-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.bkb-messages::-webkit-scrollbar {
  width: 6px;
}
.bkb-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
}

.bkb-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: bkb-msg-fade 0.3s ease forwards;
}

@keyframes bkb-msg-fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.bkb-msg-content {
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.5;
  display: block;
  word-wrap: break-word;
  white-space: normal;
}

.bkb-msg-content a {
  color: var(--bkb-secondary);
  text-decoration: underline;
}

/* Bot Message */
.bkb-msg.bot {
  align-self: flex-start;
}
.bkb-msg.bot .bkb-msg-content {
  background: var(--bkb-dark);
  border: 1px solid var(--bkb-dark-border);
  border-radius: 18px 18px 18px 4px;
  color: #f3f4f6;
}

/* User Message */
.bkb-msg.user {
  align-self: flex-end;
}
.bkb-msg.user .bkb-msg-content {
  background: linear-gradient(135deg, var(--bkb-primary), var(--bkb-secondary));
  border-radius: 18px 18px 4px 18px;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Typing Indicator */
.bkb-typing {
  display: none;
  align-self: flex-start;
  background: var(--bkb-dark);
  border: 1px solid var(--bkb-dark-border);
  border-radius: 18px 18px 18px 4px;
  padding: 14px 18px;
  gap: 4px;
  align-items: center;
}

.bkb-typing.active {
  display: flex;
}

.bkb-dot {
  width: 6px;
  height: 6px;
  background: var(--bkb-text-muted);
  border-radius: 50%;
  animation: bkb-typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes bkb-typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Quick Replies */
.bkb-chips {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--bkb-glass-border);
  transition: opacity 0.3s ease, height 0.3s ease, padding 0.3s ease;
}
.bkb-chips.hidden {
  opacity: 0;
  height: 0;
  padding: 0;
  pointer-events: none;
  border: none;
}
.bkb-chips::-webkit-scrollbar {
  display: none;
}

.bkb-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 13px;
  color: #e5e7eb;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.bkb-chip:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

/* Input Row */
.bkb-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(0,0,0,0.25);
  border-top: 1px solid var(--bkb-glass-border);
  position: relative;
}

.bkb-action-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bkb-text);
  font-size: 20px;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.bkb-action-btn:hover {
  background: rgba(255,255,255,0.2);
}

.bkb-textarea-wrapper {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
}

.bkb-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 20px;
  max-height: 72px;
  line-height: 1.4;
  outline: none;
}
.bkb-textarea::placeholder {
  color: var(--bkb-text-muted);
}

.bkb-send-btn {
  background: transparent;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bkb-text-muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.bkb-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.bkb-send-btn.active {
  background: var(--bkb-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Action Sheet */
.bkb-action-sheet {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  background: rgba(28, 28, 36, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--bkb-glass-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}
.bkb-action-sheet.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.bkb-action-item {
  background: transparent;
  border: none;
  color: #e5e7eb;
  padding: 12px 16px;
  text-align: left;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease;
}
.bkb-action-item:hover {
  background: rgba(255,255,255,0.08);
}

/* Footer */
.bkb-footer {
  padding: 8px 0;
  text-align: center;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.3);
  letter-spacing: 0.5px;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  #bkb-chatbot-window { 
    width: calc(100vw - 20px); 
    right: 10px; 
    bottom: 160px; 
    height: 75svh; 
    border-radius: 20px; 
  }
  #bkb-chatbot-toggle { 
    right: 24px; 
    bottom: 95px; 
    width: 58px; 
    height: 58px; 
  }
}
