/* =========================================================
   24/7 AI LEGAL ASSISTANT CHATBOT STYLES
   Al-Mustafa Law Associates & Free Legal Aid Society
   ========================================================= */

/* Floating Launcher Button (Positioned at bottom-right) */
.chat-launcher-wrap {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  left: auto !important;
  z-index: 9995 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
}

.chat-prompt-pill {
  background: linear-gradient(135deg, rgba(27,39,80,0.96), rgba(11,18,36,0.98));
  border: 1px solid rgba(214,178,106,0.5);
  color: #f3dca4;
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 15px rgba(214,178,106,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: promptFloat 4s ease-in-out infinite;
  transition: all 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  white-space: nowrap;
}
.chat-prompt-pill:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: #f3dca4;
  color: #fff;
  box-shadow: 0 14px 40px rgba(0,0,0,0.65), 0 0 22px rgba(214,178,106,0.35);
}
.chat-prompt-close {
  background: none;
  border: 0;
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0 0 6px;
  line-height: 1;
}
.chat-prompt-close:hover { color: #fff; }

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

.chat-launcher-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1b2750 0%, #0b1224 100%);
  border: 2px solid rgba(214,178,106,0.8);
  box-shadow: 0 10px 30px rgba(0,0,0,0.7), 0 0 25px rgba(214,178,106,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  color: #f3dca4;
  outline: none;
}
.chat-launcher-btn:hover {
  transform: scale(1.08) rotate(5deg);
  border-color: #f3dca4;
  box-shadow: 0 14px 40px rgba(0,0,0,0.8), 0 0 35px rgba(214,178,106,0.6);
  color: #fff;
}
.chat-launcher-btn svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s;
}
.chat-launcher-btn.active svg.icon-chat { display: none; }
.chat-launcher-btn:not(.active) svg.icon-close { display: none; }
.chat-launcher-btn.active svg.icon-close {
  display: block;
  transform: rotate(90deg);
}

.chat-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(214,178,106,0.5);
  animation: pulseRing 2.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}
@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

.chat-online-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #070b16;
  box-shadow: 0 0 8px #10b981;
}

/* Chat Window Box */
.chat-window {
  display: none;
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: linear-gradient(165deg, rgba(17,26,51,0.98), rgba(7,11,22,0.99));
  border: 1px solid rgba(214,178,106,0.4);
  border-radius: 22px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.85), 0 0 30px rgba(214,178,106,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  animation: chatSlideUp 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.chat-window.open {
  display: flex;
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.chat-head {
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(27,39,80,0.9), rgba(11,18,36,0.95));
  border-bottom: 1px solid rgba(214,178,106,0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar-box {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #070b16;
  border: 1.5px solid rgba(214,178,106,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f3dca4;
  box-shadow: 0 0 12px rgba(214,178,106,0.3);
}
.chat-avatar-box img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.chat-head-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f3dca4;
  line-height: 1.2;
  margin: 0;
}
.chat-head-info p {
  font-size: 0.72rem;
  color: #9aa3b8;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 0;
}
.chat-status-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-head-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #cfd3de;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.chat-head-btn:hover {
  background: rgba(214,178,106,0.25);
  color: #fff;
  border-color: rgba(214,178,106,0.5);
}

/* Chat Body / Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(circle at 50% 10%, rgba(214,178,106,0.05), transparent 70%);
}
.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(214,178,106,0.3);
  border-radius: 10px;
}

/* Confidentiality Notice Banner */
.chat-notice {
  background: rgba(7,11,22,0.7);
  border: 1px solid rgba(214,178,106,0.2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.72rem;
  color: #9aa3b8;
  text-align: center;
  line-height: 1.4;
}
.chat-notice b { color: #f3dca4; }

/* Message Bubbles */
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  align-items: flex-end;
  animation: msgFade 0.25s ease-out;
}
@keyframes msgFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  align-self: flex-start;
}
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #070b16;
  border: 1px solid rgba(214,178,106,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f3dca4;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

.chat-msg.bot .chat-bubble {
  background: rgba(27,39,80,0.75);
  border: 1px solid rgba(214,178,106,0.25);
  color: #e9e6de;
  border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #d6b26a, #a8823f);
  color: #070b16;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(214,178,106,0.3);
}

.chat-bubble b, .chat-bubble strong {
  font-weight: 700;
  color: #fff;
}
.chat-msg.user .chat-bubble b {
  color: #000;
}

.chat-time {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
  text-align: right;
}
.chat-msg.user .chat-time {
  color: rgba(0,0,0,0.55);
}

/* Quick Topic Chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chat-chip {
  background: rgba(7,11,22,0.8);
  border: 1px solid rgba(214,178,106,0.35);
  color: #f3dca4;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chat-chip:hover {
  background: rgba(214,178,106,0.2);
  border-color: #f3dca4;
  color: #fff;
  transform: translateY(-1px);
}

/* Action Button inside Chat Bubble (e.g. WhatsApp, Call) */
.chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25d366;
  color: #fff !important;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 9px 16px;
  border-radius: 10px;
  margin-top: 10px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(37,211,102,0.35);
  transition: all 0.25s;
  width: 100%;
}
.chat-action-btn:hover {
  background: #1eb857;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37,211,102,0.5);
}

.chat-call-btn {
  background: rgba(214,178,106,0.18);
  border: 1px solid rgba(214,178,106,0.4);
  color: #f3dca4 !important;
  box-shadow: none;
  margin-top: 6px;
}
.chat-call-btn:hover {
  background: rgba(214,178,106,0.3);
  color: #fff !important;
}

/* Typing Indicator Animation */
.chat-typing {
  display: none;
  align-self: flex-start;
  background: rgba(27,39,80,0.7);
  border: 1px solid rgba(214,178,106,0.2);
  padding: 10px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.chat-typing.active {
  display: flex;
  align-items: center;
  gap: 4px;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d6b26a;
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Footer / Input Form */
.chat-foot {
  padding: 12px 14px;
  background: rgba(7,11,22,0.92);
  border-top: 1px solid rgba(214,178,106,0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: rgba(17,26,51,0.8);
  border: 1px solid rgba(214,178,106,0.3);
  border-radius: 12px;
  color: #fff;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus {
  border-color: #f3dca4;
  box-shadow: 0 0 10px rgba(214,178,106,0.25);
}
.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f3dca4, #d6b26a);
  border: 0;
  color: #1a1405;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  flex-shrink: 0;
}
.chat-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(214,178,106,0.45);
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-foot-sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.chat-foot-sub a {
  color: #f3dca4;
  text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chat-window {
    right: 8px;
    bottom: 84px;
    width: calc(100vw - 16px);
    max-width: 420px;
    height: calc(100vh - 100px);
    border-radius: 18px;
  }
  .chat-launcher-wrap {
    bottom: 16px !important;
    right: 16px !important;
    left: auto !important;
  }
  .chat-prompt-pill {
    display: none;
  }
}
