/* ===================== */
/* Birlab AI Chat Widget */
/* ===================== */

/* ---- Floating Chat Button ---- */
.birlab-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(100, 15, 255, 0.35);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(.34,1.56,.64,1), box-shadow 0.4s ease;
  animation: birlabBtnEntry 0.6s cubic-bezier(.34,1.56,.64,1) both,
             birlabPulseRing 3s ease-in-out 2s infinite;
}

.birlab-chat-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100,15,255,0.25) 0%, transparent 70%);
  animation: birlabGlowPulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.birlab-chat-btn.active {
  background: linear-gradient(135deg, #640FFF 0%, #8B5CF6 100%);
  padding: 0;
  animation: birlabBtnRotateIn 0.4s cubic-bezier(.34,1.56,.64,1) both;
}

.birlab-chat-btn.active::before {
  animation: none;
  opacity: 0;
}

.birlab-chat-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 32px rgba(100, 15, 255, 0.5);
}

.birlab-chat-btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.birlab-chat-btn .icon-chat {
  display: block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.birlab-chat-btn.active .icon-chat {
  display: none;
}

.birlab-chat-btn svg.icon-close {
  display: none;
  animation: birlabSpinIn 0.4s cubic-bezier(.34,1.56,.64,1) both;
}

.birlab-chat-btn.active svg.icon-close {
  display: block;
}

@keyframes birlabBtnEntry {
  0% { opacity: 0; transform: scale(0) translateY(40px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes birlabBtnRotateIn {
  0% { transform: scale(0.8) rotate(-90deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes birlabSpinIn {
  0% { transform: rotate(-180deg) scale(0); opacity: 0; }
  100% { transform: rotate(0deg) scale(1); opacity: 1; }
}

@keyframes birlabGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 0; }
}

@keyframes birlabPulseRing {
  0%, 100% { box-shadow: 0 4px 24px rgba(100,15,255,0.35); }
  50% { box-shadow: 0 4px 24px rgba(100,15,255,0.35), 0 0 0 12px rgba(100,15,255,0.08); }
}

/* ---- Chat Window ---- */
.birlab-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 390px;
  max-width: calc(100vw - 40px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(100,15,255,0.06);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(.16,1,.3,1),
              transform 0.4s cubic-bezier(.16,1,.3,1);
}

.birlab-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- Chat Header ---- */
.birlab-chat-header {
  background: linear-gradient(135deg, #640FFF 0%, #7c3aed 50%, #8B5CF6 100%);
  background-size: 200% 200%;
  animation: birlabHeaderGradient 6s ease infinite;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.birlab-chat-header::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes birlabHeaderGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.birlab-chat-header-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #640FFF;
  font-size: 14px;
  font-family: 'Outfit', sans-serif;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  animation: birlabLogoFloat 3s ease-in-out infinite;
}

@keyframes birlabLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.birlab-chat-header-info {
  flex: 1;
}

.birlab-chat-header-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  margin: 0;
  letter-spacing: 0.3px;
}

.birlab-chat-header-subtitle {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  margin: 0;
}

.birlab-chat-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s, transform 0.2s;
}

.birlab-chat-close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
  transform: rotate(90deg);
}

/* ---- Chat Body ---- */
.birlab-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #f8f7fc 0%, #f3f1fa 100%);
  scroll-behavior: smooth;
}

.birlab-chat-body::-webkit-scrollbar {
  width: 5px;
}

.birlab-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.birlab-chat-body::-webkit-scrollbar-thumb {
  background: #d4d0e0;
  border-radius: 10px;
}

/* ---- Messages ---- */
.birlab-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  font-family: 'Outfit', sans-serif;
  animation: birlabMsgSlideIn 0.45s cubic-bezier(.16,1,.3,1) both;
  position: relative;
}

@keyframes birlabMsgSlideIn {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.birlab-msg.bot {
  background: #fff;
  color: #1a1a2e;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(100, 15, 255, 0.06);
  animation-name: birlabBotMsgIn;
}

@keyframes birlabBotMsgIn {
  0% {
    opacity: 0;
    transform: translateX(-20px) translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

.birlab-msg.user {
  background: linear-gradient(135deg, #640FFF 0%, #8B5CF6 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 12px rgba(100, 15, 255, 0.2);
  animation-name: birlabUserMsgIn;
}

@keyframes birlabUserMsgIn {
  0% {
    opacity: 0;
    transform: translateX(20px) translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
  }
}

/* ---- Typing Indicator ---- */
.birlab-typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  align-self: flex-start;
  background: #fff;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(100, 15, 255, 0.06);
  animation: birlabBotMsgIn 0.3s cubic-bezier(.16,1,.3,1) both;
}

.birlab-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #640FFF, #8B5CF6);
  animation: birlabTypingBounce 1.4s ease infinite;
}

.birlab-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.birlab-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes birlabTypingBounce {
  0%, 60%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-8px) scale(1.15);
    opacity: 1;
  }
}

/* ---- Chat Input ---- */
.birlab-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(100,15,255,0.06);
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  flex-shrink: 0;
}

.birlab-chat-input {
  flex: 1;
  border: 1.5px solid #e8e5f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: #f8f7fc;
  color: #1a1a2e;
}

.birlab-chat-input:focus {
  border-color: #8B5CF6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

.birlab-chat-input::placeholder {
  color: #999;
}

.birlab-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #640FFF 0%, #8B5CF6 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.birlab-chat-send::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.3s ease;
}

.birlab-chat-send:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(100,15,255,0.35);
}

.birlab-chat-send:hover::after {
  transform: scale(1);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.birlab-chat-send:active {
  transform: scale(0.95);
}

.birlab-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.birlab-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  transition: transform 0.2s ease;
}

.birlab-chat-send:hover svg {
  transform: translateX(2px);
}

