/* Chatbot Styling */
.chatbot-container {
    position: fixed !important;
    bottom: 40px !important;
    right: 40px !important;
    z-index: 9999 !important;
    background: none;
    box-shadow: none;
    -webkit-box-shadow: none;
    filter: none;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chatbot-icon {
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex !important;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 0;
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 10000;
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-icon:hover {
    transform: scale(1.05);
}

.chatbot-icon i {
    color: white;
    font-size: 28px;
    text-shadow: none;
    -webkit-text-stroke: 0;
    filter: none;
}

.chatbot-logo {
    width: 95%;
    height: 95%;
    border-radius: 50%;
    object-fit: contain;
    background: white;
    padding: 2px;
}

.chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 100px;
    width: 350px;
    height: 450px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chatbot-window.hidden {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    pointer-events: none;
}

.chatbot-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 5px 0;
    display: flex;
}

/* In-message options styling */
.option-list {
    display: block;
    margin-top: 10px;
    line-height: 2;
    padding-left: 5px;
}

.option-list a {
    margin-left: 5px;
}

/* Style for bullet points in chatbot options */
.option-list {
    font-size: 16px;
}

.chatbot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.chatbot-link:hover {
    color: var(--secondary-color, #007799);
    text-decoration: underline;
}

/* In-message options styling */
.option-list {
    display: block;
    margin-top: 10px;
    line-height: 2;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-content {
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
}

.bot .message-content {
    background-color: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.user .message-content {
    background-color: #f0f7ff;
    color: #333;
    border: 1px solid #d0e3ff;
}

.loading .message-content {
    display: flex;
    gap: 3px;
}

.loading .message-content::after {
    content: ".";
    animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {
    0% { content: "."; }
    25% { content: ".."; }
    50% { content: "..."; }
    75% { content: ".."; }
    100% { content: "."; }
}

.chatbot-input {
    display: flex;
    padding: 10px 15px;
    background-color: #f8f8f8;
    border-top: 1px solid #eee;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.chatbot-input input:focus {
    border-color: var(--primary-color);
}

.send-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.send-btn:hover {
    background-color: var(--secondary-color);
}

/* --- Chatbot open/close state classes for smooth transitions --- */
.chatbot-container {
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    pointer-events: auto;
}

/* Only fade out the chatbot window, not the icon, when closed */
.chatbot-container.closed .chatbot-window {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    display: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chatbot-container.closed .chatbot-icon {
    opacity: 1 !important;
    pointer-events: auto !important;
    display: flex !important;
    visibility: visible !important;
}

/* Remove opacity: 0 and pointer-events: none from .chatbot-container.closed so the icon is always visible */
.chatbot-container.closed {
    opacity: 1 !important;
    pointer-events: none !important;
    visibility: visible !important;
}

.chatbot-container.active {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* Hide the chatbot window when closed, but keep the icon visible for reopening */
.chatbot-container.closed .chatbot-window {
    display: none !important;
}

/* Ensure the icon is always clickable, even when closed */
.chatbot-container .chatbot-icon {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Prevent chatbot from blocking page when hidden */
.chatbot-window.hidden,
.chatbot-container.hidden {
    pointer-events: none !important;
}

/* Ensure visible chatbot can interact */
.chatbot-window,
.chatbot-container {
    pointer-events: auto;
}

/* Remove previous .closed overrides for display and box-shadow */
/* Mobile Responsive Styles */
@media (max-width: 600px) {
  .chatbot-container {
    bottom: 10px !important;
    right: 10px !important;
  }
  .chatbot-icon {
    width: 44px;
    height: 44px;
    bottom: 0;
    right: 0;
  }
  .chatbot-window {
    width: 85vw;
    max-width: 350px;
    height: 45vh;
    min-height: 180px;
    right: 5vw;
    bottom: 60px;
    left: auto;
    border-radius: 14px;
  }
  .chatbot-header {
    padding: 8px;
  }
  .chatbot-header-logo {
    width: 24px;
    height: 24px;
    padding: 1px;
  }
  .chatbot-header h3 {
    font-size: 14px;
  }
  .chatbot-messages {
    padding: 7px;
    font-size: 14px;
  }
  .chatbot-input {
    padding: 6px 8px;
  }
  .chatbot-input input {
    font-size: 12px;
    padding: 6px 8px;
  }
  .send-btn {
    width: 32px;
    height: 32px;
    margin-left: 4px;
  }
}

@media (max-width: 400px) {
  .chatbot-window {
    height: 35vh;
    min-height: 120px;
    width: 95vw;
    max-width: 95vw;
    right: 2vw;
  }
  .chatbot-header h3 {
    font-size: 12px;
  }
}
