/* ==========================================================
   EBENEZER CHATBOT WIDGET — Premium Glassmorphic Design
   ========================================================== */

#church-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Floating Trigger Button */
.chat-trigger {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b8881c 0%, #d4af37 50%, #f5d67a 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px rgba(212, 175, 55, 0.25), 0 4px 12px rgba(0, 0, 0, 0.4);
  color: #030408;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  position: relative;
  touch-action: manipulation;
}

.chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(212, 175, 55, 0.4), 0 6px 16px rgba(0, 0, 0, 0.5);
}

.chat-trigger i {
  width: 24px;
  height: 24px;
}

/* Notification Badge */
.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 10px;
  border: 2px solid #060913;
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Chat Window Container */
.chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 350px;
  height: 480px;
  border-radius: 16px;
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1), transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: bottom right;
}

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

/* Header bar */
.chat-header {
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
  touch-action: manipulation;
}

.chat-close-btn:hover {
  color: #fff;
}

/* Message Display Area */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Individual bubbles */
.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #f3f4f6;
  word-wrap: break-word;
}

.chat-msg.bot {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 2px;
  align-self: flex-start;
}

.chat-msg.user {
  background: linear-gradient(135deg, #9a7215 0%, #b8881c 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 2px;
  color: #fff;
  align-self: flex-end;
}

/* Embedded Links inside Chat */
.chat-msg a {
  color: #f5d67a;
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.2s;
}

.chat-msg a:hover {
  color: #fff;
}

/* Chips list */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  align-self: flex-start;
  width: 100%;
}

.chat-chip {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #f0cf6a;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  touch-action: manipulation;
}

.chat-chip:hover {
  background: rgba(212, 175, 55, 0.16);
  border-color: rgba(212, 175, 55, 0.4);
  color: #fff;
}

/* Message Input Form */
.chat-input-form {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
}

.chat-input-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.chat-input-form input:focus {
  border-color: rgba(212, 175, 55, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.chat-input-form button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #b8881c;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  touch-action: manipulation;
}

.chat-input-form button:hover {
  background: #d4af37;
  transform: scale(1.05);
}

.chat-input-form button i {
  width: 16px;
  height: 16px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  #church-chat-widget {
    bottom: 20px;
    right: 20px;
  }
  
  .chat-window {
    width: 380px;
    height: 480px;
    bottom: 76px;
    right: 0;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #0c1224;
    border: 1px solid rgba(255, 255, 255, 0.12);
  }
}

@media (max-width: 560px) {
  #church-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .chat-trigger {
    width: 56px;
    height: 56px;
    font-size: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }

  /* Fullscreen Slide-Up Overlay on Mobile Phones */
  .chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    bottom: 0 !important;
    right: 0 !important;
    z-index: 999999 !important;
    transform: translateY(100%) !important;
    opacity: 0;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #0c1224 !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease-in-out !important;
  }

  .chat-window.show {
    transform: translateY(0) !important;
    opacity: 1 !important;
  }

  /* Adjust heights and paddings for mobile fullscreen */
  .chat-header {
    padding: 16px 20px !important;
    border-radius: 0 !important;
  }

  /* Add safe-area padding at the bottom of the input container to avoid screen cuts on iOS/Android */
  .chat-input-form {
    padding: 14px 16px !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 16px)) !important;
    background: #0e162c;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .chat-messages {
    padding: 20px 16px !important;
    height: calc(100vh - 140px - env(safe-area-inset-bottom, 16px)) !important;
  }

  .chat-msg {
    max-width: 85% !important;
    font-size: 0.92rem !important;
    padding: 11px 14px !important;
  }
}

