/* Documentation Assistant Styles */

.documentation-assistant {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    height: 500px;
    max-height: 80vh;
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color, #e1e5e9);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
}

.documentation-assistant.minimized {
    height: 50px;
    overflow: hidden;
}

.documentation-assistant.minimized .assistant-body {
    display: none;
}

/* Header */
.assistant-header {
    background: var(--primary-color, #2c5282);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.assistant-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.assistant-title i {
    color: #ffd700;
}

.assistant-controls {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Body */
.assistant-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Conversation History */
.conversation-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-light, #f8f9fa);
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb, #cbd5e0) transparent;
}

.conversation-history::-webkit-scrollbar {
    width: 6px;
}

.conversation-history::-webkit-scrollbar-track {
    background: transparent;
}

.conversation-history::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb, #cbd5e0);
    border-radius: 3px;
}

/* Messages */
.message {
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

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

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}

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

.message-role {
    font-weight: 600;
}

.message-time {
    opacity: 0.7;
}

.confidence-score {
    background: var(--success-bg, #d1fae5);
    color: var(--success-text, #065f46);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.message-content {
    background: var(--message-bg, #ffffff);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light, #e5e7eb);
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--primary-color, #2c5282);
    color: white;
    margin-left: auto;
}

.message.assistant .message-content {
    background: white;
    border-left: 3px solid var(--primary-color, #2c5282);
}

/* Technical Details */
.technical-details {
    margin-top: 12px;
    background: var(--info-bg, #eff6ff);
    border: 1px solid var(--info-border, #bfdbfe);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
}

.detail-section {
    margin-bottom: 12px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h4 {
    color: var(--primary-color, #2c5282);
    font-size: 13px;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-section ul,
.detail-section ol {
    margin: 0;
    padding-left: 20px;
}

.detail-section li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.detail-section.limitations {
    background: var(--warning-bg, #fef3c7);
    border-color: var(--warning-border, #fbbf24);
}

.detail-section.limitations h4 {
    color: var(--warning-text, #92400e);
}

/* Code Examples */
.code-examples {
    margin-top: 12px;
}

.code-examples h4 {
    color: var(--primary-color, #2c5282);
    font-size: 13px;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-example {
    background: var(--code-bg, #1e293b);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}

.code-header {
    background: var(--code-header-bg, #374151);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--code-header-text, #9ca3af);
}

.copy-code-btn {
    background: none;
    border: none;
    color: var(--code-header-text, #9ca3af);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.copy-code-btn:hover {
    color: white;
}

.code-example pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
    background: var(--code-bg, #1e293b);
}

.code-example code {
    color: var(--code-text, #e2e8f0);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
}

/* Sources */
.sources {
    margin-top: 12px;
    background: var(--info-bg, #eff6ff);
    border: 1px solid var(--info-border, #bfdbfe);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
}

.sources h4 {
    color: var(--primary-color, #2c5282);
    font-size: 13px;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sources ul {
    margin: 0;
    padding-left: 20px;
}

.sources li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.sources a {
    color: var(--link-color, #1e40af);
    text-decoration: none;
}

.sources a:hover {
    text-decoration: underline;
}

.source-type {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    font-style: italic;
}

/* Related Questions */
.related-questions {
    margin-top: 12px;
}

.related-questions h4 {
    color: var(--primary-color, #2c5282);
    font-size: 13px;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.related-questions ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.related-questions li {
    margin-bottom: 6px;
}

.related-question-btn {
    background: var(--secondary-bg, #f3f4f6);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--primary-color, #2c5282);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}

.related-question-btn:hover {
    background: var(--primary-color, #2c5282);
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
    background: var(--bg-light, #f8f9fa);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color, #2c5282);
    animation: typingDot 1.4s infinite ease-in-out;
}

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

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

/* Input Area */
.input-area {
    border-top: 1px solid var(--border-light, #e5e7eb);
    padding: 12px 16px;
    background: white;
    border-radius: 0 0 12px 12px;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.quick-question-btn {
    background: var(--tag-bg, #e5e7eb);
    border: none;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 10px;
    color: var(--text-dark, #374151);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-question-btn:hover {
    background: var(--primary-color, #2c5282);
    color: white;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

#question-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#question-input:focus {
    border-color: var(--primary-color, #2c5282);
}

.btn-send {
    background: var(--primary-color, #2c5282);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    background: var(--primary-dark, #1a365d);
}

.btn-send:disabled {
    background: var(--disabled-bg, #9ca3af);
    cursor: not-allowed;
}

/* Input Suggestions */
.input-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 150px;
    overflow-y: auto;
    z-index: 1001;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--border-very-light, #f3f4f6);
    transition: background-color 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--hover-bg, #f3f4f6);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDot {
    0%, 20% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
    80%, 100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .documentation-assistant {
        --card-bg: #1f2937;
        --border-color: #374151;
        --bg-light: #111827;
        --message-bg: #1f2937;
        --border-light: #374151;
        --text-muted: #9ca3af;
        --text-dark: #f3f4f6;
        --hover-bg: #374151;
        --secondary-bg: #374151;
        --tag-bg: #4b5563;
        --disabled-bg: #6b7280;
        --info-bg: #1e3a8a;
        --info-border: #3b82f6;
        --warning-bg: #92400e;
        --warning-border: #f59e0b;
        --warning-text: #fbbf24;
        --success-bg: #065f46;
        --success-text: #10b981;
        --scroll-thumb: #4b5563;
    }
    
    .message.assistant .message-content {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    #question-input {
        background: #1f2937;
        color: #f3f4f6;
        border-color: #374151;
    }
    
    .input-suggestions {
        background: #1f2937;
        border-color: #374151;
    }
    
    .code-example {
        background: #0f172a;
    }
    
    .code-header {
        background: #1e293b;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .documentation-assistant {
        width: calc(100vw - 20px);
        height: calc(100vh - 40px);
        bottom: 10px;
        right: 10px;
        border-radius: 8px;
    }
    
    .assistant-header {
        border-radius: 8px 8px 0 0;
    }
    
    .input-area {
        border-radius: 0 0 8px 8px;
    }
    
    .quick-questions {
        flex-direction: column;
        gap: 4px;
    }
    
    .quick-question-btn {
        align-self: flex-start;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .documentation-assistant {
        border: 2px solid black;
    }
    
    .message-content {
        border: 2px solid black;
    }
    
    #question-input {
        border: 2px solid black;
    }
}