/*
  Back Porch Meetings Floating Chatbot Widget
  
  This CSS creates a floating chatbot that can be embedded in any existing website.
  The widget appears as a small chat icon in the bottom-right corner and expands
  when clicked to show the full chat interface.
*/

/* Floating Chat Widget Container */
.bpm-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}

/* Chat Toggle Button (Floating Icon) */
.bpm-chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bpm-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(79, 70, 229, 0.4);
}

/* Pulse animation for attention */
.bpm-chat-toggle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 50%;
    z-index: -1;
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.4;
    }
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

/* Notification badge */
.bpm-chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Chat Panel (Initially Hidden) */
.bpm-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bpm-chat-panel.open {
    display: flex;
}

/* Chat Header */
.bpm-chat-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bpm-chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bpm-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.bpm-chat-close:hover {
    opacity: 1;
}

/* Chat Messages Area */
.bpm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Styles */
.bpm-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bpm-user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bpm-bot-message {
    align-self: flex-start;
}

.bpm-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.bpm-user-message .bpm-message-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.bpm-bot-message .bpm-message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.bpm-message-content {
    flex: 1;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.bpm-user-message .bpm-message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.bpm-bot-message .bpm-message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 5px;
}

.bpm-message-content p {
    margin: 0;
}

.bpm-message-content p + p {
    margin-top: 8px;
}

.bpm-message-content a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.bpm-user-message .bpm-message-content a {
    color: #bfdbfe;
}

.bpm-message-content strong {
    font-weight: 600;
}

.bpm-message-content code {
    background: #f1f5f9;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.bpm-user-message .bpm-message-content code {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Input Area */
.bpm-chat-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.bpm-chat-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.bpm-chat-input input:focus {
    border-color: #3b82f6;
}

.bpm-chat-input button {
    padding: 10px 15px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    min-width: 60px;
    justify-content: center;
}

.bpm-chat-input button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.bpm-chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Special styling for crisis information in the widget */
.bpm-chat-panel .email-info {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-left: 3px solid #3b82f6;
    padding: 10px;
    border-radius: 6px;
    margin: 5px 0;
    font-size: 0.85rem;
}

.bpm-chat-panel .email-info h4 {
    margin-bottom: 5px;
    color: #1e40af;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bpm-chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .bpm-chat-panel {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        max-width: 350px;
        bottom: 80px;
        right: -15px;
    }
    
    .bpm-chat-toggle {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .bpm-chat-panel {
        width: calc(100vw - 20px);
        right: -10px;
        height: calc(100vh - 90px);
    }
}

/* Scrollbar styling for chat messages */
.bpm-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.bpm-chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.bpm-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.bpm-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Typing indicator */
.bpm-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
}

.bpm-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingDots 1.4s infinite;
}

.bpm-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.bpm-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}