/* =====================================================================
   Question Thread Styles
   ===================================================================== */

/* Thread Container */
.question-thread-container {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: var(--bg-primary, #ffffff);
    overflow: hidden;
    margin: 12px 0;
}

.dark .question-thread-container {
    background: var(--bg-primary, #1e293b);
    border-color: var(--border-color, #334155);
}

/* Thread Header */
.question-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-50, #eff6ff) 0%, var(--purple-50, #faf5ff) 100%);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.dark .question-thread-header {
    background: linear-gradient(135deg, var(--primary-900, #1e3a8a) 0%, var(--purple-900, #581c87) 100%);
    border-bottom-color: var(--border-color, #334155);
}

.question-thread-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--primary-500, #3b82f6);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.question-thread-info {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.dark .question-thread-info {
    color: var(--text-secondary, #9ca3af);
}

/* Thread Messages */
.question-thread-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-secondary, #f8fafc);
}

.dark .question-thread-messages {
    background-color: var(--bg-secondary, #0f172a);
}

/* Empty State */
.question-thread-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-tertiary, #94a3b8);
}

.question-thread-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.question-thread-empty p {
    font-size: 14px;
    margin: 0;
}

/* Message */
.question-thread-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease-out;
}

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

.question-thread-message.message-adding {
    animation: messagePulse 0.5s ease-out;
}

@keyframes messagePulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

/* Message Avatar */
.message-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.question-thread-message-user .message-avatar {
    background: linear-gradient(135deg, var(--primary-500, #3b82f6), var(--primary-600, #2563eb));
    color: white;
}

.question-thread-message-assistant .message-avatar {
    background: linear-gradient(135deg, var(--purple-500, #a855f7), var(--purple-600, #7c3aed));
    color: white;
}

/* Message Content */
.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    background: var(--bg-primary, #ffffff);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary, #0f172a);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .message-text {
    background: var(--bg-primary, #1e293b);
    color: var(--text-primary, #f8fafc);
}

.question-thread-message-assistant .message-text {
    background: var(--bg-primary, #ffffff);
    border-top-left-radius: 4px;
}

.dark .question-thread-message-assistant .message-text {
    background: var(--bg-primary, #1e293b);
}

.question-thread-message-user .message-text {
    background: linear-gradient(135deg, var(--primary-500, #3b82f6), var(--primary-600, #2563eb));
    color: white;
    border-top-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary, #94a3b8);
    margin-top: 4px;
    padding-left: 4px;
}

/* Thread Input Area */
.question-thread-input-area {
    padding: 12px 16px;
    background: var(--bg-primary, #ffffff);
    border-top: 1px solid var(--border-color, #e2e8f0);
}

.dark .question-thread-input-area {
    background: var(--bg-primary, #1e293b);
    border-top-color: var(--border-color, #334155);
}

.question-thread-input {
    width: 100%;
    min-height: 60px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary, #0f172a);
    background: var(--bg-secondary, #f8fafc);
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dark .question-thread-input {
    border-color: var(--border-color, #334155);
    color: var(--text-primary, #f8fafc);
    background: var(--bg-secondary, #0f172a);
}

.question-thread-input:focus {
    outline: none;
    border-color: var(--primary-500, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.question-thread-input::placeholder {
    color: var(--text-tertiary, #94a3b8);
}

/* Thread Actions */
.question-thread-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.question-thread-hint {
    font-size: 11px;
    color: var(--text-tertiary, #94a3b8);
}

.question-thread-send-btn {
    padding: 6px 14px;
    background: var(--primary-500, #3b82f6);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.question-thread-send-btn:hover {
    background: var(--primary-600, #2563eb);
    transform: translateY(-1px);
}

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

/* Scrollbar styling for messages */
.question-thread-messages::-webkit-scrollbar {
    width: 6px;
}

.question-thread-messages::-webkit-scrollbar-track {
    background: transparent;
}

.question-thread-messages::-webkit-scrollbar-thumb {
    background: var(--border-color, #cbd5e1);
    border-radius: 3px;
}

.dark .question-thread-messages::-webkit-scrollbar-thumb {
    background: var(--border-color, #475569);
}

.question-thread-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-color, #94a3b8);
}

.dark .question-thread-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-color, #64748b);
}

/* =====================================================================
   Thread Modal Styles
   ===================================================================== */

.thread-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.thread-modal-container {
    background: var(--bg-primary, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.dark .thread-modal-container {
    background: var(--bg-primary, #1f2937);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.thread-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-50, #eff6ff) 0%, var(--purple-50, #faf5ff) 100%);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.dark .thread-modal-header {
    background: linear-gradient(135deg, var(--primary-900, #1e3a8a) 0%, var(--purple-900, #581c87) 100%);
    border-bottom-color: var(--border-color, #334155);
}

.thread-modal-header h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.dark .thread-modal-header h3 {
    color: var(--text-primary, #f9fafb);
}

.thread-modal-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    line-height: 1.4;
}

.dark .thread-modal-subtitle {
    color: var(--text-secondary, #9ca3af);
}

.thread-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.thread-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, #111827);
}

.dark .thread-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f9fafb);
}

.thread-modal-body {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary, #f8fafc);
}

.dark .thread-modal-body {
    background: var(--bg-secondary, #0f172a);
}

/* Responsive design */
@media (max-width: 640px) {
    .thread-modal-container {
        max-height: 95vh;
        margin: 10px;
        border-radius: 12px;
    }

    .thread-modal-header {
        padding: 16px;
    }

    .thread-modal-header h3 {
        font-size: 16px;
    }

    .thread-modal-subtitle {
        font-size: 12px;
    }
}
