/* ============================================
   CHATBOT WIDGET STYLES
   ============================================ */

/* Chatbot Toggle Button */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 90px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #002e5f 0%, #0056b3 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 46, 95, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 46, 95, 0.5);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(0, 46, 95, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 46, 95, 0.6), 0 0 0 10px rgba(0, 46, 95, 0.1);
    }
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 90px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-container.active {
    display: flex;
}

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

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #002e5f 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

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

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

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chatbot Body */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-body::-webkit-scrollbar {
    width: 6px;
}

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

.chatbot-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chatbot-body::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Messages */
.chatbot-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

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

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #002e5f 0%, #0056b3 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: #e2e8f0;
    color: #002e5f;
}

.message-content {
    max-width: 75%;
}

.message-content p {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 0 0 8px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.user-message .message-content p {
    background: #002e5f;
    color: white;
}

.message-time {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #002e5f;
    color: #002e5f;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: #002e5f;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 46, 95, 0.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #cbd5e0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Lead Form */
.lead-form {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-top: 8px;
}

.lead-form h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #002e5f;
}

.lead-form-group {
    margin-bottom: 12px;
}

.lead-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #4a5568;
}

.lead-form-group input,
.lead-form-group textarea,
.lead-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.lead-form-group input:focus,
.lead-form-group textarea:focus,
.lead-form-group select:focus {
    outline: none;
    border-color: #002e5f;
}

.lead-form-submit {
    width: 100%;
    padding: 10px;
    background: #002e5f;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.lead-form-submit:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* Chatbot Footer */
.chatbot-footer {
    background: white;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    outline: none;
    border-color: #002e5f;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: #002e5f;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-send-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-powered {
    text-align: center;
    font-size: 11px;
    color: #a0aec0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-toggle {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    .chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 75px;
        right: 10px;
        left: 10px;
        margin: 0 auto;
    }

    .message-content {
        max-width: 85%;
    }
}

/* Tablet and smaller desktop adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    #chatbot-widget {
        right: 80px;
    }
    
    .chatbot-container {
        right: 80px;
    }
}

/* Dark Mode Support */
body.dark-mode .chatbot-container {
    background: #1a202c;
}

body.dark-mode .chatbot-body {
    background: #2d3748;
}

body.dark-mode .chatbot-footer {
    background: #1a202c;
    border-top-color: #4a5568;
}

body.dark-mode .message-content p {
    background: #374151;
    color: #e2e8f0;
}

body.dark-mode .chatbot-input {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .quick-reply-btn {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .quick-reply-btn:hover {
    background: #002e5f;
    color: white;
}

body.dark-mode .lead-form {
    background: #374151;
}

body.dark-mode .lead-form-group input,
body.dark-mode .lead-form-group textarea,
body.dark-mode .lead-form-group select {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}