/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e4e7;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.chat-widget.minimized {
    height: 60px;
    max-height: 60px;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.chat-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.chat-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 300px;
    min-height: 200px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 6px;
}

.message.assistant .message-content {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e0e4e7;
    border-bottom-left-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 8px;
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid #e0e4e7;
    border-radius: 0 0 12px 12px;
    background: #fafafa;
}

.chat-input {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    resize: none;
    font-size: 14px;
    max-height: 80px;
    min-height: 38px;
    background: white;
    transition: border-color 0.2s;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.chat-send-btn {
    background: #667eea;
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.chat-send-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: scale(1.05);
}

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

.chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #666;
    font-style: italic;
    font-size: 13px;
}

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

.typing-dots span {
    width: 4px;
    height: 4px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

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

.empty-chat {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

.calculation-indicator {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 12px;
    color: #1976d2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-widget {
        width: 300px;
        bottom: 10px;
        right: 10px;
    }
    
    .chat-messages {
        max-height: 250px;
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
    }
}