/*
 * ai.css
 * Final Working Version (v18)
 */

/* --- Font & Base Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Main container for the toggle button and chat box */
.ai-assistant-container, .ai-chat-box, .ai-toggle-btn {
    font-family: 'Inter', sans-serif;
}

/* --- Positioning & Visibility (Using your working selectors) --- */
.ai-assistant-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1050;
}

.ai-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, #4361ee, #5a74f1);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}
.ai-toggle-btn:hover {
    transform: scale(1.1);
}

.ai-chat-box {
    width: 370px;
    max-height: 600px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 80px;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
/* This is the class your JS uses to show the window */
.ai-chat-box.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- Chat Box Internals --- */
.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.ai-header-info { display: flex; align-items: center; gap: 12px; }
.ai-header-info i { font-size: 20px; color: #4361ee; }
.ai-title { font-weight: 600; color: #1e293b; }
.ai-status { font-size: 13px; color: #059669; }
.ai-close-btn { background: none; border: none; font-size: 24px; color: #64748b; cursor: pointer; }

.ai-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    display: flex;
    max-width: 85%;
    align-items: flex-start;
    gap: 10px;
}
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4361ee;
    color: white;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.message.user .avatar { background: #64748b; }
.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    display: flex; /* Added for vertical alignment */
    align-items: center; /* Added for vertical alignment */
}
.message.bot .message-content { background: #f1f5f9; color: #1e293b; border-top-left-radius: 4px; }
.message.user .message-content { background: #4361ee; color: white; border-top-right-radius: 4px; }

.ai-footer { display: flex; padding: 15px; border-top: 1px solid #e2e8f0; flex-shrink: 0;}
#aiInput {
    flex-grow: 1;
    border: 1px solid #e2e8f0;
    padding: 12px 15px;
    border-radius: 50px;
    outline-color: #4361ee;
    font-size: 15px;
}
#aiSendBtn {
    background: #4361ee;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}
#aiSendBtn:hover { background: #3a56d4; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(67, 97, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
}

/* === NEW, FINAL, and WORKING DOT ANIMATION === */
.dot-loader {
    display: flex; /* Use flexbox for simple alignment */
    align-items: center;
    gap: 5px; /* Space between dots */
    margin-left: 8px; /* Space from the text */
}

/* This is the style for each individual dot */
.dot-loader::before,
.dot-loader::after,
.dot-loader {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: white; /* Hard-coded to white to ensure visibility */
    animation: dot-bounce 1.4s infinite ease-in-out both;
}

.dot-loader { animation-delay: -0.32s; }
.dot-loader::before { animation-delay: -0.16s; }
/* The third dot is created by the ::after pseudo-element */

@keyframes dot-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1.0);
  }
}

/* === Responsive Media Query (from your file) === */
@media (max-width: 480px) {
    .ai-assistant-container {
        right: 15px;
        bottom: 15px;
    }
    .ai-chat-box {
        width: calc(100vw - 30px);
        max-height: 75vh;
        bottom: 80px;
        right: -15px;
    }
}
.dot-loader { display: inline-flex; /* … */ }
.dot-loader .dot { /* … animation … */ }
.dot-loader .dot:nth-child(1) { animation-delay: 0s; }
.dot-loader .dot:nth-child(2) { animation-delay: 0.16s; }
.dot-loader .dot:nth-child(3) { animation-delay: 0.32s; }

.ripple-letter {
  display: inline-block;
  animation: ripple 1.2s ease-in-out infinite;
}
@keyframes ripple {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