/* ---- Quick Option Buttons ---- */
.birlab-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  animation: birlabOptionsIn 0.5s cubic-bezier(.16,1,.3,1) both;
}

@keyframes birlabOptionsIn {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.birlab-option-btn {
  padding: 9px 18px;
  border-radius: 22px;
  border: 1.5px solid rgba(100,15,255,0.3);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  color: #640FFF;
  font-size: 13px;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  position: relative;
  overflow: hidden;
  animation: birlabOptionPop 0.4s cubic-bezier(.34,1.56,.64,1) both;
}

.birlab-option-btn:nth-child(1) { animation-delay: 0.05s; }
.birlab-option-btn:nth-child(2) { animation-delay: 0.1s; }
.birlab-option-btn:nth-child(3) { animation-delay: 0.15s; }
.birlab-option-btn:nth-child(4) { animation-delay: 0.2s; }
.birlab-option-btn:nth-child(5) { animation-delay: 0.25s; }
.birlab-option-btn:nth-child(6) { animation-delay: 0.3s; }
.birlab-option-btn:nth-child(7) { animation-delay: 0.35s; }
.birlab-option-btn:nth-child(8) { animation-delay: 0.4s; }
.birlab-option-btn:nth-child(9) { animation-delay: 0.45s; }
.birlab-option-btn:nth-child(10) { animation-delay: 0.5s; }

@keyframes birlabOptionPop {
  0% { opacity: 0; transform: scale(0.7) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.birlab-option-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #640FFF 0%, #8B5CF6 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.birlab-option-btn:hover {
  border-color: #640FFF;
  color: #fff;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 16px rgba(100,15,255,0.25);
}

.birlab-option-btn:hover::before {
  opacity: 1;
}

.birlab-option-btn:active {
  transform: translateY(0) scale(0.97);
}

/* ---- Download Button ---- */
.birlab-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), box-shadow 0.3s ease;
  animation: birlabBounceIn 0.5s cubic-bezier(.34,1.56,.64,1) both;
  position: relative;
  overflow: hidden;
}

@keyframes birlabBounceIn {
  0% { opacity: 0; transform: scale(0.5) translateY(12px); }
  60% { transform: scale(1.08) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.birlab-download-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: birlabShimmer 2.5s ease infinite 1s;
}

@keyframes birlabShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.birlab-download-btn:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.birlab-download-btn:active {
  transform: scale(0.97);
}

.birlab-download-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---- Summary Card ---- */
.birlab-summary-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  margin-top: 4px;
  box-shadow: 0 2px 12px rgba(100, 15, 255, 0.06);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: #1a1a2e;
  line-height: 1.65;
  border: 1px solid rgba(100,15,255,0.06);
  animation: birlabCardIn 0.5s cubic-bezier(.16,1,.3,1) both;
  position: relative;
  overflow: hidden;
}

.birlab-summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #640FFF, #8B5CF6, #a78bfa, #8B5CF6, #640FFF);
  background-size: 200% 100%;
  animation: birlabCardTopBar 3s linear infinite;
}

@keyframes birlabCardTopBar {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

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

.birlab-summary-card strong {
  color: #640FFF;
}

.birlab-disclaimer {
  font-size: 11px;
  color: #888;
  margin-top: 8px;
  line-height: 1.5;
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid #f0eef5;
}

/* ---- Call Overlay ---- */
.birlab-call-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0f0a1e 0%, #1a1040 50%, #0f0a1e 100%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: birlabCallFadeIn 0.4s ease both;
  border-radius: 24px;
}

@keyframes birlabCallFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.birlab-call-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.birlab-call-ring-circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(100,15,255,0.3);
  animation: birlabCallRing 2s ease-out infinite;
}

.birlab-call-ring-circle.d2 {
  animation-delay: 0.6s;
}

@keyframes birlabCallRing {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.birlab-call-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #640FFF, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  box-shadow: 0 4px 30px rgba(100,15,255,0.4);
  animation: birlabCallPulse 2s ease infinite;
}

@keyframes birlabCallPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.birlab-call-connected-icon {
  font-size: 60px;
  animation: floatIn 0.5s cubic-bezier(.34,1.56,.64,1) both;
}

.birlab-call-status {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  animation: birlabCallBlink 1.5s ease infinite;
}

.birlab-call-status.birlab-call-connected {
  animation: none;
  font-size: 22px;
}

@keyframes birlabCallBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.birlab-call-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.birlab-call-timer {
  font-family: 'Outfit', sans-serif;
  font-size: 40px;
  font-weight: 300;
  color: #fff;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}

.birlab-call-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 20px;
}

.birlab-call-bars span {
  width: 3px;
  border-radius: 2px;
  background: #10b981;
  animation: birlabAudioBar 0.8s ease infinite;
}

.birlab-call-bars span:nth-child(1) { height: 6px; animation-delay: 0s; }
.birlab-call-bars span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.birlab-call-bars span:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.birlab-call-bars span:nth-child(4) { height: 18px; animation-delay: 0.15s; }
.birlab-call-bars span:nth-child(5) { height: 8px; animation-delay: 0.25s; }

@keyframes birlabAudioBar {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.5); }
}

.birlab-call-hangup {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 20px;
  box-shadow: 0 4px 24px rgba(239,68,68,0.4);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), box-shadow 0.3s;
}

.birlab-call-hangup svg {
  width: 28px;
  height: 28px;
}

.birlab-call-hangup:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(239,68,68,0.5);
}

.birlab-call-hangup:active {
  transform: scale(0.95);
}

.birlab-call-hangup-label {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
}

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

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .birlab-chat-window {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .birlab-chat-btn {
    bottom: 16px;
    right: 16px;
    width: 58px;
    height: 58px;
  }
}
