/* Qwen3 235B VL Instruct Styles */

:root {
    --vl-primary: #1e3a5f;
    --vl-primary-dark: #152a44;
    --vl-secondary: #2c4a6e;
    --vl-bg: #f5f7fa;
    --vl-sidebar-bg: #ffffff;
    --vl-message-user-bg: #1e3a5f;
    --vl-message-assistant-bg: #ffffff;
    --vl-border: #e1e8ed;
    --vl-text: #14171a;
    --vl-text-muted: #657786;
    --vl-highlight-bg: rgba(30, 58, 95, 0.08);
    --vl-highlight-border: rgba(30, 58, 95, 0.24);
    --vl-shadow-soft: rgba(30, 58, 95, 0.08);
    --vl-shadow-strong: rgba(30, 58, 95, 0.18);
    --vl-shadow-heavy: rgba(30, 58, 95, 0.25);
    --vl-accent-soft: rgba(44, 74, 110, 0.08);
}

.chat-interface {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px);
    min-height: calc(100vh - 140px);
    margin-top: 24px;
}

.chat-interface-wrapper {
    margin-top: 24px;
    min-height: calc(100vh - 120px);
}

.chat-interface-wrapper .side-tabs__panel {
    padding: 0;
    background: transparent;
}

.chat-interface-wrapper #qwenVLChatMain.chat-interface {
    margin-top: 0;
}

.chat-sidebar {
    width: 320px;
    background: var(--vl-sidebar-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 3px 14px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.vision-guidelines {
    background: var(--vl-highlight-bg);
    border: 1px dashed rgba(30, 58, 95, 0.4);
    padding: 16px;
    border-radius: 10px;
}

.vision-guidelines h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--vl-primary);
    margin-bottom: 8px;
}

.vision-guidelines ul {
    list-style: disc inside;
    color: var(--vl-text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.model-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--vl-text);
}

.model-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--vl-border);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.model-select:hover {
    border-color: var(--vl-primary);
}

.model-select:focus {
    outline: none;
    border-color: var(--vl-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}

.parameters-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--vl-text);
}

.parameter-group {
    margin-bottom: 20px;
}

.parameter-group label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--vl-text);
}

.parameter-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.parameter-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--vl-primary);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.parameter-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.parameter-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--vl-primary);
    cursor: pointer;
    border: none;
}

.parameter-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--vl-text-muted);
}

.actions-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-button {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.action-button.primary {
    background: var(--vl-primary);
    color: white;
}

.action-button.primary:hover {
    background: var(--vl-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(30, 58, 95, 0.25);
}

.action-button.secondary {
    background: white;
    color: var(--vl-text);
    border: 1px solid var(--vl-border);
}

.action-button.secondary:hover {
    background: #f8fafc;
}

.chat-main {
    flex: 1;
    background: var(--vl-sidebar-bg);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 14px var(--vl-shadow-soft);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: linear-gradient(165deg, #f5f7fa 0%, #eef3fa 100%);
}

.welcome-message {
    text-align: center;
    padding: 48px 24px;
    border-radius: 16px;
    background: white;
    max-width: 520px;
    margin: 40px auto;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07);
}

.welcome-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.welcome-message h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--vl-text);
}

.welcome-message p {
    color: var(--vl-text-muted);
    margin-bottom: 20px;
    font-size: 15px;
}

.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-prompt-btn {
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--vl-highlight-bg);
    border: 1px solid var(--vl-highlight-border);
    color: var(--vl-primary);
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-prompt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px var(--vl-shadow-strong);
}

.message {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.message-content {
    flex: 1;
    background: white;
    padding: 16px 20px;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    color: var(--vl-text);
    line-height: 1.6;
    font-size: 15px;
}

.message-user .message-content {
    background: var(--vl-message-user-bg);
    color: white;
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-user .message-content pre {
    background: rgba(15, 23, 42, 0.4);
}

.message.assistant-media .message-content {
    background: white;
}

.message-thinking .message-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.thinking-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thinking-indicator {
    display: flex;
    gap: 6px;
}

.thinking-indicator span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--vl-primary);
    animation: thinkingBounce 1.2s infinite ease-in-out;
}

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

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

.thinking-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--vl-text-muted);
}

@keyframes thinkingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.attachment-toolbar {
    padding: 16px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(180deg, var(--vl-highlight-bg) 0%, var(--vl-accent-soft) 100%);
    border-bottom: 1px solid rgba(30, 58, 95, 0.12);
}

.attachment-actions {
    display: flex;
    gap: 12px;
}

.attachment-button {
    border: 1px dashed rgba(30, 58, 95, 0.35);
    background: rgba(255, 255, 255, 0.7);
    color: var(--vl-primary);
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.attachment-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px var(--vl-shadow-strong);
    background: white;
}

.attachment-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.attachment-thumbnail {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: #e2e8f0;
    flex-shrink: 0;
}

.attachment-thumbnail--video {
    background: #0f172a;
}

.attachment-thumbnail--video::-webkit-media-controls,
.attachment-thumbnail--video::-webkit-media-controls-enclosure,
.attachment-thumbnail--video::-webkit-media-controls-panel {
    display: none !important;
}

.attachment-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attachment-meta strong {
    font-size: 13px;
    color: var(--vl-text);
}

