/* =============================================================================
   Venice AI – Public Styles
   Chat & Image Generation Interfaces
   ============================================================================= */

/* ---- CSS Custom Properties ---- */
:root {
    --venice-primary:        #6366f1;
    --venice-primary-hover:  #4f46e5;
    --venice-primary-light:  #eef2ff;
    --venice-bg:             #ffffff;
    --venice-bg-alt:         #f8fafc;
    --venice-border:         #e2e8f0;
    --venice-text:           #1e293b;
    --venice-text-muted:     #64748b;
    --venice-radius:         12px;
    --venice-radius-sm:      8px;
    --venice-shadow:         0 4px 24px rgba(0, 0, 0, 0.08);
    --venice-user-bg:        #6366f1;
    --venice-user-text:      #ffffff;
    --venice-ai-bg:          #f1f5f9;
    --venice-ai-text:        #1e293b;
    --venice-error:          #ef4444;
    --venice-error-bg:       #fef2f2;
    --venice-success:        #22c55e;
    --venice-success-bg:     #f0fdf4;
}

/* ---- Wrapper ---- */
.venice-ai-wrapper {
    background: var(--venice-bg);
    border: 1px solid var(--venice-border);
    border-radius: var(--venice-radius);
    box-shadow: var(--venice-shadow);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--venice-text);
    max-width: 100%;
}

/* ---- Header ---- */
.venice-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.venice-ai-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.venice-ai-logo svg {
    color: #fff;
}

.venice-ai-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

/* ---- Model Selector ---- */
.venice-ai-model-selector,
.venice-ai-image-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--venice-bg-alt);
    border-bottom: 1px solid var(--venice-border);
    flex-wrap: wrap;
}

.venice-ai-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.venice-ai-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--venice-text-muted);
    white-space: nowrap;
}

.venice-ai-select {
    border: 1px solid var(--venice-border);
    border-radius: var(--venice-radius-sm);
    padding: 6px 10px;
    font-size: 13px;
    background: var(--venice-bg);
    color: var(--venice-text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.venice-ai-select:focus {
    border-color: var(--venice-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ---- Chat Messages Area ---- */
.venice-ai-messages {
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.venice-ai-welcome {
    text-align: center;
    color: var(--venice-text-muted);
    padding: 40px 20px;
}

.venice-ai-welcome p {
    margin: 0;
    font-size: 14px;
}

/* ---- Nachrichten ---- */
.venice-ai-message {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: venice-fade-in 0.25s ease;
}

@keyframes venice-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.venice-ai-message--user {
    align-self: flex-end;
    align-items: flex-end;
}

.venice-ai-message--ai {
    align-self: flex-start;
    align-items: flex-start;
}

.venice-ai-message-meta {
    font-size: 11px;
    color: var(--venice-text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.venice-ai-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
    word-break: break-word;
    white-space: pre-wrap;
}

.venice-ai-message--user .venice-ai-message-bubble {
    background: var(--venice-user-bg);
    color: var(--venice-user-text);
    border-bottom-right-radius: 4px;
}

.venice-ai-message--ai .venice-ai-message-bubble {
    background: var(--venice-ai-bg);
    color: var(--venice-ai-text);
    border-bottom-left-radius: 4px;
}

/* Markdown-Formatierung in AI-Antworten */
.venice-ai-message--ai .venice-ai-message-bubble p {
    margin: 0 0 8px;
}
.venice-ai-message--ai .venice-ai-message-bubble p:last-child {
    margin-bottom: 0;
}
.venice-ai-message--ai .venice-ai-message-bubble code {
    background: rgba(0,0,0,0.07);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 13px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.venice-ai-message--ai .venice-ai-message-bubble pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    margin: 8px 0;
}
.venice-ai-message--ai .venice-ai-message-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Kopier-Button */
.venice-ai-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--venice-text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    transition: background 0.2s, color 0.2s;
}
.venice-ai-copy-btn:hover {
    background: var(--venice-border);
    color: var(--venice-text);
}

/* ---- Typing-Indikator ---- */
.venice-ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--venice-ai-bg);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.venice-ai-typing span {
    width: 7px;
    height: 7px;
    background: var(--venice-text-muted);
    border-radius: 50%;
    animation: venice-bounce 1.2s infinite;
}
.venice-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.venice-ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes venice-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}

/* ---- Input-Bereich ---- */
.venice-ai-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--venice-border);
    background: var(--venice-bg);
}

.venice-ai-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.venice-ai-textarea {
    flex: 1;
    border: 1px solid var(--venice-border);
    border-radius: var(--venice-radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 44px;
    max-height: 160px;
    overflow-y: auto;
    background: var(--venice-bg);
    color: var(--venice-text);
    line-height: 1.5;
}

.venice-ai-textarea:focus {
    border-color: var(--venice-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.venice-ai-footer-note {
    font-size: 11px;
    color: var(--venice-text-muted);
    text-align: center;
    margin-top: 8px;
}

/* ---- Buttons ---- */
.venice-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--venice-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.venice-ai-btn:active {
    transform: scale(0.97);
}

.venice-ai-btn--primary {
    background: var(--venice-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.venice-ai-btn--primary:hover {
    background: var(--venice-primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.venice-ai-btn--primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.venice-ai-btn--secondary {
    background: var(--venice-bg-alt);
    color: var(--venice-text);
    border: 1px solid var(--venice-border);
}

.venice-ai-btn--secondary:hover {
    background: var(--venice-border);
}

.venice-ai-btn--ghost {
    background: none;
    color: var(--venice-primary);
    border: 1px dashed var(--venice-primary);
    padding: 6px 12px;
    font-size: 13px;
}

.venice-ai-btn--ghost:hover {
    background: var(--venice-primary-light);
}

/* ---- Spinner ---- */
.venice-ai-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: venice-spin 0.7s linear infinite;
}

@keyframes venice-spin {
    to { transform: rotate(360deg); }
}

/* ---- Bildgenerierungs-Interface ---- */
.venice-ai-prompt-area {
    padding: 16px 20px;
    border-bottom: 1px solid var(--venice-border);
}

.venice-ai-negative-toggle {
    margin-top: 8px;
}

.venice-ai-generate-area {
    padding: 16px 20px;
    border-bottom: 1px solid var(--venice-border);
}

.venice-ai-image-result {
    padding: 20px;
}

.venice-ai-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.venice-generated-image {
    max-width: 100%;
    border-radius: var(--venice-radius);
    box-shadow: var(--venice-shadow);
    display: block;
    animation: venice-fade-in 0.4s ease;
}

.venice-ai-image-actions {
    display: flex;
    gap: 10px;
}

/* ---- Fehlermeldungen ---- */
.venice-ai-error-message {
    margin: 0 20px 16px;
    padding: 12px 16px;
    background: var(--venice-error-bg);
    border: 1px solid #fca5a5;
    border-radius: var(--venice-radius-sm);
    color: #991b1b;
    font-size: 13px;
    animation: venice-fade-in 0.2s ease;
}

.venice-ai-notice {
    padding: 14px 20px;
    font-size: 13px;
    border-radius: 0;
}

.venice-ai-notice--error {
    background: var(--venice-error-bg);
    color: #991b1b;
    border-top: 3px solid var(--venice-error);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .venice-ai-message {
        max-width: 94%;
    }

    .venice-ai-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .venice-ai-btn--primary {
        width: 100%;
    }

    .venice-ai-image-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}
