/* ================================================= */
/*              Bob Widget - Frontend Sales Assistant */
/* ================================================= */

/* Widget container - positioned fixed in bottom right */
.bob-widget {
    position: fixed;
    bottom: 70px;
    right: 20px;
    z-index: 9999;
    font-family: 'Work Sans', sans-serif;
}

/* Widget trigger button */
.bob-widget-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #C2E812;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(194, 232, 18, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #121212;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bob-widget-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(194, 232, 18, 0.6);
}

.bob-widget-trigger:active {
    transform: scale(0.95);
}

/* Pulse animation for attention */
.bob-widget-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: #C2E812;
    animation: bobPulse 2s infinite;
    z-index: -1;
}

@keyframes bobPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Widget chat window */
.bob-widget-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bob-widget-chat.active {
    display: flex;
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Chat header */
.bob-widget-header {
    background: #C2E812;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #121212;
    border-radius: 20px 20px 0 0;
}

.bob-widget-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bob-widget-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(18, 18, 18, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #121212;
}

.bob-widget-info h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.bob-widget-info p {
    margin: 0;
    font-size: 0.85rem;
    color: #121212;
}

.bob-widget-close {
    background: none;
    border: none;
    color: #121212;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.bob-widget-close:hover {
    background: rgba(18, 18, 18, 0.1);
}

/* Chat messages area */
.bob-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.bob-widget-messages::-webkit-scrollbar {
    width: 4px;
}

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

.bob-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Message bubbles */
.bob-widget-message {
    display: flex;
    margin-bottom: 15px;
    animation: bobMessageSlide 0.3s ease-out;
}

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

.bob-widget-message.user {
    justify-content: flex-end;
}

.bob-widget-message.bot {
    justify-content: flex-start;
}

.bob-widget-message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.bob-widget-message.user .bob-widget-message-bubble {
    background: #007AFF;
    color: white;
    border-bottom-right-radius: 6px;
}

.bob-widget-message.bot .bob-widget-message-bubble {
    background: white;
    color: #121212;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 6px;
}

/* Typing indicator */
.bob-widget-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border: 1px solid #e0e0e0;
    max-width: 120px;
    margin-bottom: 15px;
}

.bob-widget-typing-dots {
    display: flex;
    gap: 3px;
}

.bob-widget-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #C2E812;
    animation: bobTypingDot 1.4s infinite ease-in-out;
}

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

@keyframes bobTypingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.bob-widget-input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 15px 20px;
    border-radius: 0 0 20px 20px;
}

.bob-widget-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.bob-widget-input {
    flex: 1;
    min-height: 36px;
    max-height: 100px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #f8f9fa;
    color: #121212;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    overflow-y: auto;
    line-height: 1.4;
}

.bob-widget-input:focus {
    border-color: #C2E812;
    background: white;
    box-shadow: 0 0 0 2px rgba(194, 232, 18, 0.2);
}

.bob-widget-input:disabled {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
}

.bob-widget-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #C2E812;
    color: #121212;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bob-widget-send:hover:not(:disabled) {
    transform: scale(1.1);
}

.bob-widget-send:active {
    transform: scale(0.9);
}

.bob-widget-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Welcome message */
.bob-widget-welcome {
    text-align: center;
    padding: 20px;
    color: #121212;
}

.bob-widget-welcome-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #C2E812;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #121212;
    font-size: 24px;
    margin: 0 auto 15px;
}

.bob-widget-welcome h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #121212;
    margin-bottom: 8px;
}

.bob-widget-welcome p {
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
    color: #121212;
}

/* Quick action buttons */
.bob-widget-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.bob-widget-quick-action {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.85rem;
    color: #121212;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.bob-widget-quick-action:hover {
    background: #f8f9fa;
    border-color: #C2E812;
    transform: translateY(-1px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .bob-widget {
        bottom: 70px;
        right: 15px;
    }
    
    .bob-widget-trigger {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
    
    .bob-widget-chat {
        width: calc(100vw - 30px);
        max-width: 350px;
        height: 600px;
        bottom: 70px;
        right: 0;
    }
    
    .bob-widget-header {
        padding: 15px;
    }
    
    .bob-widget-messages {
        padding: 15px;
    }
    
    .bob-widget-input-area {
        padding: 12px 15px;
    }
    
    .bob-widget-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Ultra-small screens */
@media (max-width: 480px) {
    .bob-widget {
        bottom: 70px;
    }
    
    .bob-widget-chat {
        width: calc(100vw - 20px);
        height: 500px;
        bottom: 70px;
        right: -5px;
    }
}

/* Notification badge */
.bob-widget-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #FF3B30;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    animation: bobNotificationPulse 1s infinite;
}

@keyframes bobNotificationPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Loading state */
.bob-widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #121212;
    font-size: 0.9rem;
}

.bob-widget-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error state */
.bob-widget-error {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #FF3B30;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 10px 0;
    font-size: 0.85rem;
    text-align: center;
}

/* Success state */
.bob-widget-success {
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.3);
    color: #34C759;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 10px 0;
    font-size: 0.85rem;
    text-align: center;
}

/* Formatted text styles */
.bob-widget-message-bubble strong {
    font-weight: 700;
    color: inherit;
}

.bob-widget-message-bubble em {
    font-style: italic;
    color: inherit;
}

/* List formatting */
.bob-widget-message-bubble .bob-list-item {
    display: flex;
    align-items: flex-start;
    margin: 8px 0;
    line-height: 1.5;
}

.bob-widget-message-bubble .bob-list-number {
    font-weight: 600;
    color: #C2E812;
    margin-right: 8px;
    flex-shrink: 0;
    min-width: 20px;
}

.bob-widget-message-bubble .bob-bullet {
    color: #C2E812;
    margin-right: 8px;
    flex-shrink: 0;
    font-weight: 600;
}

/* Ensure proper spacing for lists */
.bob-widget-message-bubble .bob-list-item:first-child {
    margin-top: 4px;
}

.bob-widget-message-bubble .bob-list-item:last-child {
    margin-bottom: 4px;
} 