.attachment-meta span {
    font-size: 12px;
    color: var(--vl-text-muted);
}

.attachment-remove {
    border: none;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 999px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.attachment-remove:hover {
    background: #fecaca;
}

.chat-input-container {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: white;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    border: 1px solid var(--vl-border);
    border-radius: 16px;
    padding: 12px 16px;
    background: #f8fafc;
}

.chat-input {
    flex: 1;
    resize: none;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--vl-text);
    line-height: 1.5;
    max-height: 160px;
}

.chat-input:focus {
    outline: none;
}

.send-button {
    background: var(--vl-primary);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.send-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px var(--vl-shadow-heavy);
}

.input-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--vl-text-muted);
}

.input-info .separator {
    opacity: 0.4;
}

.message-content pre {
    background: #1f2937;
    color: #f3f4f6;
    border-radius: 8px;
    padding: 16px;
    padding-top: 44px;
    overflow-x: auto;
    position: relative;
}

.message-content code {
    background: rgba(15, 23, 42, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 13px;
}

.message-content pre code {
    background: transparent;
    padding: 0;
}

.message-content ul,
.message-content ol {
    margin: 12px 0;
    padding-left: 1.6rem;
}

.message-content li {
    margin: 6px 0;
    line-height: 1.6;
}

.assistant-media-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.assistant-media-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    padding: 12px;
}

.assistant-media-item img,
.assistant-media-video {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    object-fit: cover;
    max-height: 300px;
    background: #0f172a;
}

.assistant-media-video {
    background: #0f172a;
}

.assistant-media-caption,
.assistant-media-video-meta {
    font-size: 12px;
    color: var(--vl-text-muted);
}

.assistant-media-caption {
    text-align: left;
}

.assistant-media-video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assistant-copy-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.assistant-copy-btn:hover {
    background: rgba(30, 64, 175, 0.85);
    transform: translateY(-1px);
}

.api-docs-section {
    padding: 32px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.api-endpoint-card,
.api-sample-card {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.08), rgba(44, 74, 110, 0.08));
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.api-sample-card pre {
    margin-top: 16px;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
}

.api-notes ul {
    list-style: disc inside;
    color: var(--vl-text-muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.copy-button {
    border: none;
    background: rgba(255, 255, 255, 0.7);
    color: var(--vl-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.copy-button:hover {
    background: white;
    transform: translateY(-1px);
}

.usage-metadata {
    margin-top: 16px;
    font-size: 13px;
    color: var(--vl-text-muted);
    background: var(--vl-highlight-bg);
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid var(--vl-highlight-border);
    display: grid;
    gap: 4px;
}

.reasoning-panel {
    margin-top: 16px;
    border-radius: 10px;
    padding: 12px 16px;
    background: var(--vl-accent-soft);
    border: 1px solid rgba(44, 74, 110, 0.2);
    color: var(--vl-text);
    font-size: 13px;
}

.reasoning-panel strong {
    display: block;
    margin-bottom: 6px;
    color: var(--vl-secondary);
}

@media (max-width: 1100px) {
    .chat-interface {
        flex-direction: column;
        height: auto;
    }

    .chat-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }

    .parameters-section,
    .vision-guidelines,
    .actions-section,
    .model-selector {
        flex: 1 1 240px;
    }
}

@media (max-width: 768px) {
    .attachment-toolbar {
        padding: 16px;
    }

    .chat-input-container {
        padding: 16px;
    }

    .chat-messages {
        padding: 20px;
    }
}
.cost-info {
    padding: 16px;
    background: var(--vl-highlight-bg);
    border-radius: 12px;
    border: 1px solid var(--vl-highlight-border);
    margin-bottom: 20px;
}

.cost-info h4 {
    font-size: 14px;
   font-weight: 600;
   margin-bottom: 6px;
   color: var(--vl-primary);
}

/* Chat History Panel */
.history-panel {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

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

.history-panel-content {
    background: var(--vl-sidebar-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--vl-border);
    animation: slideUp 0.3s ease-out;
}

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

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--vl-border);
}

.history-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--vl-text);
}

.history-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--vl-text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.history-close-btn:hover {
    background: var(--vl-highlight-bg);
    color: var(--vl-text);
}

.history-list {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
}

.no-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--vl-text-muted);
    font-size: 15px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
    margin-bottom: 8px;
}

.history-item:hover {
    background: var(--vl-highlight-bg);
    border-color: var(--vl-highlight-border);
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-weight: 500;
    font-size: 15px;
    color: var(--vl-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 13px;
    color: var(--vl-text-muted);
}

.history-delete-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    opacity: 0;
    transition: background 0.2s ease, opacity 0.2s ease;
    margin-left: 8px;
    color: #b91c1c;
}

.history-item:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background: #fee2e2;
}

@media (max-width: 768px) {
    .history-panel-content {
        width: 95%;
        max-height: 85vh;
    }

    .history-header {
        padding: 18px 20px;
    }

    .history-header h3 {
        font-size: 18px;
    }

    .history-list {
        padding: 12px;
    }

    .history-item {
        padding: 12px;
    }

    .history-title {
        font-size: 14px;
    }

    .history-meta {
        font-size: 12px;
    }
}
