/**
 * Demo Chatbot Styles
 * Styles for AI Chatbot Demo including drag-and-drop file upload
 */

/* ========== File Upload Drop Zone ========== */
#file-drop-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#file-drop-zone:hover {
    border-color: #4299e1;
    background-color: #ebf8ff;
}

#file-drop-zone.drag-over {
    border-color: #3182ce;
    background-color: #bee3f8;
    transform: scale(1.02);
}

.drop-zone-content {
    width: 100%;
}

.drop-zone-content i {
    display: block;
    margin: 0 auto;
}

#file-input {
    display: none;
}

/* ========== Upload Status ========== */
.upload-status {
    text-align: center;
    padding: 20px;
}

.upload-status.uploading .spinner-border {
    width: 3rem;
    height: 3rem;
}

.upload-status.success i,
.upload-status.error i {
    display: block;
    margin: 0 auto;
}

.data-summary {
    margin: 15px 0;
}

.data-summary .badge {
    margin: 0 5px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ========== Suggested Queries ========== */
.suggested-queries {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: left;
}

.suggested-queries h6 {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2d3748;
}

.suggested-queries ul {
    margin: 0;
    padding: 0;
}

.suggested-queries ul li {
    margin-bottom: 8px;
}

.btn-query {
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 6px;
}

.btn-query:hover {
    background-color: #4299e1;
    color: white;
    border-color: #4299e1;
}

/* ========== Chatbot Container ========== */
.demo-chatbot-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.chatbot-header {
    background: #000000;
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    text-align: center;
}

.chatbot-header h3 {
    margin: 0;
    font-weight: 600;
}

.chatbot-header p {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* ========== Chat Messages Area ========== */
.chat-messages {
    background-color: white;
    padding: 20px;
    min-height: 550px;
    max-height: 750px;
    overflow-y: auto;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

.chat-message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-in;
}

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

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.message-avatar.user-avatar {
    background-color: #4299e1;
    color: white;
    margin-left: 10px;
}

.message-avatar.assistant-avatar {
    background-color: #000000;
    color: white;
    margin-right: 10px;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.chat-message.user .message-content {
    background-color: #4299e1;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background-color: #f7fafc;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.message-timestamp {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 4px;
}

/* ========== Chat Input Area ========== */
.chat-input-area {
    background-color: white;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.chat-input-wrapper input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.chat-input-wrapper button {
    padding: 12px 24px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-input-wrapper button:hover {
    background-color: #3182ce;
}

.chat-input-wrapper button:disabled {
    background-color: #cbd5e0;
    cursor: not-allowed;
}

/* ========== Visualization Panel ========== */
.visualization-panel {
    margin: 20px 0;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.visualization-panel h5 {
    margin-bottom: 15px;
    color: #2d3748;
    font-weight: 600;
}

.chart-container {
    width: 100%;
    min-height: 400px;
}

/* ========== Typing Indicator ========== */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #f7fafc;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid #e2e8f0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #a0aec0;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ========== Feedback Widget (Task 12) ========== */
.feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    align-items: center;
}

.feedback-prompt {
    font-size: 0.85rem;
    color: #718096;
    margin-right: 8px;
}

.feedback-prompt.feedback-submitted {
    color: #48bb78;
    font-weight: 500;
}

.feedback-btn {
    background: none;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    color: #718096;
}

.feedback-btn:hover:not(:disabled) {
    background-color: #f7fafc;
    border-color: #cbd5e0;
    color: #2d3748;
    transform: translateY(-1px);
}

.feedback-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.feedback-btn.active {
    background-color: #bee3f8;
    border-color: #4299e1;
    color: #2c5282;
}

.feedback-thumbs-up.active {
    background-color: #c6f6d5;
    border-color: #48bb78;
    color: #22543d;
}

.feedback-thumbs-down.active {
    background-color: #fed7d7;
    border-color: #fc8181;
    color: #742a2a;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .demo-chatbot-container {
        padding: 10px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-messages {
        min-height: 300px;
        max-height: 400px;
    }
    
    #file-drop-zone {
        padding: 30px 15px;
        min-height: 200px;
    }
    
    .btn-query {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}

/* ========== Utility Classes ========== */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.text-muted {
    color: #718096;
}

.text-success {
    color: #48bb78;
}

.text-danger {
    color: #f56565;
}

.small {
    font-size: 0.875rem;
}

/* ========== Loading State ========== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========== Conversion CTA ========== */
.conversion-cta {
    background: #000000;
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
}

.conversion-cta h4 {
    margin: 0 0 10px 0;
    font-weight: 600;
}

.conversion-cta p {
    margin: 0 0 15px 0;
    opacity: 0.9;
}

.conversion-cta .btn {
    background-color: white;
    color: #667eea;
    border: none;
    padding: 10px 24px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.conversion-cta .btn:hover {
    transform: scale(1.05);
}

/* ========== Task 9: New Demo Chat Styles ========== */

/* Chat Container */
.demo-chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 750px;
    display: flex;
    flex-direction: column;
}

.demo-chat-header {
    background: #000000;
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-chat-header h5 {
    color: white;
    font-size: 1.1rem;
}

.demo-chat-header small {
    color: rgba(255, 255, 255, 0.8);
}

/* Chat Messages */
.demo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
}

/* Drag & Drop Zone for Chat Messages */
.demo-dropzone-area {
    position: relative;
    transition: background-color 0.3s ease;
}

.demo-dropzone-area.drag-over {
    background-color: rgba(66, 153, 225, 0.1);
    border: 2px dashed #4299e1;
}

.demo-dropzone-area.drag-over::after {
    content: "Drop your Excel file here";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 40px;
    border-radius: 8px;
    border: 2px solid #4299e1;
    font-weight: 600;
    color: #2c5282;
    z-index: 1000;
    pointer-events: none;
}

.demo-chat-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

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

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

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

.demo-message-bot {
    justify-content: flex-start;
}

.demo-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.demo-message-user .demo-message-avatar {
    background-color: #4299e1;
    color: white;
    margin-left: 10px;
    order: 2;
}

.demo-message-bot .demo-message-avatar {
    background-color: #000000;
    color: white;
    margin-right: 10px;
}

.demo-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.demo-message-user .demo-message-content {
    background-color: #4299e1;
    color: white;
    border-bottom-right-radius: 4px;
}

.demo-message-bot .demo-message-content {
    background-color: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.demo-message-error .demo-message-content {
    background-color: #fff5f5;
    border-color: #fc8181;
    color: #c53030;
}

/* Typing Indicator */
.demo-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.demo-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #a0aec0;
    animation: typingDot 1.4s infinite;
}

.demo-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Suggestions */
.demo-suggestions-wrapper {
    border-top: 1px solid #e2e8f0;
    background-color: #f8f9fa;
}

.demo-suggestions-toggle {
    padding: 10px 20px;
    background-color: #f8f9fa;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #2d3748;
    transition: background-color 0.2s;
}

.demo-suggestions-toggle:hover {
    background-color: #e2e8f0;
}

.demo-suggestions-toggle i {
    transition: transform 0.3s ease;
}

.demo-suggestions-toggle.collapsed i {
    transform: rotate(180deg);
}

.demo-suggestions {
    padding: 0 20px 10px 20px;
    background-color: #f8f9fa;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.demo-suggestions.collapsed {
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
}

.demo-suggestion-chip {
    background-color: white;
    border: 1px solid #cbd5e0;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.demo-suggestion-chip:hover {
    background-color: #000000;
    color: white;
    border-color: #000000;
    transform: translateY(-2px);
}

/* Integrated Upload Area */
.demo-integrated-upload {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #e2e8f0;
}

.demo-integrated-upload .demo-upload-progress {
    margin-bottom: 15px;
}

.demo-integrated-upload .demo-data-summary {
    margin: 0;
}

.demo-integrated-upload .alert {
    margin: 0;
    padding: 12px 16px;
    border-radius: 8px;
}

/* Chat Input */
.demo-chat-input {
    padding: 15px 20px;
    background-color: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.demo-chat-input input[type="file"] {
    display: none;
}

.demo-upload-btn {
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #000000 !important;
    color: white !important;
    border: 2px solid #000000 !important;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.demo-upload-btn:hover {
    background-color: #333333 !important;
    border-color: #333333 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.demo-upload-btn:active,
.demo-upload-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3) !important;
}

.demo-chat-input input[type="text"] {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.demo-chat-input input[type="text"]:focus {
    outline: none;
    border-color: #000000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.demo-chat-input button[type="submit"],
.demo-send-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Upload Section */
.demo-dropzone {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-dropzone:hover {
    border-color: #000000;
    background-color: #f5f5f5;
}

.demo-dropzone-active {
    border-color: #000000;
    background-color: #e8e8e8;
    transform: scale(1.02);
}

.demo-dropzone-content {
    width: 100%;
}

.demo-upload-progress {
    width: 100%;
    text-align: center;
}

.demo-upload-progress .progress {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.demo-data-summary {
    margin-top: 15px;
}

/* Visualization Section */
.demo-visualization-container {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    min-height: 300px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-visualization-placeholder {
    text-align: center;
    color: #a0aec0;
}

/* Chart wrapper - when visualization is displayed */
.demo-chart-wrapper {
    width: 100%;
    min-height: 400px;
}

.demo-visualization-container:has(.demo-chart-wrapper) {
    display: block;
    align-items: initial;
    justify-content: initial;
}

.demo-visualization-container .plotly {
    width: 100%;
}

.demo-chart-wrapper .plotly-graph-div {
    width: 100% !important;
    height: 100% !important;
}

/* ========== Demo Page Background Override ========== */
.container-xxl.mt-5.py-5 {
    background-color: #ffffff !important;
}

/* Override Bootstrap alert-info for demo examples section */
.demo-examples-section .alert-info {
    background-color: #e8f4f8 !important;
    border-color: #b8dce8 !important;
    color: #0c5460 !important;
}

/* Data Preview Table */
.demo-data-preview {
    max-width: 100%;
    margin: 15px 0;
}

.demo-data-preview table {
    min-width: 500px;
}

.demo-data-preview th {
    position: sticky;
    top: 0;
    background: #f8f9fa !important;
    z-index: 10;
}

.demo-data-preview td,
.demo-data-preview th {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .demo-chat-container {
        height: 650px;
        margin-bottom: 20px;
    }

    .demo-message-content {
        max-width: 85%;
    }

    .demo-visualization-container {
        min-height: 250px;
    }

    .demo-chat-input {
        padding: 12px 15px;
        gap: 8px;
    }

    .demo-upload-btn {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .demo-chat-input input[type="text"] {
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    .demo-send-btn {
        padding: 8px 16px;
        font-size: 1rem;
    }

    /* On tablets and below, stack examples and chat vertically */
    .demo-examples-section {
        margin-bottom: 20px;
    }
}

@media (max-width: 576px) {
    .demo-chat-container {
        height: 550px;
    }

    .demo-chat-messages {
        padding: 15px;
    }

    .demo-message-content {
        max-width: 90%;
        font-size: 0.9rem;
    }

    .demo-chat-input {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .demo-upload-btn {
        order: 1;
        flex-basis: 40px;
    }

    .demo-chat-input input[type="text"] {
        order: 2;
        flex-basis: calc(100% - 100px);
        margin: 5px 0;
    }

    .demo-send-btn {
        order: 3;
        flex-basis: 40px;
    }

    .demo-dropzone-area.drag-over::after {
        padding: 15px 20px;
        font-size: 0.9rem;
    }

    /* Make examples section more compact on mobile */
    .demo-examples-section .btn {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .demo-examples-section .alert {
        padding: 12px;
        font-size: 0.9rem;
    }
}
