/* ====================== */
/* CHATBOT CSS STARTS HERE */
/* ====================== */

/* Chatbot Toggle Button */
#chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    background-color: var(--primary);
    color: white;
    padding: 12px 18px;
    border-radius: 50px;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    animation: pulse 2s infinite;
    min-height: 44px;
}

#chatbot-toggle.has-notification::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

#chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Chatbot Container */
#chatbot-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    width: 100%;
    box-shadow: var(--box-shadow);
    border-radius: 16px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    height: 500px;
    background: white;
    border: 1px solid #e2e8f0;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    opacity: 0;
}

#chatbot-container.active {
    display: flex;
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    #chatbot-container {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: calc(100% - 20px);
        height: 60vh;
    }
    
    #chatbot-toggle {
        bottom: 15px;
        right: 15px;
    }
}

/* Chatbot Header */
.chat-header {
    background: var(--premium-gradient);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f0f2f5;
    overflow-y: auto;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: var(--whatsapp-green);
    color: white;
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
    align-self: flex-end;
}

.bot-message {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 18px 18px 18px 4px;
    align-self: flex-start;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    gap: 10px;
    position: relative;
    padding-top: 40px; /* Space for FAQ toggle */
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
    color: #000;
    font-size: 16px; /* Prevents zoom on iOS */
}

.chat-input input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.chat-input button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    min-height: 44px;
    min-width: 44px;
}

.chat-input button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* FAQ Buttons */
.faq-toggle {
    position: absolute;
    top: 10px;
    left: 15px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1;
    min-height: 44px;
}

.faq-toggle:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
}

.faq-container {
    background: white;
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: none;
    max-height: 120px;
    overflow-y: auto;
}

.faq-container.active {
    display: block;
}

.faq-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 5px 0;
}

.faq-buttons button {
    margin: 0;
    padding: 8px 12px;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 44px;
}

.faq-buttons button:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

/* Contact Form */
.contact-form-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: none;
}

.contact-form-container.active {
    display: block;
}

.form-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: var(--gray);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    font-size: 16px; /* Prevents zoom on iOS */
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.form-submit {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    width: 100%;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    min-height: 44px;
}

.form-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.form-loading {
    display: none;
    text-align: center;
    padding: 15px;
    color: var(--dark);
}

.form-success {
    display: none;
    background: rgba(46, 204, 113, 0.1);
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    text-align: center;
}

.form-error {
    display: none;
    background: rgba(231, 76, 60, 0.1);
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    text-align: center;
}

/* Typing Indicator */
.typing-indicator {
    background: white !important;
    padding: 15px !important;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}