/**
 * Chat Sidebar Component Styles
 * Version: v211
 * 
 * Reusable styles for the AI chat assistant sidebar
 * Used across: questionnaire, results, and custom scenario pages
 */

/* Chat Sidebar Container */
.chat-sidebar {
    width: 400px;
    background: white;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.chat-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.2s;
}

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

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7fafc;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

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

.message-label {
    font-size: 0.85em;
    color: #718096;
    margin-bottom: 6px;
    font-weight: 500;
}

.message-bubble {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    line-height: 1.6;
    color: #2d3748;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-message.user .message-label {
    text-align: right;
}

/* Chat Input Container */
.chat-input-container {
    border-top: 1px solid #e2e8f0;
    background: white;
    padding: 15px;
    flex-shrink: 0;
}

/* Quick Help Buttons */
.quick-help {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-help-btn {
    padding: 8px 12px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-help-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

.quick-help-btn:active {
    transform: translateY(0);
}

/* Chat Input Wrapper */
.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Chat Toggle Button */
.mobile-chat-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 99;
    transition: all 0.3s;
}

.mobile-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.mobile-chat-toggle:active {
    transform: scale(0.95);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chat-sidebar {
        right: -400px;
        transition: right 0.3s ease-in-out;
    }
    
    .chat-sidebar.open {
        right: 0;
    }
    
    .chat-close-btn {
        display: block;
    }
    
    .mobile-chat-toggle {
        display: block;
    }
    
    .mobile-chat-toggle.hidden {
        display: none;
    }
}

@media (max-width: 480px) {
    .chat-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .quick-help-btn {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}

/* Print Styles */
@media print {
    .chat-sidebar,
    .mobile-chat-toggle {
        display: none !important;
    }
}

/* Loading State */
.chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #718096;
    font-size: 0.9em;
    padding: 10px 0;
}

.chat-loading::after {
    content: '...';
    animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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