﻿/* =============================================
   DCA AI ChatBot Styles
   Author: Denny A Devassy
   Date: 2026-04-05
   ============================================= */

/* ── Floating Widget Button ─────────────────── */
.chatbot-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9998;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #C41E1E;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(196,30,30,0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .chatbot-fab:hover {
        transform: scale(1.08);
        box-shadow: 0 6px 24px rgba(196,30,30,0.45);
    }

    .chatbot-fab i {
        font-size: 24px;
    }

    .chatbot-fab .fab-close {
        display: none;
    }

    .chatbot-fab.active .fab-open {
        display: none;
    }

    .chatbot-fab.active .fab-close {
        display: inline;
    }

    /* Unread badge */
    .chatbot-fab .fab-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #16a34a;
        font-size: 10px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        border: 2px solid #fff;
    }

/* ── Widget Panel ───────────────────────────── */
.chatbot-widget-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9997;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatWidgetSlideUp 0.3s ease-out;
}

[dir="rtl"] .chatbot-widget-panel {
    right: auto;
    left: 28px;
}

[dir="rtl"] .chatbot-fab {
    right: auto;
    left: 28px;
}

@@keyframes chatWidgetSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Full Page Chat Container ───────────────── */
.chatbot-fullpage {
    max-width: 900px;
    margin: 0 auto;
    height: calc(100vh - 220px);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* ── Chat Header ────────────────────────────── */
.chatbot-header {
    background: #C41E1E;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .chatbot-header-avatar img {
        width: 28px;
        height: 28px;
        object-fit: contain;
    }

.chatbot-header-info {
    flex: 1;
}

    .chatbot-header-info h4 {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
    }

    .chatbot-header-info span {
        font-size: 11px;
        opacity: 0.85;
    }

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

    .chatbot-header-actions button {
        background: none;
        border: none;
        color: #fff;
        cursor: pointer;
        padding: 4px;
        opacity: 0.8;
        transition: opacity 0.2s;
        font-size: 16px;
    }

        .chatbot-header-actions button:hover {
            opacity: 1;
        }

/* ── Messages Area ──────────────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

    .chatbot-messages::-webkit-scrollbar {
        width: 4px;
    }

    .chatbot-messages::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 4px;
    }

/* ── Message Bubbles ────────────────────────── */
.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: chatBubbleFadeIn 0.25s ease-out;
}

@@keyframes chatBubbleFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble.user {
    align-self: flex-end;
    background: #C41E1E;
    color: #fff;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .chat-bubble.user {
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 4px;
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .chat-bubble.assistant {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 4px;
}

.chat-bubble-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}

/* ── Welcome Message ────────────────────────── */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
}

.chatbot-welcome-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #fef2f2;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .chatbot-welcome-icon img {
        width: 36px;
        height: 36px;
        object-fit: contain;
    }

.chatbot-welcome h5 {
    margin: 0 0 6px;
    font-size: 16px;
    color: #1a1a1a;
}

.chatbot-welcome p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

/* Quick action chips */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 14px;
}

.quick-action-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

    .quick-action-chip:hover {
        border-color: #C41E1E;
        color: #C41E1E;
        background: #fef2f2;
    }

/* ── Typing Indicator ───────────────────────── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingBounce 1.4s ease-in-out infinite;
}

    .typing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.4;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ── Input Area ─────────────────────────────── */
.chatbot-input-area {
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.chatbot-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

    .chatbot-input-row textarea {
        flex: 1;
        border: 1px solid #d1d5db;
        border-radius: 10px;
        padding: 10px 14px;
        font-size: 14px;
        resize: none;
        max-height: 100px;
        min-height: 42px;
        line-height: 1.4;
        outline: none;
        font-family: inherit;
        transition: border-color 0.2s;
    }

        .chatbot-input-row textarea:focus {
            border-color: #C41E1E;
        }

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #C41E1E;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

    .chatbot-send-btn:hover {
        background: #a31818;
    }

    .chatbot-send-btn:disabled {
        background: #d1d5db;
        cursor: not-allowed;
    }

    .chatbot-send-btn i {
        font-size: 18px;
    }

.chatbot-powered-by {
    text-align: center;
    font-size: 10px;
    color: #9ca3af;
    margin-top: 6px;
}

/* ── Responsive ─────────────────────────────── */
@@media (max-width: 480px) {
    .chatbot-widget-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    [dir="rtl"] .chatbot-widget-panel {
        left: 0;
    }

    .chatbot-fab {
        bottom: 16px;
        right: 16px;
    }

    [dir="rtl"] .chatbot-fab {
        right: auto;
        left: 16px;
    }
}
