/* Chat Widget Styles */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #001fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 31, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 31, 255, 0.5);
}

.chatbot-button:active {
    transform: scale(0.95);
}

.chatbot-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chatbot-button.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 31, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 31, 255, 0.6);
    }
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-window.open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #001fff 0%, #0015cc 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: white;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-messages {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 20px 10px 20px 20px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 450px;
    scrollbar-width: thin;
    scrollbar-color: #999 #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
    padding-right: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
    white-space: pre-wrap;
    text-align: left !important;
}

.message.user .message-bubble {
    background: #001fff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Greeting message styles */
#chatbot2-greeting {
    justify-content: flex-start !important;
}

#chatbot2-greeting .message-bubble {
    text-align: left !important;
    direction: ltr !important;
    max-width: 75% !important;
    padding: 12px 16px !important;
    line-height: 1.5 !important;
}

#chatbot2-greeting .message-bubble * {
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 0 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 44px;
    height: 44px;
    box-sizing: border-box;
}

.chatbot-input::placeholder {
    color: #999;
    opacity: 1;
    line-height: 44px;
}

.chatbot-input:focus {
    border-color: #001fff;
}

.chatbot-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #001fff;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    background: #0015cc;
    transform: scale(1.05);
}

.chatbot-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.error-message {
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    color: #c62828;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.error-message.server-down {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

.retry-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    align-self: flex-start;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.retry-button:hover {
    background: #d32f2f;
}

.chatbot-whatsapp-area {
    padding: 12px 16px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
}

.chatbot-whatsapp-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #25D366;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.chatbot-whatsapp-button:hover {
    background: #20BA5A;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    color: white;
}

.chatbot-whatsapp-button:active {
    transform: translateY(0);
}

.chatbot-whatsapp-button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Template Questions Styles */
.template-questions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
    padding: 0;
    animation: fadeIn 0.4s ease;
    max-height: none;
    overflow: visible;
}

.template-question-chip {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.template-question-chip:hover {
    background: #f5f5f5;
    border-color: #001fff;
    color: #001fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 31, 255, 0.15);
}

.template-question-chip:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.template-question-chip.answered {
    animation: fadeOut 0.3s ease forwards;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        position: fixed;
        bottom: 75px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100vh - 120px);
        border-radius: 12px;
        z-index: 10001;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .chatbot-header {
        padding: 12px 16px;
    }

    .chatbot-header h3 {
        font-size: 16px;
    }

    .chatbot-button {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-widget {
        bottom: 15px !important;
        right: 15px !important;
    }
    
    .chatbot-messages {
        max-height: none;
        padding: 15px;
    }
    
    .chatbot-input-area {
        padding: 10px;
    }

    .template-question-chip {
        font-size: 12px;
        padding: 6px 12px;
        max-width: calc(100% - 8px);
    }
}

