/**
 * ExpenseAutomation Chatbot Widget Styles
 * Floating chat widget with modern design
 */

/* Floating toggle button */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

/* Chat panel */
.chatbot-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 580px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.chatbot-actions {
    display: flex;
    gap: 8px;
}

.chatbot-header button {
    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;
}

.chatbot-header button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Message bubbles */
.chatbot-message {
    display: flex;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.bot-message.thinking .message-content {
    background: #e2e8f0;
    color: #4a5568;
    font-style: italic;
}

/* Message content styling */
.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content a {
    color: #667eea;
    text-decoration: underline;
}

.message-content a:hover {
    color: #764ba2;
}

/* Example questions */
.chatbot-examples {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.example-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.example-questions p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #4a5568;
    font-weight: 500;
}

.example-question {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #2d3748;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.example-question:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateX(4px);
}

/* Footer */
.chatbot-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
}

.chatbot-consent-required {
    margin-bottom: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #fef5e7 0%, #fff9e6 100%);
    border: 2px solid #f39c12;
    border-radius: 8px;
}

.chatbot-consent-required label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #2d3748;
    cursor: pointer;
    font-weight: 500;
}

.chatbot-consent-required input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.chatbot-consent-required .consent-text {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.chatbot-consent-required .consent-text i {
    color: #f39c12;
    font-size: 14px;
}

.chatbot-consent-required .consent-note {
    display: block;
    margin-top: 6px;
    margin-left: 28px;
    font-size: 11px;
    color: #718096;
    font-weight: normal;
    line-height: 1.4;
}

.chatbot-input-group {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#chatbot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

#chatbot-input:focus {
    outline: none;
    border-color: #667eea;
}

#chatbot-input:disabled {
    background-color: #f7fafc;
    color: #a0aec0;
    cursor: not-allowed;
}

.btn-send {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #cbd5e0;
    box-shadow: none;
}

.btn-send:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .chatbot-panel {
        width: calc(100vw - 32px);
        height: calc(100vh - 80px);
        right: 16px;
        bottom: 16px;
    }
    
    .chatbot-toggle {
        right: 16px;
        bottom: 16px;
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
    
    .message-content {
        max-width: 90%;
        font-size: 14px;
    }
    
    #chatbot-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .chatbot-panel {
        background: #1a202c;
    }
    
    .chatbot-messages {
        background: #2d3748;
    }
    
    .bot-message .message-content {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .chatbot-footer {
        background: #1a202c;
        border-top-color: #4a5568;
    }
    
    #chatbot-input {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .example-question {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .example-question:hover {
        background: #4a5568;
    }
    
    .chatbot-examples {
        background: #1a202c;
        border-top-color: #4a5568;
    }
}

/* Accessibility */
.chatbot-toggle:focus,
.btn-send:focus,
#chatbot-input:focus,
.chatbot-header button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading animation for thinking state */
.thinking .message-content::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
}
