/* AI Chatbot Styles */

/* Launcher icon switch */
.chatbot-toggle .chatbot-icon { display: none; line-height: 1; }
.chatbot-toggle .chatbot-icon.is-active { display: inline-block; }


#ai-chatbot-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#ai-chatbot-container.bottom-right {
    bottom: 20px;
    right: 20px;
}

#ai-chatbot-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

#ai-chatbot-container.top-right {
    top: 20px;
    right: 20px;
}

#ai-chatbot-container.top-left {
    top: 20px;
    left: 20px;
}

.chatbot-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-window {
    display: none;
    width: 350px;
    height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    position: absolute;
    bottom: 70px;
    right: 0;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.show {
    display: flex;
}

.chatbot-header {
    padding: 15px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
}

.chatbot-logo {
    width: 32px;
    height: 32px;
    border-radius: 0;
    margin-right: 10px;
    object-fit: cover;
}

.chatbot-name {
    font-weight: 600;
    font-size: 18px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 12px;
    line-height: 1.4;
}

.chatbot-messages .message-content a {
    color: #007cba;
    text-decoration: underline;
}

.message.bot .message-content {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 18px 18px 18px 4px;
}

.message.user .message-content {
    background: var(--chatbot-color, #007cba);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.chatbot-input-area {
    padding: 15px;
    border-top: 1px solid #e1e5e9;
    background: white;
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 80px;
}

.chatbot-input:focus {
    border-color: var(--chatbot-color, #007cba);
}

.chatbot-send {
    background: var(--chatbot-color, #007cba);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chatbot-send:hover {
    opacity: 0.8;
}

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

.typing-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    margin: 10px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 20px;
    }
}

/* ===== Animate the CHAT ICON button (launcher) ===== */
@keyframes chatbot-pulse {
  0% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(0, 124, 186, 0); }
  100% { transform: scale(1); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
}

/* Your launcher button is .chatbot-toggle (not #ai-chatbot-toggle) */
#ai-chatbot-container .chatbot-toggle {
  animation: chatbot-pulse 2.2s infinite;
}

/* Stop animation when the chat window is open */
#ai-chatbot-container .chatbot-window.show ~ .chatbot-toggle,
#ai-chatbot-container .chatbot-window.show + .chatbot-toggle {
  animation: none;
}

/* --- Toggle icon switch (before first click) --- */
.chatbot-toggle{
    position: relative;
    overflow: hidden;
}

.chatbot-toggle .chatbot-icon{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none; /* IMPORTANT: don't block the button click */
}

.chatbot-toggle .chatbot-icon.is-active{
    opacity: 1;
    transform: scale(1);
}

/* Ensure chat button is tappable */
.chat-widget,
.chat-toggle,
.chat-icon,
#chat-widget,
#chat-toggle {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent;
  z-index: 999999 !important;
}

/* Prevent big overlays from stealing clicks near the bottom */
.hero,
.slider,
.swiper,
.slick-slider,
.elementor-section,
.elementor-container {
  pointer-events: auto;
}

/* If any fixed overlays exist, they shouldn't block the chat */
.swiper-container,
.slick-list,
.slick-track {
  pointer-events: none;
}

/* Re-enable pointer events for actual slider controls if needed */
.swiper-button-next,
.swiper-button-prev,
.swiper-pagination,
.slick-arrow,
.slick-dots {
  pointer-events: auto;
}

/* ================================
   MOBILE FULL-SCREEN CHAT (CSS ONLY)
   Paste at bottom of style.css
================================= */
@media (max-width: 768px) {

  /* 1) Try common chat window selectors */
  .chat-box,
  .chat-window,
  .chat-container,
  .chat-panel,
  .chat-popup,
  .chatbox,
  #chat-box,
  #chat-window,
  #chat-container {
    position: fixed !important;
    inset: 0 !important;               /* top/right/bottom/left = 0 */
    width: 100vw !important;
    height: 100dvh !important;         /* iOS Safari-friendly viewport height */
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    z-index: 999999 !important;
    background: #fff;
  }

  /* 2) Fallback: if your chatbot has a wrapper, force its OPEN state full-screen
        - Adjust these wrapper IDs/classes if yours differ */
  #ai-chatbot-container .chatbox.show,
  #ai-chatbot-container .chatbox.open,
  #ai-chatbot-container .chatbox.is-open,
  #ai-chatbot-container .chat-window.show,
  #ai-chatbot-container .chat-window.open,
  #ai-chatbot-container .chat-window.is-open {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
  }

  /* 3) iPhone notch + bottom bar safe areas */
  .chat-header {
    padding-top: env(safe-area-inset-top);
  }
  .chat-footer,
  .chat-input,
  .chat-compose {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
