/* ==========================================================================
   The First Call Solutions - AI Chatbot Widget Stylesheet
   Namespaced strictly under .tfc-bot-* to avoid theme/plugin conflicts.
   ========================================================================== */

/* Floating Launcher Button (Compact 48px x 48px size positioned above WhatsApp icon) */
.tfc-bot-launcher {
    position: fixed !important;
    bottom: 130px !important;
    right: 20px !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 6px 18px rgba(13, 110, 253, 0.4) !important;
    cursor: pointer !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease !important;
    outline: none !important;
}

.tfc-bot-launcher:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 10px 22px rgba(13, 110, 253, 0.5) !important;
}

.tfc-bot-launcher svg {
    width: 22px !important;
    height: 22px !important;
    fill: currentColor !important;
    transition: transform 0.3s ease !important;
}

/* Chat Widget Container (Sits above WhatsApp icon at bottom: 190px) */
.tfc-bot-container {
    position: fixed !important;
    bottom: 190px !important;
    right: 20px !important;
    width: 350px !important;
    height: 540px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 210px) !important;
    background-color: #121826 !important;
    border-radius: 20px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Nastaliq Urdu", Helvetica, Arial, sans-serif !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) scale(0.95) !important;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s !important;
}

.tfc-bot-container.tfc-bot-open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* Widget Header */
.tfc-bot-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    padding: 14px 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.tfc-bot-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.tfc-bot-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
    letter-spacing: 0.5px !important;
}

.tfc-bot-title-wrap {
    display: flex !important;
    flex-direction: column !important;
}

.tfc-bot-title {
    color: #f8fafc !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
}

.tfc-bot-status {
    color: #94a3b8 !important;
    font-size: 11px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin-top: 2px !important;
}

.tfc-bot-status-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background-color: #10b981 !important;
    box-shadow: 0 0 8px #10b981 !important;
}

.tfc-bot-controls {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.tfc-bot-control-btn {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease, color 0.2s ease !important;
    outline: none !important;
}

.tfc-bot-control-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

.tfc-bot-control-btn svg {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
}

/* Chat Messages Container */
.tfc-bot-messages {
    flex: 1 !important;
    padding: 16px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent !important;
}

.tfc-bot-messages::-webkit-scrollbar {
    width: 4px !important;
}

.tfc-bot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 4px !important;
}

/* Message Rows & Speech Bubbles */
.tfc-bot-msg-row {
    display: flex !important;
    flex-direction: column !important;
    max-width: 85% !important;
    animation: tfcBotFadeIn 0.3s ease forwards !important;
}

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

.tfc-bot-assistant {
    align-self: flex-start !important;
}

.tfc-bot-user {
    align-self: flex-end !important;
}

.tfc-bot-bubble {
    padding: 12px 16px !important;
    border-radius: 16px !important;
    font-size: 13.5px !important;
    line-height: 1.5 !important;
    word-break: break-word !important;
    position: relative !important;
}

.tfc-bot-assistant .tfc-bot-bubble {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-bottom-left-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.tfc-bot-user .tfc-bot-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    border-bottom-right-radius: 4px !important;
}

/* Force Assistant Bubble Text High Contrast & Visibility */
.tfc-bot-assistant .tfc-bot-bubble,
.tfc-bot-assistant .tfc-bot-bubble *,
.tfc-bot-bubble span,
.tfc-bot-bubble p,
.tfc-bot-bubble div {
    background: #1e293b !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
    border-bottom-left-radius: 4px !important;
}

/* Badge Tag for 'The First Call' */
.tfc-bot-badge-tag {
    display: inline-block !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    margin-bottom: 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.tfc-bot-badge-rag {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
    -webkit-text-fill-color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

.tfc-bot-badge-ai {
    background-color: rgba(217, 119, 6, 0.25) !important;
    color: #fbbf24 !important;
    -webkit-text-fill-color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.5) !important;
}

/* Typing Indicator */
.tfc-bot-typing-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 12px 16px !important;
    background: #1e293b !important;
    border-radius: 16px !important;
    border-bottom-left-radius: 4px !important;
    width: fit-content !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.tfc-bot-dot {
    width: 6px !important;
    height: 6px !important;
    background-color: #94a3b8 !important;
    border-radius: 50% !important;
    animation: tfcBotBounce 1.4s infinite ease-in-out both !important;
}

.tfc-bot-dot:nth-child(1) { animation-delay: -0.32s !important; }
.tfc-bot-dot:nth-child(2) { animation-delay: -0.16s !important; }

@keyframes tfcBotBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Single Horizontal Row Layout for Input + Mic + Send */
.tfc-bot-input-area {
    padding: 12px 14px !important;
    background: #1e293b !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.tfc-bot-input {
    flex: 1 !important;
    min-width: 0 !important;
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    padding: 10px 12px !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
    font-size: 13.5px !important;
    outline: none !important;
    transition: border-color 0.2s ease !important;
    box-sizing: border-box !important;
}

.tfc-bot-input:focus {
    border-color: #3b82f6 !important;
}

.tfc-bot-input::placeholder {
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
}

/* Voice Mic Button (Middle Horizontal Position) */
.tfc-bot-mic-btn {
    position: static !important;
    transform: none !important;
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

.tfc-bot-mic-btn:hover {
    color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.15) !important;
}

.tfc-bot-mic-btn svg {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
}

/* Voice Recording Active Pulsing Animation */
.tfc-bot-mic-listening {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
    animation: tfcMicPulse 1.2s infinite !important;
}

@keyframes tfcMicPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.tfc-bot-send-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    border: none !important;
    color: #ffffff !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

.tfc-bot-send-btn:hover {
    opacity: 0.9 !important;
    transform: scale(1.05) !important;
}

.tfc-bot-send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.tfc-bot-send-btn svg {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
}

/* Mobile Responsiveness */
@media screen and (max-width: 480px) {
    .tfc-bot-container {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        bottom: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
    }
}
