/* Floating FinanceBot Widget Styles */

.financebot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Force hidden state */
.financebot-widget.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Minimized State - Floating Icon */
.financebot-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    position: relative;
    /* Debug: Make sure it's clickable */
    pointer-events: auto;
    user-select: none;
}

.financebot-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.financebot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* Expanded State - Chat Interface */
.financebot-chat {
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e8ed;
}

.financebot-widget.expanded .financebot-icon {
    display: none;
}

.financebot-widget.expanded .financebot-chat {
    display: flex;
}

.financebot-widget.minimized .financebot-chat {
    display: none;
}

.financebot-widget.minimized .financebot-icon {
    display: flex;
}

/* Header */
.financebot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.financebot-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.financebot-logo {
    font-size: 20px;
}

.financebot-controls {
    display: flex;
    gap: 8px;
}

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

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

/* Messages Container */
.financebot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

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

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

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

.financebot-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeInMessage 0.3s ease;
}

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

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

.financebot-message.assistant {
    justify-content: flex-start;
}

.financebot-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;
}

.financebot-message.user .financebot-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.financebot-message.assistant .financebot-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e8ed;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.financebot-typing {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    color: #666;
    font-size: 12px;
}

.financebot-typing-dots {
    display: flex;
    gap: 4px;
}

.financebot-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: typingDots 1.4s infinite;
}

.financebot-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.financebot-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Area */
.financebot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e1e8ed;
}

.financebot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

#financebot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#financebot-input:focus {
    border-color: #667eea;
}

#financebot-input::placeholder {
    color: #999;
}

.financebot-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.financebot-send:hover {
    transform: scale(1.05);
}

.financebot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 480px) {
    .financebot-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .financebot-chat {
        width: 100%;
        height: 400px;
    }
    
    .financebot-icon {
        width: 50px;
        height: 50px;
    }
}

/* Dragging States */
.financebot-widget.dragging {
    pointer-events: none;
    opacity: 0.8;
}

.financebot-widget.dragging .financebot-icon {
    transform: scale(1.1);
}

/* Error Messages */
.financebot-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    font-size: 13px;
}

/* Financial Data Styling */
.financebot-stock-data {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.financebot-price-positive {
    color: #22c55e;
    font-weight: bold;
}

.financebot-price-negative {
    color: #ef4444;
    font-weight: bold;
}