/* Chatbot Widget Styles */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chat-primary, #007bff);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.chatbot-window {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    flex-direction: column;
    overflow: hidden;
}

.chatbot-window.active {
    display: flex;
}

.chatbot-header {
    background: var(--chat-primary, #007bff);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chatbot-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-name {
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chatbot-close:hover {
    background-color: rgba(255,255,255,0.1);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
}

.message.bot {
    flex-direction: row;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 14px;
}

.message.bot .message-content {
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.user .message-content {
    background: var(--chat-primary, #007bff);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0 0 0 2px rgba(0,123,255,0.25);
}

.chatbot-input:focus {
    border-color: var(--chat-primary, #007bff);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.input-actions {
    display: flex;
    gap: 8px;
}

.input-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.input-btn:hover {
    background: var(--chat-primary, #007bff);
    color: white;
}

.input-btn.recording {
    background: #dc3545;
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.typing-indicator {
    display: none;
    padding: 8px 12px;
    background: white;
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator.active {
    display: block;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #adb5bd;
    border-radius: 50%;
    margin: 0 2px;
    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);
    }
}

/* Product and payment form styles */
.product-card {
    background: white;
    padding: 10px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.product-card strong {
    color: var(--chat-primary, #007bff);
    display: block;
    margin-bottom: 5px;
}

.product-card small {
    color: #6c757d;
    display: block;
}

.payment-form {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 8px 0;
}

.payment-form h4 {
    color: var(--chat-primary, #007bff);
    margin-bottom: 15px;
}

.payment-form .form-group {
    margin-bottom: 15px;
}

.payment-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.payment-form input,
.payment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.payment-form input:focus,
.payment-form textarea:focus {
    outline: none;
    border-color: var(--chat-primary, #007bff);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.payment-form button {
    width: 100%;
    padding: 12px;
    background: var(--chat-primary, #007bff);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.payment-form button:hover {
    background: var(--bs-primary-hover, #0056b3);
}

/* WhatsApp handoff styles */
.whatsapp-handoff {
    background: #25d366;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
}

.whatsapp-handoff p {
    margin-bottom: 10px;
}

.whatsapp-handoff strong {
    display: block;
    margin-bottom: 5px;
}

.whatsapp-handoff button {
    background: white;
    color: #25d366;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.whatsapp-handoff button:hover {
    background: #f8f9fa;
}

/* Fallback contact form styles */
.contact-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.contact-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bs-primary, #007bff);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.contact-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.contact-form {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    padding: 20px;
    display: none;
    z-index: 10000;
}

.contact-form.show {
    display: block;
}

.contact-form h5 {
    margin-bottom: 15px;
    color: var(--bs-primary, #007bff);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .contact-form {
        width: 90vw;
        right: 5vw;
    }
}