/* ==========================================================================
   AI Agentic Chatbot Widget Stylesheet - Vanilla CSS
   Premium Glassmorphic and Responsive UI
   ========================================================================== */

/* Font inheritance */
#ai-chat-widget {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #ffffff;
    box-sizing: border-box;
}

#ai-chat-widget * {
    box-sizing: border-box;
}

/* Floating Action Button (FAB) */
.chat-widget-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.4), 0 8px 10px -6px rgba(139, 92, 246, 0.3);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-widget-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 20px 30px -10px rgba(139, 92, 246, 0.6), 0 12px 15px -8px rgba(139, 92, 246, 0.4);
}

.chat-widget-fab:active {
    transform: scale(0.95);
}

.chat-widget-fab svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    transition: transform 0.3s ease;
}

.chat-widget-fab.open svg {
    transform: rotate(90deg);
}

/* Chat Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 400px;
    height: 600px;
    border-radius: 24px;
    background: rgba(17, 22, 37, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget-container.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header Section */
.chat-widget-header {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 82, 246, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-header-text {
    display: flex;
    flex-direction: column;
}

.chat-header-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #a7f3d0;
    font-weight: 300;
}

.chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.chat-header-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Chat Messages Scroll Log */
.chat-messages-log {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Scrollbar styles */
.chat-messages-log::-webkit-scrollbar {
    width: 5px;
}
.chat-messages-log::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

/* Chat Bubbles */
.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: slideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

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

.chat-bubble-wrapper.user {
    align-self: flex-end;
}

.chat-bubble-wrapper.assistant {
    align-self: flex-start;
}

.chat-bubble {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-bubble-wrapper.user .chat-bubble {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    border-top-right-radius: 4px;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.chat-bubble-wrapper.assistant .chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 4px;
    color: #e5e7eb;
}

.chat-bubble-meta {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 5px;
    padding: 0 4px;
}

.chat-bubble-wrapper.user .chat-bubble-meta {
    text-align: right;
}

/* Typing Indicator Bubble */
.chat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    align-self: flex-start;
    animation: slideIn 0.3s ease forwards;
}

.chat-typing-dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Chat Input Field Area */
.chat-widget-footer {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input-field {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input-field:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.chat-input-field::placeholder {
    color: #4b5563;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.3);
}

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

.chat-send-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Mobile Responsiveness Rules */
@media (max-width: 480px) {
    .chat-widget-fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .chat-widget-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }
    
    .chat-widget-container.open {
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Interactive Options & Collected Data Panel Styling
   ========================================================================== */

/* Yes/No Options Button styling */
.chat-options-container {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 5px;
}

.chat-option-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.chat-option-btn.yes {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    border: none;
}

.chat-option-btn.yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.45);
}

.chat-option-btn.yes:active {
    transform: translateY(0);
}

.chat-option-btn.no {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-option-btn.no:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.chat-option-btn.no:active {
    transform: translateY(0);
}

/* Collected Data Panel styling */
.chat-collected-data-panel {
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
}

.chat-data-header {
    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #c084fc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background 0.2s ease;
}

.chat-data-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-data-arrow {
    font-size: 0.65rem;
    color: #a78bfa;
    transition: transform 0.2s ease;
}

.chat-data-body {
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.15);
    max-height: 150px;
    overflow-y: auto;
}

.chat-data-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    line-height: 1.4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 4px;
}

.chat-data-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.chat-data-label {
    color: #9ca3af;
    font-weight: 400;
}

.chat-data-value {
    color: #ffffff;
    font-weight: 600;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

/* Limit form container */
.chat-limit-form-container {
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.chat-limit-form-container textarea.chat-input-field {
    min-height: 80px;
    line-height: 1.4;
    resize: none;
    font-family: inherit;
}

