/* Chat Interface Styles for Customer 360° Dashboard */

/* Chat Container Styles */
.chat-container {
    height: 600px;
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-content-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    gap: 0;
    background: #fafbfc;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-width: 0;
    transition: width 0.3s ease;
    background: #fff;
    width: 100%;
}

.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-header h6 {
    color: #fff;
    font-weight: 600;
    margin: 0;
    font-size: 16px;
}

.chat-header .btn {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-header .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}


/* Message Styles */
.message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.user-message .message-content {
    align-items: flex-end;
}

.message-content small {
    font-size: 11px;
    font-weight: 500;
    color: #6c757d;
    padding: 0 4px;
}

.message-bubble {
    background: #f0f2f5;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.ai-message .message-bubble {
    background: #ffffff;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Markdown Content Styles */
.markdown-content {
    text-align: left;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin: 8px 0 4px 0;
    font-weight: 600;
    color: #333;
}

.markdown-content h1 {
    font-size: 18px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 4px;
}

.markdown-content h2 {
    font-size: 16px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 2px;
}

.markdown-content h3 {
    font-size: 14px;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-size: 13px;
}

.markdown-content p {
    margin: 4px 0;
    line-height: 1.4;
}

.markdown-content strong {
    font-weight: 600;
    color: #333;
}

.markdown-content em {
    font-style: italic;
    color: #555;
}

.markdown-content code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 3px;
    padding: 2px 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #e83e8c;
}

.markdown-content pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px;
    margin: 8px 0;
    overflow-x: auto;
}

.markdown-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #333;
    font-size: 11px;
}

.markdown-content ul,
.markdown-content ol {
    margin: 4px 0;
    padding-left: 20px;
}

.markdown-content li {
    margin: 2px 0;
    line-height: 1.3;
}

.markdown-content a {
    color: #007bff;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content blockquote {
    border-left: 4px solid #007bff;
    margin: 8px 0;
    padding: 4px 0 4px 12px;
    background: #f8f9fa;
    font-style: italic;
    color: #666;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 12px;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #e0e0e0;
    padding: 4px 8px;
    text-align: left;
}

.markdown-content th {
    background: #f8f9fa;
    font-weight: 600;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 12px 0;
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

/* Loading Message Styles */
.loading-message {
    animation: fadeIn 0.3s ease-in;
}

.loading-bubble {
    background: #ffffff;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
}

.loading-bubble .fa-spinner {
    color: #667eea;
    font-size: 14px;
}

/* Chat Input Styles */
.chat-input-container {
    padding: 16px 20px;
    border-top: none;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
}

.chat-input-container .input-group {
    margin: 0;
}

.chat-input-container .form-control {
    border-radius: 24px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 18px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-input-container .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.chat-input-container .form-control:disabled {
    background-color: #f7fafc;
    opacity: 0.7;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.chat-input-container .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    transition: all 0.2s ease;
}

.chat-input-container .btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.chat-input-container .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Question Suggestions Styles - Sticky above input */
.question-suggestions-container {
    margin: 0;
    padding: 8px 16px;
    background: #ffffff;
    border: none;
    max-width: 100%;
    flex-shrink: 0;
}

.question-suggestions-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.question-suggestions-header small {
    font-size: 10px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.question-chips-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
}

.question-chip {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    width: 100%;
}

.question-chip:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    transform: translateX(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.25);
}

.question-chip:active {
    transform: translateX(0);
}

.question-chip:hover {
    background: #007bff;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.question-chip:active {
    transform: translateY(0);
}

.question-chip:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.question-chip:disabled:hover {
    background: #fff;
    color: #007bff;
    transform: none;
    box-shadow: none;
}

/* Scrollbar styling for question chips */
.question-chips-wrapper::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.question-chips-wrapper::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 2px;
}

.question-chips-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.question-chips-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Scrollbar styling for chat messages */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
    border: 2px solid #f7fafc;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* AI Insight Panel Styles */
.ai-insight-panel {
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    transition: right 0.3s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.ai-insight-panel.panel-visible {
    right: 0;
}

.ai-insight-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-insight-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.insight-summary h6 {
    color: #333;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 14px;
}

.takeaway-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.takeaway-icon {
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

.takeaway-text {
    flex: 1;
}

.takeaway-text strong {
    display: block;
    font-size: 12px;
    color: #333;
    margin-bottom: 4px;
}

.takeaway-text p {
    font-size: 11px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.insight-expandable {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.insight-section h6 {
    color: #333;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 14px;
}

.analysis-point {
    margin-bottom: 16px;
}

.analysis-point strong {
    display: block;
    font-size: 12px;
    color: #333;
    margin-bottom: 8px;
}

.analysis-point ul {
    margin: 0;
    padding-left: 16px;
    font-size: 11px;
    color: #666;
}

.analysis-point li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.insight-actions {
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.insight-actions .btn {
    font-size: 11px;
    padding: 4px 8px;
}

/* AI Insight Button Active State */
#ai-insight-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

#ai-insight-btn.active:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Auto Insight Summary Styles */
.ai-insight-summary-auto {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.insight-summary-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.insight-summary-header h6 {
    color: #333;
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

.insight-summary-content {
    padding: 16px;
}

.insight-summary-content .takeaway-item {
    margin-bottom: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.insight-summary-content .takeaway-item:last-child {
    margin-bottom: 0;
}

.insight-summary-content .takeaway-icon {
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

.insight-summary-content .takeaway-text {
    flex: 1;
}

.insight-summary-content .takeaway-text strong {
    display: block;
    font-size: 12px;
    color: #333;
    margin-bottom: 4px;
}

.insight-summary-content .takeaway-text p {
    font-size: 11px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* Expandable Content Styles */
.insight-expandable-content {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.insight-expandable-content .insight-section h6 {
    color: #333;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 14px;
}

.insight-expandable-content .analysis-point {
    margin-bottom: 16px;
}

.insight-expandable-content .analysis-point strong {
    display: block;
    font-size: 12px;
    color: #333;
    margin-bottom: 8px;
}

.insight-expandable-content .analysis-point ul {
    margin: 0;
    padding-left: 16px;
    font-size: 11px;
    color: #666;
}

.insight-expandable-content .analysis-point li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.insight-summary-content .insight-actions {
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    margin-top: 16px;
}

.insight-summary-content .insight-actions .btn {
    font-size: 11px;
    padding: 4px 8px;
}

/* Responsive Design for Chat */
@media (max-width: 768px) {
    .chat-container {
        height: 350px;
    }
    
    .chat-messages {
        max-height: 230px;
        padding: 12px;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-input-container {
        padding: 10px 12px;
    }
    
    .ai-insight-content {
        padding: 12px;
    }
    
    .takeaway-item {
        padding: 6px;
        margin-bottom: 8px;
    }
    
    .takeaway-text strong {
        font-size: 11px;
    }
    
    .takeaway-text p {
        font-size: 10px;
    }
}

@media (max-width: 576px) {
    .chat-container {
        height: 300px;
    }
    
    .chat-messages {
        max-height: 180px;
        padding: 8px;
    }
    
    .message-bubble {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .chat-header {
        padding: 8px 10px;
    }
    
    .chat-input-container {
        padding: 8px 10px;
    }
    
    .ai-insight-content {
        padding: 8px;
    }
}
