/* Chutes Chatbot Styles - Fully Customizable */

:root {
    --chutes-primary: #000000;
    --chutes-secondary: #1a1a1a;
    --chutes-user-bubble: #000000;
    --chutes-ai-bubble: #ffffff;
    --chutes-bg: #ffffff;
    --chutes-text: #000000;
}

.chutes-chatbot-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto;
    height: 600px !important;
    max-height: 600px !important;
    min-height: 600px !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden !important;
    position: relative;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* Header */
.chutes-chat-header {
    background: linear-gradient(135deg, var(--chutes-primary) 0%, var(--chutes-secondary) 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 0 auto !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.chutes-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chutes-ai-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chutes-header-text h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chutes-status {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chutes-clear-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chutes-clear-chat:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Main Content */
.chutes-main-content {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
    position: relative;
    max-height: 100% !important;
}

/* Messages Container */
.chutes-messages-container {
    flex: 1 1 auto !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    padding: 24px;
    background: var(--chutes-bg);
    scroll-behavior: smooth;
    min-height: 0 !important;
    max-height: 100% !important;
    height: 100%;
}

/* Welcome Message */
.chutes-welcome-message {
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.chutes-ai-avatar-large {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.chutes-welcome-message h3 {
    font-size: 24px;
    margin: 0 0 12px 0;
    color: var(--chutes-text);
}

.chutes-welcome-message p {
    color: var(--chutes-text);
    opacity: 0.7;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.chutes-suggestions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.chutes-suggestion-btn {
    background: white;
    border: 2px solid #000000;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

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

/* Message Bubbles */
.chutes-message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

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

.chutes-message.user {
    flex-direction: row-reverse;
}

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

.chutes-message.user .chutes-message-avatar {
    background: #10b981;
    color: white;
}

.chutes-message.assistant .chutes-message-avatar {
    background: linear-gradient(135deg, var(--chutes-primary) 0%, var(--chutes-secondary) 100%);
    color: white;
}

.chutes-message-content {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
}

.chutes-message.user .chutes-message-content {
    background: #000000;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    border: 2px solid #000000;
}

.chutes-message.assistant .chutes-message-content {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    border-bottom-left-radius: 4px;
}

.chutes-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Code Blocks */
.chutes-code-block {
    position: relative;
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
}

.chutes-code-header {
    background: #1f2937;
    color: #9ca3af;
    padding: 8px 12px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #374151;
}

.chutes-code-lang {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.chutes-copy-btn {
    background: #374151;
    border: none;
    color: #9ca3af;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chutes-copy-btn:hover {
    background: #4b5563;
    color: white;
}

.chutes-copy-btn.copied {
    background: #10b981;
    color: white;
}

.chutes-code-content {
    background: #1f2937 !important;
    margin: 0 !important;
    padding: 16px !important;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, Monaco, monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.chutes-code-content code {
    background: transparent !important;
    padding: 0 !important;
    color: #e5e7eb !important;
}

/* Inline Code */
.chutes-message-content code:not(.chutes-code-content code) {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    color: #dc2626;
}

.chutes-message.user .chutes-message-content code:not(.chutes-code-content code) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Typing Indicator */
.chutes-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    width: fit-content;
}

.chutes-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Input Container */
.chutes-input-container {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 24px;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.chutes-input-wrapper {
    display: flex;
    gap: 12px;
    background: var(--chutes-bg);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s;
}

.chutes-input-wrapper:focus-within {
    border-color: var(--chutes-primary);
    background: white;
}

#chutes-message-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--chutes-text);
    outline: none;
    max-height: 120px;
    overflow-y: auto;
}

#chutes-message-input::placeholder {
    color: #9ca3af;
}

.chutes-send-btn {
    width: 40px;
    height: 40px;
    background: var(--chutes-primary);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chutes-send-btn:hover:not(:disabled) {
    background: var(--chutes-secondary);
    transform: scale(1.05);
}

.chutes-send-btn:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.5;
}

.chutes-input-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 4px;
}

.chutes-char-count,
.chutes-info {
    font-size: 12px;
    color: #9ca3af;
}

/* Error Message */
.chutes-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14px;
}

/* Scrollbar */
.chutes-messages-container::-webkit-scrollbar {
    width: 8px;
}

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

.chutes-messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chutes-messages-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .chutes-chatbot-container {
        height: calc(100vh - 60px);
        border-radius: 0;
    }

    .chutes-chat-header {
        padding: 16px;
    }

    .chutes-messages-container {
        padding: 16px;
    }

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

    .chutes-suggestions {
        flex-direction: column;
    }

    .chutes-suggestion-btn {
        width: 100%;
    }

    .chutes-welcome-message {
        padding: 20px 10px;
    }
}

/* Markdown Formatting */
.chutes-message-content strong {
    font-weight: 600;
}

.chutes-message-content em {
    font-style: italic;
}

.chutes-message-content a {
    color: var(--chutes-primary);
    text-decoration: underline;
}

.chutes-message.user .chutes-message-content a {
    color: white;
}

.chutes-message-content ul,
.chutes-message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.chutes-message-content li {
    margin: 4px 0;
}

/* Prism.js Override for Dark Theme */
pre[class*="language-"] {
    background: #1f2937 !important;
    margin: 0 !important;
}

code[class*="language-"] {
    color: #e5e7eb !important;
}

/* Header Controls */
.chutes-header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chutes-agent-select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.chutes-agent-select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chutes-tools-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chutes-tools-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Tools Panel */
.chutes-tools-panel {
    background: #f3f4f6;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.chutes-tools-content {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.chutes-tool-btn {
    background: white;
    border: 2px solid #e5e7eb;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #4b5563;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.chutes-tool-btn:hover {
    border-color: var(--chutes-primary);
    color: var(--chutes-primary);
    background: #f9fafb;
}

.chutes-tool-btn.active {
    background: var(--chutes-primary);
    color: white;
    border-color: var(--chutes-primary);
}

/* Code Editor Container */
.chutes-code-editor-container {
    background: white;
    border: 1px solid #e5e7eb;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    height: 300px;
    max-height: 300px;
}

.chutes-code-editor-header {
    background: #1f2937;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chutes-code-editor-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.chutes-code-editor-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chutes-code-lang-select {
    background: #374151;
    color: white;
    border: 1px solid #4b5563;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.chutes-code-btn {
    background: #374151;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.chutes-code-btn:hover {
    background: #4b5563;
}

/* Status Bar */
.chutes-status-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.chutes-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--chutes-primary);
    padding: 4px 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
}

/* Code Output */
.chutes-code-output {
    background: #1f2937;
    border-radius: 8px;
    overflow: hidden;
    margin: 8px 0;
}

.chutes-code-output-header {
    background: #374151;
    color: #10b981;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid #4b5563;
}

.chutes-code-output-content {
    background: #1f2937;
    color: #e5e7eb;
    padding: 12px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}
