/**
 * Chatbot Widget Styles
 * Modern, accessible chatbot interface for Pastor Frankie's Ministry
 */

/* ===== Chatbot Container ===== */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ===== Toggle Button ===== */
.chatbot-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.5);
}

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

.chatbot-icon,
.chatbot-close-icon {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* ===== Chat Window ===== */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chatbot-window.hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

/* ===== Header ===== */
.chatbot-header {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

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

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

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

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

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

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

.chatbot-close-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Messages Container ===== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

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

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

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

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

/* ===== Message Bubbles ===== */
.chatbot-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

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

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-text {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.bot-message .message-text {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .message-text {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-text a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

/* ===== Quick Actions ===== */
.chatbot-quick-actions {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    transition: all 0.3s ease;
}

.chatbot-quick-actions.hidden {
    display: none;
}

.quick-action-btn {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.quick-action-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.quick-action-btn:active {
    transform: translateY(0);
}

/* ===== Input Container ===== */
.chatbot-input-container {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

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

.chatbot-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

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

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== Footer ===== */
.chatbot-footer {
    padding: 8px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.chatbot-footer-text {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
}

.chatbot-footer-text a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.chatbot-footer-text a:hover {
    text-decoration: underline;
}

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

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }

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

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1f2937;
    }

    .chatbot-messages {
        background: #111827;
    }

    .bot-message .message-text {
        background: #374151;
        color: #f9fafb;
    }

    .chatbot-input-container,
    .chatbot-quick-actions {
        background: #1f2937;
        border-top-color: #374151;
    }

    .chatbot-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .chatbot-footer {
        background: #111827;
        border-top-color: #374151;
    }

    .quick-action-btn {
        background: #1e3a8a;
        border-color: #1e40af;
        color: #dbeafe;
    }

    .quick-action-btn:hover {
        background: #1e40af;
        border-color: #2563eb;
    }
}

/* ===== Accessibility ===== */
.chatbot-toggle:focus,
.chatbot-close-btn:focus,
.chatbot-send-btn:focus,
.quick-action-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.chatbot-input:focus {
    outline: none;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}