/* ==================== AI CHATBOX STYLES ==================== */

/* Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 15px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6B2E2E, #E5B649);
    border: none;
    box-shadow: 0 10px 40px rgba(107, 46, 46, 0.3);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 50px rgba(107, 46, 46, 0.4);
}

.chat-toggle-btn.active {
    background: #4a5568;
    transform: scale(0.95);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    stroke: white;
    transition: all 0.3s ease;
}

.chat-toggle-btn .close-icon {
    display: none;
}

.chat-toggle-btn.active .chat-icon {
    display: none;
}

.chat-toggle-btn.active .close-icon {
    display: block;
}

.online-indicator {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #10b981;
    border-radius: 50%;
    border: 3px solid white;
    animation: pulse-indicator 2s infinite;
}

.chat-toggle-btn.active .online-indicator {
    display: none;
}

@keyframes pulse-indicator {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 384px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-window.hidden {
    display: flex;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #6B2E2E, #4A1F1F);
    padding: 10px;
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 35px;
    height: 35px;
    background: #E5B649;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-avatar svg {
    width: 20px;
    height: 20px;
    stroke: #4A1F1F;
}

.header-info {
    flex: 1;
}

.header-info h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.header-info p {
    font-size: 14px;
    color: #e5e7eb;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.assistant-message .message-avatar {
    background: #6B2E2E;
}

.user-message .message-avatar {
    background: #E5B649;
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.assistant-message .message-content {
    background: white;
    border: 1px solid #e5e7eb;
    border-top-left-radius: 4px;
}

.user-message .message-content {
    background: #6B2E2E;
    color: white;
    border-top-right-radius: 4px;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-time {
    display: block;
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.7;
}

.user-message .message-time {
    color: #e5e7eb;
}

.assistant-message .message-time {
    color: #6b7280;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.typing-indicator .message-avatar {
    background: #6B2E2E;
}

.typing-dots {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    border-top-left-radius: 4px;
    padding: 12px 16px;
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Quick Questions */
.quick-questions {
    margin-top: 16px;
}

.quick-questions-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 8px 4px;
}

.quick-question-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-question-btn:hover {
    background: #6B2E2E;
    color: white;
    border-color: #6B2E2E;
    transform: translateX(4px);
}

.quick-questions.hidden {
    display: none;
}

/* Chat Input Area */
.chat-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

#chatInput:focus {
    border-color: #E5B649;
    box-shadow: 0 0 0 3px rgba(229, 182, 73, 0.1);
}

#chatInput:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.send-btn {
    width: 48px;
    height: 48px;
    background: #6B2E2E;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    position: relative; /* Add this */
}

.send-btn:hover:not(:disabled) {
    background: #4A1F1F;
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg {
    width: 22px;  /* Slightly increased from 20px */
    height: 22px; /* Slightly increased from 20px */
    stroke: white;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
    position: absolute; /* Add this */
    top: 50%;           /* Add this */
    left: 50%;          /* Add this */
    transform: translate(-50%, -50%); /* Add this - centers the SVG perfectly */
}

.powered-by {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablets */
@media (max-width: 768px) {
    .chat-window {
        width: 360px;
        height: 550px;
    }
}

/* Mobile Phones */
@media (max-width: 640px) {
    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .chat-toggle-btn svg {
        width: 24px;
        height: 24px;
    }

    .online-indicator {
        width: 14px;
        height: 14px;
        border-width: 2px;
    }

    .chat-window {
        bottom: 88px;
        right: 16px;
        left: 16px;
        width: calc(100% - 32px);
        height: 500px;
    }

    .chat-header {
        padding: 16px;
    }

    .bot-avatar {
        width: 40px;
        height: 40px;
    }

    .bot-avatar svg {
        width: 24px;
        height: 24px;
    }

    .header-info h3 {
        font-size: 16px;
    }

    .header-info p {
        font-size: 13px;
    }

    .messages-container {
        padding: 12px;
    }

    .message-content {
        max-width: 80%;
    }

    .chat-input-area {
        padding: 12px;
    }

    #chatInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .chat-window {
        height: 450px;
    }

    .message-content p {
        font-size: 13px;
    }

    .quick-question-btn {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-window {
        height: 400px;
    }
}