/* ═════════════════════════════════════════════════════════════════════════════
   JAMIA IMAM MEHDI — AI DONATION ASSISTANT CHATBOT SYSTEM
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── 1. GREETING SPEECH BUBBLE (AUTO POPUP ON LOAD) ── */
.ai-greeting-bubble {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: rgba(6, 49, 38, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(232, 201, 106, 0.55);
  border-radius: 22px 22px 4px 22px;
  padding: 14px 18px;
  color: #ffffff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(232, 201, 106, 0.3);
  opacity: 0;
  transform: translateY(15px) scale(0.92);
  visibility: hidden;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.ai-greeting-bubble.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.ai-gb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-gb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #e8c96a;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.ai-gb-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s ease;
}
.ai-gb-close:hover {
  color: #e8c96a;
}

.ai-gb-text {
  font-size: 0.84rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

.ai-gb-text strong {
  color: #e8c96a;
}

.ai-gb-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #e8c96a;
}

/* ── 2. AI CHATBOT WINDOW MODAL PANEL ── */
.ai-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 100px);
  background: linear-gradient(165deg, #063126 0%, #031c15 100%);
  border: 1.5px solid rgba(232, 201, 106, 0.45);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(232, 201, 106, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px) scale(0.92);
  visibility: hidden;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Chat Header */
.ai-chat-header {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(232, 201, 106, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-ch-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-ch-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8c96a 0%, #c9a84c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #063126;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(232, 201, 106, 0.3);
  flex-shrink: 0;
}

.ai-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #00e676;
  border: 2px solid #063126;
  box-shadow: 0 0 8px #00e676;
}

.ai-ch-txt {
  display: flex;
  flex-direction: column;
}

.ai-ch-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #e8c96a;
  line-height: 1.2;
}

.ai-ch-status {
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.ai-ch-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ai-ch-close:hover {
  background: rgba(232, 201, 106, 0.25);
  color: #e8c96a;
  transform: rotate(90deg);
}

/* Chat Messages Scroll Container */
.ai-chat-body {
  flex-grow: 1;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Message Bubbles */
.ai-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ai-msg.bot {
  align-self: flex-start;
}

.ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(232, 201, 106, 0.2);
  border: 1px solid rgba(232, 201, 106, 0.4);
  color: #e8c96a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-msg-content {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 14px;
  border-radius: 16px 16px 16px 4px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.86rem;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-msg.user .ai-msg-content {
  background: linear-gradient(135deg, #c9a84c 0%, #e8c96a 100%);
  color: #063126;
  font-weight: 600;
  border-radius: 16px 16px 4px 16px;
  border: none;
}

/* 4 Quick Choice Cards Container */
.ai-choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.ai-chip-card {
  background: rgba(232, 201, 106, 0.08);
  border: 1px solid rgba(232, 201, 106, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.ai-chip-card:hover,
.ai-chip-card:active {
  background: linear-gradient(135deg, rgba(232, 201, 106, 0.25) 0%, rgba(232, 201, 106, 0.12) 100%);
  border-color: #e8c96a;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(232, 201, 106, 0.25);
}

.ai-chip-icon {
  font-size: 1.1rem;
  color: #e8c96a;
}

.ai-chip-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.ai-chip-sub {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator Animation */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8c96a;
  animation: typingBlink 1.4s infinite ease-in-out both;
}

.ai-typing span:nth-child(1) { animation-delay: 0s; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Chat Footer Input */
.ai-chat-footer {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(232, 201, 106, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ai-chat-input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
}

.ai-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.ai-chat-input:focus {
  border-color: #e8c96a;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 10px rgba(232, 201, 106, 0.2);
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e8c96a;
  color: #063126;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.ai-send-btn:hover,
.ai-send-btn:active {
  transform: scale(1.06);
  background: #ffffff;
  box-shadow: 0 0 12px rgba(232, 201, 106, 0.5);
}

/* Animations */
@keyframes msgSlideIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes typingBlink {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

@media (max-width: 768px) {
  .ai-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
  }
  .ai-greeting-bubble {
    bottom: 138px;
    right: 14px;
    left: 14px;
    width: auto;
    max-width: calc(100vw - 28px);
    border-radius: 20px;
  }
}
