/* Diba chat UI — shared by the CPU (llama.cpp) and ZeroGPU (Gradio) Spaces. All assets self-hosted. */ :root, [data-theme="light"] { --bg: #FFFFFF; --side: #F6F6F3; --side-hover: #ECECE7; --panel: #FFFFFF; --line: #E6E4DD; --line-soft: #EFEDE7; --ink: #1B1F1D; --ink-2: #4C5552; --muted: #8A928E; --bubble: #F1F1EC; --zebra: #FAFAF7; --code-bg: #0F1513; --code-head: #1A2320; --code-ink: #DCE6E1; --code-muted: #8FA39B; --inline-code: #EEEDE6; --accent: #1F7A5A; --accent-ink: #FFFFFF; --accent-soft: #E7F3ED; --danger: #B3261E; --shadow: 0 6px 24px rgba(20, 30, 25, .08); } [data-theme="dark"] { --bg: #1B1D1C; --side: #131514; --side-hover: #232625; --panel: #242726; --line: #313533; --line-soft: #2A2D2C; --ink: #ECEEEA; --ink-2: #B7BEBA; --muted: #7F8783; --bubble: #2A2E2C; --zebra: #202322; --code-bg: #0B0F0D; --code-head: #151B18; --code-ink: #DCE6E1; --code-muted: #8FA39B; --inline-code: #2C302E; --accent: #4CB58C; --accent-ink: #0B1511; --accent-soft: #1C3229; --danger: #F2B8B5; --shadow: 0 6px 24px rgba(0, 0, 0, .35); } html, body { height: 100%; margin: 0; } body.diba-lock { overflow: hidden !important; } #diba-root, #diba-root * { box-sizing: border-box; } #diba-root { position: fixed; inset: 0; z-index: 2147483000; display: flex; background: var(--bg); color: var(--ink); font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; } #diba-root button { font-family: inherit; cursor: pointer; } #diba-root :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; } #diba-root svg { flex: none; } /* ---------- sidebar ---------- */ .d-side { width: 268px; flex: 0 0 268px; background: var(--side); display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); transition: margin .2s ease; } .d-side.closed { margin-inline-start: -268px; } .d-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; } .d-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; background: linear-gradient(135deg, #1F7A5A, #C8912E); } .d-brand-name { font-weight: 800; font-size: 17px; line-height: 1.15; } .d-brand-sub { font-size: 12px; color: var(--muted); } .d-new { margin: 6px 12px 10px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 600; } .d-new:hover { background: var(--side-hover); } .d-list-title { padding: 8px 18px 4px; font-size: 12px; color: var(--muted); font-weight: 600; } .d-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; } .d-conv { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-size: 14px; cursor: pointer; } .d-conv:hover, .d-conv.active { background: var(--side-hover); color: var(--ink); } .d-conv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: start; } .d-conv-del { opacity: 0; border: 0; background: transparent; color: var(--muted); padding: 2px 4px; border-radius: 6px; display: grid; place-items: center; } .d-conv:hover .d-conv-del, .d-conv.active .d-conv-del { opacity: 1; } .d-conv-del:hover { color: var(--danger); background: var(--panel); } .d-empty-list { padding: 10px 18px; color: var(--muted); font-size: 13px; } .d-side-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; } .d-seg { display: flex; background: var(--side-hover); border-radius: 10px; padding: 3px; } .d-seg button { flex: 1; border: 0; background: transparent; color: var(--ink-2); padding: 6px 0; border-radius: 8px; font-size: 13px; font-weight: 600; } .d-seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); } .d-side-note { font-size: 11.5px; color: var(--muted); text-align: center; } .d-side-note a { color: var(--accent); text-decoration: none; } /* ---------- main ---------- */ .d-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; position: relative; } .d-top { height: 54px; flex: 0 0 54px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid transparent; } .d-top.shadow { border-bottom-color: var(--line); } .d-icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); } .d-icon-btn:hover { background: var(--side-hover); color: var(--ink); } .d-model { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; } .d-badge { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; } .d-model-pill { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; } .d-model-pill:hover { background: var(--side-hover); color: var(--ink); } .d-model-pill svg { width: 13px; height: 13px; opacity: .7; } .d-model-pill[hidden] { display: none; } .d-top-spacer { flex: 1; } .d-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto; } .d-thread { max-width: 780px; margin: 0 auto; padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 26px; } .d-msg { display: flex; gap: 12px; } .d-msg.user { justify-content: flex-end; } .d-msg.user .d-bubble { background: var(--bubble); border-radius: 18px; padding: 10px 16px; max-width: 78%; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; } .d-avatar { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: linear-gradient(135deg, #1F7A5A, #C8912E); margin-top: 3px; } .d-body { flex: 1; min-width: 0; } /* ---------- markdown ---------- */ .d-content { font-size: 15.5px; line-height: 1.85; color: var(--ink); overflow-wrap: anywhere; } .d-content > *:first-child { margin-top: 0 !important; } .d-content > *:last-child { margin-bottom: 0 !important; } .d-content p { margin: 0 0 .9em; } .d-content h1, .d-content h2, .d-content h3, .d-content h4, .d-content h5, .d-content h6 { color: var(--ink); line-height: 1.4; text-wrap: balance; } .d-content h1 { font-size: 1.5em; font-weight: 800; margin: 1.3em 0 .55em; } .d-content h2 { font-size: 1.28em; font-weight: 750; margin: 1.25em 0 .5em; padding-bottom: .3em; border-bottom: 1px solid var(--line-soft); } .d-content h3 { font-size: 1.12em; font-weight: 700; margin: 1.1em 0 .45em; } .d-content h4, .d-content h5, .d-content h6 { font-size: 1em; font-weight: 700; margin: 1em 0 .4em; } .d-content strong, .d-content b { font-weight: 700; color: var(--ink); } .d-content em { font-style: italic; } .d-content del { color: var(--muted); } .d-content hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; } .d-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; } .d-content a:hover { text-decoration-thickness: 2px; } .d-content ul, .d-content ol { margin: .3em 0 1em; padding: 0; } .d-content ul[dir="rtl"], .d-content ol[dir="rtl"] { padding-right: 1.5em; } .d-content ul[dir="ltr"], .d-content ol[dir="ltr"], .d-content ul:not([dir]), .d-content ol:not([dir]) { padding-left: 1.5em; } .d-content li { margin: .3em 0; padding-inline-start: .15em; } .d-content li > p { margin: 0 0 .4em; } .d-content li > ul, .d-content li > ol { margin: .25em 0 .35em; } .d-content ul > li::marker { color: var(--muted); } .d-content ol > li::marker { color: var(--ink-2); font-weight: 600; } .d-content li input[type="checkbox"] { margin-inline-end: .5em; accent-color: var(--accent); vertical-align: middle; } .d-content blockquote { margin: 1em 0; padding: .6em 1em; border-inline-start: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--ink-2); } [dir="rtl"] .d-content blockquote, .d-content blockquote[dir="rtl"] { border-radius: 10px 0 0 10px; } .d-content blockquote > p:last-child { margin-bottom: 0; } .d-content img { max-width: 100%; border-radius: 10px; } .d-content kbd { font-family: "JetBrains Mono", Consolas, "Vazirmatn", Tahoma, monospace; font-size: .82em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--panel); } .d-content :not(pre) > code { font-family: "JetBrains Mono", Consolas, "Vazirmatn", Tahoma, monospace; font-size: .86em; background: var(--inline-code); color: var(--ink); padding: .12em .42em; border-radius: 6px; direction: ltr; unicode-bidi: isolate; white-space: break-spaces; } .d-table { margin: .9em 0 1.2em; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; } .d-table table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.6; } .d-table th, .d-table td { padding: 9px 13px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line-soft); } .d-table th { background: var(--side); font-weight: 700; color: var(--ink); white-space: nowrap; } .d-table tbody tr:nth-child(even) td { background: var(--zebra); } .d-table tbody tr:last-child td { border-bottom: 0; } .d-table th + th, .d-table td + td { border-inline-start: 1px solid var(--line-soft); } .d-code { direction: ltr; text-align: left; margin: .9em 0 1.1em; border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid rgba(255,255,255,.04); } .d-code-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px 7px 14px; background: var(--code-head); color: var(--code-muted); font-size: 12px; font-family: "JetBrains Mono", Consolas, "Vazirmatn", Tahoma, monospace; } .d-code-head button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--code-muted); font-size: 12px; font-family: "Vazirmatn", Tahoma, sans-serif; padding: 3px 8px; border-radius: 6px; } #diba-root .d-code-head button, #diba-root .d-code-head button span { font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; letter-spacing: 0; } .d-code-head button:hover { color: #fff; background: rgba(255,255,255,.08); } .d-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; tab-size: 2; } .d-code pre code { font-family: "JetBrains Mono", Consolas, "Vazirmatn", Tahoma, monospace; font-size: 13px; line-height: 1.65; color: var(--code-ink); background: transparent !important; padding: 0 !important; white-space: pre; } /* syntax theme (dark code surface in both UI themes) */ .d-code .hljs-comment, .d-code .hljs-quote { color: #6F8580; font-style: italic; } .d-code .hljs-keyword, .d-code .hljs-selector-tag, .d-code .hljs-built_in, .d-code .hljs-doctag { color: #C792EA; } .d-code .hljs-string, .d-code .hljs-template-tag, .d-code .hljs-addition { color: #C3E88D; } .d-code .hljs-number, .d-code .hljs-literal, .d-code .hljs-symbol { color: #F78C6C; } .d-code .hljs-title, .d-code .hljs-title.function_, .d-code .hljs-section { color: #82AAFF; } .d-code .hljs-title.class_, .d-code .hljs-type, .d-code .hljs-attr, .d-code .hljs-attribute, .d-code .hljs-property { color: #FFCB6B; } .d-code .hljs-variable, .d-code .hljs-template-variable, .d-code .hljs-tag, .d-code .hljs-name, .d-code .hljs-deletion { color: #F07178; } .d-code .hljs-meta, .d-code .hljs-regexp, .d-code .hljs-bullet, .d-code .hljs-link, .d-code .hljs-selector-class, .d-code .hljs-selector-id { color: #89DDFF; } .d-code .hljs-params { color: var(--code-ink); } .d-code .hljs-emphasis { font-style: italic; } .d-code .hljs-strong { font-weight: 700; } .d-code .hljs-addition { background: rgba(195,232,141,.08); } .d-code .hljs-deletion { background: rgba(240,113,120,.08); } .d-cursor > *:last-child::after, .d-cursor:empty::after { content: ""; display: inline-block; width: 8px; height: 1.05em; margin-inline-start: 3px; vertical-align: text-bottom; background: var(--accent); border-radius: 2px; animation: d-blink 1s steps(2) infinite; } @keyframes d-blink { 50% { opacity: 0; } } .d-actions { display: flex; gap: 2px; margin-top: 8px; } .d-actions button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; padding: 4px 8px; border-radius: 7px; } .d-actions button:hover { background: var(--side-hover); color: var(--ink); } .d-error { color: var(--danger); font-size: 14px; } .d-typing { display: inline-flex; gap: 4px; padding: 10px 0; } .d-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: d-dot 1.2s infinite ease-in-out; } .d-typing span:nth-child(2) { animation-delay: .15s; } .d-typing span:nth-child(3) { animation-delay: .3s; } @keyframes d-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } } .d-cold { color: var(--muted); font-size: 13px; } /* ---------- welcome ---------- */ .d-welcome { max-width: 780px; margin: 0 auto; padding: 12vh 20px 20px; text-align: center; } .d-welcome .d-mark { width: 46px; height: 46px; font-size: 24px; border-radius: 13px; margin: 0 auto 16px; } .d-welcome h1 { font-size: 26px; font-weight: 800; margin: 0 0 6px; text-wrap: balance; } .d-welcome p { color: var(--muted); margin: 0 0 26px; } .d-sugg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: start; } .d-sugg button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 14px; padding: 12px 14px; text-align: start; display: flex; flex-direction: column; gap: 2px; } .d-sugg button:hover { background: var(--side-hover); } .d-sugg b { font-size: 13.5px; font-weight: 700; } .d-sugg span { font-size: 13px; color: var(--muted); unicode-bidi: plaintext; } /* ---------- composer ---------- */ .d-compose-wrap { flex: 0 0 auto; padding: 8px 20px 12px; background: linear-gradient(to top, var(--bg) 70%, transparent); } .d-compose { max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); transition: border-color .15s; } [dir="rtl"] .d-compose { padding: 8px 16px 8px 8px; } .d-compose:focus-within { border-color: var(--accent); } #diba-root .d-compose textarea, #diba-root .d-compose textarea:focus, #diba-root .d-compose textarea:focus-visible { outline: none !important; box-shadow: none !important; } .d-compose textarea { flex: 1; border: 0; resize: none; background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.6; max-height: 200px; padding: 6px 0; unicode-bidi: plaintext; text-align: start; } .d-compose textarea::placeholder { color: var(--muted); } .d-send { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); } .d-send:disabled { opacity: .35; cursor: default; } .d-send.stop { background: var(--ink); color: var(--bg); } .d-disclaimer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 7px; } .d-jump { position: absolute; inset-inline: 0; margin: 0 auto; bottom: 108px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); display: none; place-items: center; box-shadow: var(--shadow); } .d-jump.show { display: grid; } /* ---------- settings popover ---------- */ .d-pop { position: absolute; top: 52px; inset-inline-end: 12px; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: none; z-index: 5; } .d-pop.show { display: block; } .d-pop label { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin: 6px 0 2px; } .d-pop b { font-variant-numeric: tabular-nums; } .d-pop input[type=range] { width: 100%; accent-color: var(--accent); } .d-pop .d-hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; } .d-model-row { margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); } .d-model-row[hidden] { display: none; } .d-model-row label { margin: 0 0 4px; } .d-model-sel { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; } .d-model-sel:disabled { opacity: .6; cursor: default; } .d-backdrop { display: none; } @media (max-width: 820px) { .d-side { position: absolute; inset-block: 0; inset-inline-start: 0; z-index: 10; box-shadow: var(--shadow); } .d-backdrop.show { display: block; position: absolute; inset: 0; background: rgba(0,0,0,.3); z-index: 9; } .d-sugg { grid-template-columns: 1fr; } .d-welcome { padding-top: 7vh; } .d-msg.user .d-bubble { max-width: 88%; } .d-thread { padding: 14px 14px 24px; } .d-compose-wrap { padding: 6px 12px 10px; } } @media (prefers-reduced-motion: reduce) { .d-side, .d-compose { transition: none; } .d-cursor > *:last-child::after, .d-typing span { animation: none; } } #diba-root .d-error-detail { margin-top: 6px; font-size: 12.5px; opacity: .8; direction: auto; unicode-bidi: plaintext; } /* Persian text inside code: shaped with a Persian-capable fallback, never split into isolated letters */ #diba-root .d-code pre code, #diba-root .d-content :not(pre) > code { font-variant-ligatures: normal; letter-spacing: 0; } /* tables: keep words whole on narrow screens and scroll horizontally instead of breaking inside a word */ #diba-root .d-table th, #diba-root .d-table td { overflow-wrap: normal; word-break: normal; min-width: 6.5em; } #diba-root .d-table td:first-child, #diba-root .d-table th:first-child { white-space: nowrap; } /* Hugging Face sign-in (ZeroGPU Space) */ #diba-root .d-auth { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; } #diba-root .d-auth-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; } #diba-root .d-auth-btn:hover { background: var(--side); } #diba-root .d-auth-in { border-color: var(--accent); color: var(--accent); } #diba-root .d-auth-user { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; } #diba-root .d-auth-note { font-size: 11px; color: var(--muted); line-height: 1.5; } /* image attachments (Diba-Vision) */ #diba-root .d-attach { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; flex: 0 0 auto; } #diba-root .d-attach:hover { background: var(--side); color: var(--ink); } #diba-root .d-mic { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; flex: 0 0 auto; } #diba-root .d-mic:hover { background: var(--side); color: var(--ink); } #diba-root .d-mic.live { color: #fff; background: #e0245e; animation: dMicPulse 1.3s ease-in-out infinite; } #diba-root .d-mic.busy { opacity: .55; } @keyframes dMicPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,36,94,.5); } 50% { box-shadow: 0 0 0 6px rgba(224,36,94,0); } } #diba-root .d-chip-rag { background: color-mix(in srgb, var(--accent) 14%, transparent); } #diba-root .d-voice-prog { max-width: 780px; margin: 0 auto 8px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; font-size: 12.5px; color: var(--muted); } #diba-root .d-vbar { position: relative; flex: 1; height: 6px; border-radius: 4px; background: var(--side); overflow: hidden; } #diba-root .d-vbar > span { position: absolute; inset-inline-start: 0; top: 0; height: 100%; background: var(--accent); border-radius: 4px; transition: width .2s ease; } #diba-root .d-vbar.indet > span { width: 40% !important; animation: dVindet 1.1s ease-in-out infinite; } #diba-root .d-vtx { flex: 0 0 auto; white-space: nowrap; } #diba-root .d-voice-prog.done { color: #16a34a; border-color: color-mix(in srgb, #16a34a 40%, var(--line)); } #diba-root .d-voice-prog.done .d-vbar > span { background: #16a34a; } @keyframes dVindet { 0% { inset-inline-start: -40%; } 100% { inset-inline-start: 100%; } } #diba-root .d-chip-doc .d-doc-sub { opacity: .6; font-size: 11px; } #diba-root .d-attach-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 6px 0; } #diba-root .d-chip { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); } #diba-root .d-chip img { width: 100%; height: 100%; object-fit: cover; display: block; } #diba-root .d-chip button { position: absolute; top: 2px; inset-inline-end: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; } #diba-root .d-chip-doc { width: auto; height: 32px; padding: 0 26px 0 8px; display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2, rgba(127,127,127,.1)); font-size: 12px; max-width: 180px; } #diba-root .d-chip-doc .d-doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } #diba-root .d-chip-doc button { top: 50%; transform: translateY(-50%); } #diba-root .d-msg-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; } #diba-root .d-msg-img { max-width: 220px; max-height: 220px; border-radius: 10px; display: block; } #diba-root .d-compose-wrap.drag .d-compose { outline: 2px dashed var(--accent); outline-offset: 2px; }