/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000 !important; /* Higher than any other element */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    pointer-events: auto; /* Ensure it can be clicked */
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10001 !important; /* Higher than container */
    pointer-events: auto; /* Ensure clickable */
    touch-action: manipulation; /* Better touch handling */
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-window.show {
    display: flex;
}

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

.chatbot-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.message.customer {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    white-space: pre-line; /* Preserve line breaks */
}

.message.customer .message-content {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 5px;
}

/* Enhanced formatting for bot messages */
.message.bot .message-content strong {
    color: #007bff;
    font-weight: 600;
}

.message.bot .message-content h3,
.message.bot .message-content h4 {
    margin: 0 0 8px 0;
    color: #007bff;
    font-size: 16px;
    font-weight: 600;
}

/* Format lists in bot messages */
.message.bot .message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message.bot .message-content li {
    margin-bottom: 4px;
    list-style-type: none;
    position: relative;
}

.message.bot .message-content li:before {
    content: "•";
    color: #007bff;
    font-weight: bold;
    position: absolute;
    left: -15px;
}

/* Emoji and icon styling */
.message.bot .message-content .emoji {
    font-size: 16px;
    margin-right: 4px;
}

/* Highlight important information */
.message.bot .message-content .highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #ffc107;
}

/* Contact info styling */
.message.bot .message-content .contact-info {
    background-color: #e7f3ff;
    padding: 8px;
    border-radius: 6px;
    margin: 8px 0;
    border-left: 3px solid #007bff;
}

/* Service sections */
.message.bot .message-content .service-section {
    margin: 10px 0;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #28a745;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

/* Special styling for contact info messages */
.message.bot[data-message-type="contact-info"] .message-content {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    border: none;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    border-bottom-left-radius: 5px;
}

.message.bot[data-message-type="contact-info"] .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.chatbot-input {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.input-group {
    display: flex;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input input:focus {
    border-color: #007bff;
}

.send-btn {
    background: #007bff;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.send-btn:hover {
    background: #0056b3;
}

.send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.typing-indicator {
    display: none;
    padding: 10px 15px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    max-width: 80%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.typing-dots {
    display: flex;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007bff;
    margin: 0 2px;
    animation: typing 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 {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: 70vh;
        right: -10px;
        bottom: 80px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Ensure chatbot is always visible */
.chatbot-container * {
    pointer-events: auto !important;
}

/* Override any conflicting styles */
.chatbot-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 30px);
        right: -15px;
        height: 400px;
    }
}

/* Scrollbar Styling */
.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
