/* =====================================================
   styles.css - PromptForge  (Streaming / Chat UI)
   ===================================================== */

/* --- Vazirmatn Font Face (Local) --- */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

/* --- Design Tokens --- */
:root {
    --bg:          #08080f;
    --surface:     #101018;
    --surface-2:   #181824;
    --surface-3:   #1e1e2e;
    --border:      rgba(255,255,255,0.07);
    --border-glow: rgba(124,58,237,0.35);

    --purple:      #7c3aed;
    --purple-lt:   #a855f7;
    --cyan:        #06b6d4;
    --green:       #10b981;
    --amber:       #f59e0b;
    --red:         #ef4444;

    --text:        #f0eeff;
    --text-muted:  #8b89a8;
    --text-dim:    #4e4c6a;

    --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px;
    --ease: cubic-bezier(0.16,1,0.3,1);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.7;
}

/* --- Background Orbs --- */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(110px); opacity: 0.15; animation: float 22s ease-in-out infinite; }
.orb-1 { width: 600px; height: 600px; background: radial-gradient(circle, #7c3aed, transparent 70%); top: -200px; right: -150px; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, #06b6d4, transparent 70%); bottom: -100px; left: -100px; animation-delay: -9s; }
.orb-3 { width: 350px; height: 350px; background: radial-gradient(circle, #a855f7, transparent 70%); top: 50%; left: 40%; animation-delay: -16s; animation-duration: 28s; }

@keyframes float {
    0%,100% { transform: translate(0,0) scale(1); }
    33%      { transform: translate(25px,-35px) scale(1.04); }
    66%      { transform: translate(-18px,18px) scale(0.97); }
}

/* --- Wrapper --- */
.app-wrapper {
    position: relative; z-index: 1;
    max-width: 860px; margin: 0 auto;
    padding: 2rem 1.25rem 5rem;
    display: flex; flex-direction: column; gap: 1.5rem;
}

/* --- Header --- */
.site-header { text-align: center; padding: 2.5rem 1rem 0.5rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.logo-icon { font-size: 2rem; animation: pulse-glow 3s ease-in-out infinite; }
@keyframes pulse-glow {
    0%,100% { filter: drop-shadow(0 0 10px #7c3aed); }
    50%     { filter: drop-shadow(0 0 22px #a855f7); }
}
.logo-text {
    font-size: 2rem; font-weight: 700;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-tagline { font-size: .9rem; color: var(--text-muted); }

/* --- Input Card --- */
.card {
    background: var(--surface);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(124,58,237,.07), 0 8px 32px rgba(0,0,0,.5);
    padding: 2rem;
    transition: border-color .3s;
}
.card:hover { border-color: var(--border-glow); }

.step-badge {
    display: inline-flex; align-items: center;
    padding: .22rem .8rem; border-radius: 999px;
    font-size: .72rem; font-weight: 600;
    background: rgba(124,58,237,.12);
    color: var(--purple-lt);
    border: 1px solid rgba(124,58,237,.25);
    margin-bottom: .85rem;
}
.section-title { font-size: 1.35rem; font-weight: 700; margin-bottom: .3rem; }
.section-desc  { font-size: .88rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* --- Textarea --- */
.textarea-wrapper { position: relative; margin-bottom: 1rem; }

textarea {
    width: 100%; min-height: 130px; max-height: 360px;
    padding: 1rem 1.1rem 2rem;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    font-family: inherit; font-size: .95rem; line-height: 1.75;
    resize: none; direction: rtl;
    transition: border-color .25s, box-shadow .25s;
}
textarea::placeholder { color: var(--text-dim); }
textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,.18); }
textarea:disabled { opacity: .5; cursor: not-allowed; }

.char-counter {
    position: absolute; bottom: .65rem; left: .85rem;
    font-size: .72rem; color: var(--text-dim); direction: ltr;
}

/* --- Buttons --- */
.form-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .75rem 1.6rem; border-radius: var(--r-md);
    font-family: inherit; font-size: .9rem; font-weight: 600;
    border: none; cursor: pointer; text-decoration: none;
    transition: all .25s; position: relative; overflow: hidden; white-space: nowrap;
}
.btn::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.07); opacity: 0; transition: opacity .2s; }
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--purple), var(--purple-lt));
    color: #fff;
    box-shadow: 0 4px 20px rgba(124,58,237,.4);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(124,58,237,.6); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-loader {
    display: none; width: 15px; height: 15px;
    border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading .btn-text,.btn.loading .btn-icon { opacity: .5; }
.btn.loading .btn-loader { display: block; }

.btn-send {
    background: linear-gradient(135deg, var(--cyan), #0ea5e9);
    color: #fff; font-size: .95rem; padding: .85rem 1.8rem;
    box-shadow: 0 4px 20px rgba(6,182,212,.35);
}
.btn-send:hover { box-shadow: 0 6px 28px rgba(6,182,212,.55); transform: translateY(-2px); }

.btn-ghost {
    background: transparent; color: var(--text-muted);
    border: 1.5px solid var(--border); font-size: .85rem;
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* =============================================
   CHAT AREA
   ============================================= */
.chat-area {
    display: flex; flex-direction: column; gap: 1rem;
}

.chat-row {
    display: flex; align-items: flex-start; gap: .85rem;
}
.chat-row--user { flex-direction: row-reverse; }
.chat-row--ai   { flex-direction: row; }

/* Avatar */
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
    border: 2px solid var(--border);
}
.avatar--user { background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.3); }
.avatar--ai   { background: rgba(6,182,212,.12);  border-color: rgba(6,182,212,.3); animation: pulse-border 2s ease-in-out infinite; }
@keyframes pulse-border {
    0%,100% { border-color: rgba(6,182,212,.3); }
    50%     { border-color: rgba(6,182,212,.7); }
}

/* Chat Bubble */
.chat-bubble {
    max-width: 75%;
    padding: 1rem 1.2rem;
    border-radius: var(--r-lg);
    font-size: .9rem; line-height: 1.8;
    position: relative;
}
.bubble-label {
    font-size: .7rem; font-weight: 600; margin-bottom: .35rem;
    opacity: .6; letter-spacing: .4px;
}

.chat-bubble--user {
    background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(168,85,247,.15));
    border: 1px solid rgba(124,58,237,.3);
    border-top-right-radius: 4px;
    color: var(--text);
}
.chat-bubble--user .bubble-label { color: var(--purple-lt); }

.chat-bubble--ai {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
    min-width: 260px;
}

/* --- Thinking State --- */
.thinking-state {}

.thinking-header {
    display: flex; align-items: center; gap: .5rem;
    font-size: .88rem; font-weight: 600; color: var(--text-muted);
    margin-bottom: .6rem;
}
.thinking-icon { font-size: 1.1rem; animation: think-spin 3s linear infinite; }
@keyframes think-spin { to { transform: rotate(360deg); } }

/* Three-dot animation */
.thinking-dots { display: flex; gap: .35rem; margin-bottom: .75rem; }
.thinking-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--purple-lt);
    animation: dot-bounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: .2s; }
.thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-bounce {
    0%,80%,100% { transform: scale(.75); opacity: .4; }
    40%         { transform: scale(1);   opacity: 1; }
}

/* Stream counter */
.stream-counter {
    display: flex; flex-direction: column; gap: .35rem;
    font-size: .75rem; color: var(--text-dim);
}
.counter-bar-wrap {
    width: 100%; height: 3px; background: var(--surface-3);
    border-radius: 99px; overflow: hidden;
}
.counter-bar {
    height: 100%; width: 0%; border-radius: 99px;
    background: linear-gradient(90deg, var(--purple), var(--cyan));
    transition: width .4s var(--ease);
}

/* Thinking done */
.thinking-done {
    display: flex; align-items: center; gap: .5rem;
    font-size: .88rem; font-weight: 600; color: var(--green);
}

/* Error state */
.error-state {
    display: flex; align-items: flex-start; gap: .5rem;
    color: #fca5a5; font-size: .88rem;
}

/* =============================================
   RESULT CARDS
   ============================================= */
.result-cards { display: flex; flex-direction: column; gap: 1rem; padding-right: 50px; }

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: border-color .25s;
}
.result-card:hover { border-color: var(--border-glow); }

.card-header {
    display: flex; align-items: center; gap: .5rem;
    padding: .75rem 1.1rem;
    background: rgba(255,255,255,.02);
    border-bottom: 1px solid var(--border);
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
}
.card-icon { font-size: 1rem; }

/* Analysis */
.result-card--analysis { border-color: rgba(124,58,237,.2); }
.result-card--analysis .card-header { color: var(--purple-lt); }
.analysis-text {
    padding: 1rem 1.1rem; font-size: .88rem;
    color: var(--text-muted); line-height: 1.85;
}

/* Prompt */
.result-card--prompt { border-color: rgba(6,182,212,.15); }
.result-card--prompt .card-header { color: var(--cyan); }

.btn-copy {
    margin-right: auto;
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .3rem .75rem; border-radius: var(--r-sm);
    background: rgba(124,58,237,.1); color: var(--purple-lt);
    border: 1px solid rgba(124,58,237,.2);
    font-family: inherit; font-size: .72rem; font-weight: 600;
    cursor: pointer; transition: all .2s;
}
.btn-copy:hover { background: rgba(124,58,237,.22); border-color: var(--purple); }
.btn-copy.copied { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.35); color: var(--green); }

.prompt-content {
    padding: 1.1rem;
    font-size: .875rem; line-height: 1.9;
    white-space: pre-wrap; word-break: break-word;
    max-height: 400px; overflow-y: auto;
    color: var(--text);
}
.prompt-content::-webkit-scrollbar { width: 4px; }
.prompt-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* Tips */
.result-card--tips { border-color: rgba(16,185,129,.15); }
.result-card--tips .card-header { color: var(--green); }
.tips-list { list-style: none; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; }
.tips-list li {
    display: flex; align-items: flex-start; gap: .55rem;
    font-size: .85rem; color: var(--text-muted); line-height: 1.7;
}
.tips-list li::before { content: '←'; color: var(--green); flex-shrink: 0; margin-top: .1rem; }

/* CTA */
.result-card--cta { border-color: rgba(6,182,212,.2); }
.cta-desc { padding: 1rem 1.1rem .5rem; font-size: .85rem; color: var(--text-muted); }
.result-card--cta .btn-send { display: flex; margin: 0 1.1rem 1rem; }

/* --- Error Box (inline input) --- */
.error-box {
    display: flex; align-items: flex-start; gap: .5rem;
    padding: .75rem 1rem; margin-top: .75rem;
    background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
    border-radius: var(--r-sm); color: #fca5a5; font-size: .85rem;
    animation: fade-in .3s ease;
}

/* --- Footer --- */
.site-footer {
    text-align: center; font-size: .78rem;
    color: var(--text-dim); padding-top: 1rem;
}
.site-footer strong { color: var(--text-muted); }

/* =============================================
   UTILITIES & ANIMATIONS
   ============================================= */
.hidden { display: none !important; }

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

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.slide-in-right { animation: slide-in-right .45s var(--ease) forwards; }
.slide-in-left  { animation: slide-in-left  .45s var(--ease) forwards; }
.slide-up       { animation: slide-up       .4s  var(--ease) forwards; }

/* Typing cursor */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.typing-cursor::after {
    content: '|';
    color: var(--cyan);
    animation: blink .8s step-end infinite;
    margin-right: 1px;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .app-wrapper { padding: 1rem .85rem 3.5rem; }
    .card { padding: 1.35rem 1rem; border-radius: var(--r-lg); }
    .chat-bubble { max-width: 88%; }
    .result-cards { padding-right: 0; }
    .logo-text { font-size: 1.5rem; }
    .btn-send { width: 100%; justify-content: center; }
}

/* =============================================
   HISTORY SIDEBAR & TERMINAL (NEW)
   ============================================= */

/* --- Top Actions --- */
.top-actions {
    display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem;
}
.action-btn {
    background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.3);
    color: var(--purple-lt); padding: 0.5rem 1rem; border-radius: var(--r-md);
    cursor: pointer; transition: all 0.3s; font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem; font-weight: 600;
}
.action-btn:hover { background: rgba(124,58,237,.2); border-color: var(--purple); }

/* --- History Sidebar --- */
.history-sidebar {
    position: fixed; top: 0; right: -350px; width: 350px; height: 100vh;
    background: var(--surface); border-left: 1px solid var(--border);
    box-shadow: -5px 0 30px rgba(0,0,0,0.5); z-index: 100;
    transition: right 0.3s var(--ease); display: flex; flex-direction: column;
}
.history-sidebar.open { right: 0; }
.history-header {
    padding: 1.5rem; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.history-title { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.history-close {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1.5rem; transition: color 0.2s;
}
.history-close:hover { color: var(--red); }
.history-content {
    flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem;
}
.history-content::-webkit-scrollbar { width: 4px; }
.history-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.history-item {
    background: var(--surface-2); padding: 1rem; border-radius: var(--r-md);
    border: 1px solid var(--border); transition: border-color 0.2s; cursor: pointer;
}
.history-item:hover { border-color: rgba(124,58,237,.4); }
.history-item-date {
    font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.5rem; direction: ltr; text-align: left;
}
.history-item-raw {
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem;
    line-height: 1.6; max-height: 60px; overflow: hidden; text-overflow: ellipsis;
}
.history-item-enhanced {
    font-size: 0.85rem; color: var(--cyan); line-height: 1.6;
    max-height: 80px; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.5rem;
}
.history-item-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 0.5rem; border-top: 1px dashed var(--border);
}
.history-item-model {
    font-size: 0.7rem; color: var(--text-dim); text-align: left; direction: ltr;
}
.history-item-model span {
    color: var(--purple-lt); font-family: monospace;
}
.history-item-delete {
    background: transparent; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 0.9rem; transition: color 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.history-item-delete:hover { color: var(--red); }
.load-more-btn {
    width: 100%; padding: 0.75rem; background: rgba(124,58,237,.1);
    border: 1px solid rgba(124,58,237,.3); color: var(--purple-lt);
    border-radius: var(--r-md); cursor: pointer; margin-top: auto;
    transition: all 0.2s; font-family: 'Vazirmatn', sans-serif; font-size: 0.9rem;
}
.load-more-btn:hover { background: rgba(124,58,237,.2); }
.load-more-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Terminal Console --- */
.terminal-console {
    position: fixed; bottom: -350px; left: 0; width: 100%; height: 300px;
    background: #0d0d0d; border-top: 1px solid #333; z-index: 100;
    transition: bottom 0.3s var(--ease); display: flex; flex-direction: column;
    font-family: monospace, monospace; direction: ltr; box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
}
.terminal-console.open { bottom: 0; }
.terminal-header {
    background: #1a1a1a; padding: 0.5rem 1rem; color: #888; font-size: 0.8rem;
    display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333;
}
.terminal-title { display: flex; align-items: center; gap: 0.5rem; }
.terminal-close { cursor: pointer; color: #888; font-size: 1.2rem; }
.terminal-close:hover { color: #fff; }
.terminal-body {
    flex: 1; overflow-y: auto; padding: 1rem; color: #0f0; font-size: 0.85rem; line-height: 1.6;
}
.log-line { margin-bottom: 0.3rem; word-break: break-all; }
.log-line.error { color: #ff5555; }
.log-line.info { color: #55ffff; }
.log-line.success { color: #55ff55; }
.log-line.warning { color: #ffff55; }
.log-time { color: #888; margin-right: 8px; font-size: 0.75rem; }

/* --- Auth Modal --- */
.auth-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.auth-modal-overlay.open { opacity: 1; pointer-events: auto; }
.auth-modal {
    background: var(--surface); padding: 2rem; border-radius: var(--r-md);
    border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    width: 90%; max-width: 350px; text-align: center;
}
.auth-modal h3 { margin-bottom: 1rem; color: var(--text); }
.auth-input {
    width: 100%; padding: 0.75rem; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text); margin-bottom: 1rem; text-align: center;
    font-family: inherit; font-size: 1rem;
}
.auth-input:focus { outline: none; border-color: var(--purple); }
.auth-submit {
    width: 100%; padding: 0.75rem; background: var(--purple); color: #fff;
    border: none; border-radius: var(--r-sm); cursor: pointer; font-family: inherit;
    font-weight: 600; transition: background 0.2s;
}
.auth-submit:hover { background: var(--purple-lt); }
.auth-error { color: var(--red); font-size: 0.8rem; margin-top: 0.5rem; display: none; }

/* --- Settings Panel --- */
.settings-btn {
    background: rgba(6,182,212,.1); border: 1px solid rgba(6,182,212,.3);
    color: var(--cyan); padding: 0.5rem 0.85rem; border-radius: var(--r-md);
    cursor: pointer; transition: all 0.3s; font-family: 'Vazirmatn', sans-serif;
    font-size: 1.1rem; line-height: 1;
}
.settings-btn:hover { background: rgba(6,182,212,.2); border-color: var(--cyan); }

.settings-panel {
    position: fixed; top: 0; left: -480px; width: 460px; height: 100vh;
    background: var(--surface); border-right: 1px solid var(--border);
    box-shadow: 5px 0 30px rgba(0,0,0,0.5); z-index: 100;
    transition: left 0.3s var(--ease); display: flex; flex-direction: column;
    overflow-y: auto;
}
.settings-panel.open { left: 0; }
.settings-panel-header {
    padding: 1.5rem; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.settings-panel-title { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.settings-panel-close {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1.5rem; transition: color 0.2s;
}
.settings-panel-close:hover { color: var(--red); }

.settings-section { padding: 1.25rem; border-bottom: 1px solid var(--border); }
.settings-section-title {
    font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.75rem;
}
.settings-form { display: flex; flex-direction: column; gap: 0.5rem; }
.settings-input {
    width: 100%; padding: 0.6rem 0.8rem; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text);
    font-family: inherit; font-size: 0.88rem; direction: ltr;
}
.settings-input:focus { outline: none; border-color: var(--cyan); }
.settings-add-btn {
    padding: 0.6rem 1rem; background: var(--cyan); color: #000;
    border: none; border-radius: var(--r-sm); cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.88rem; transition: opacity 0.2s;
}
.settings-add-btn:hover { opacity: 0.85; }

.api-card {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 0.9rem; margin-bottom: 0.65rem;
    transition: border-color 0.2s;
}
.api-card.active-api { border-color: var(--cyan); }
.api-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.api-card-name { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.api-card-url { font-size: 0.72rem; color: var(--text-dim); direction: ltr; margin-top: 0.15rem; }
.api-card-badge {
    font-size: 0.65rem; background: rgba(6,182,212,.15); color: var(--cyan);
    padding: 0.15rem 0.5rem; border-radius: 99px; border: 1px solid rgba(6,182,212,.3); white-space: nowrap;
}
.api-card-actions { display: flex; gap: 0.4rem; margin-top: 0.65rem; align-items: center; flex-wrap: wrap; }
.api-card-actions select {
    flex: 1; padding: 0.4rem 0.5rem; background: var(--surface-3); border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text); font-family: inherit; font-size: 0.8rem; direction: ltr;
    min-width: 0;
}
.api-card-actions select:focus { outline: none; border-color: var(--purple); }
.btn-load-models {
    padding: 0.4rem 0.7rem; background: rgba(124,58,237,.15); color: var(--purple-lt);
    border: 1px solid rgba(124,58,237,.3); border-radius: var(--r-sm); cursor: pointer;
    font-family: inherit; font-size: 0.78rem; white-space: nowrap; transition: all 0.2s;
}
.btn-load-models:hover { background: rgba(124,58,237,.3); }
.btn-activate {
    padding: 0.4rem 0.8rem; background: var(--cyan); color: #000;
    border: none; border-radius: var(--r-sm); cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.78rem; white-space: nowrap; transition: opacity 0.2s;
}
.btn-activate:hover { opacity: 0.8; }
.btn-activate:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-delete-api {
    padding: 0.4rem 0.6rem; background: rgba(239,68,68,.1); color: var(--red);
    border: 1px solid rgba(239,68,68,.25); border-radius: var(--r-sm); cursor: pointer;
    font-family: inherit; font-size: 0.78rem; transition: all 0.2s;
}
.btn-delete-api:hover { background: rgba(239,68,68,.2); }
.active-model-badge {
    font-size: 0.7rem; color: var(--green); margin-top: 0.4rem;
    background: rgba(16,185,129,.1); padding: 0.2rem 0.6rem; border-radius: 99px;
    border: 1px solid rgba(16,185,129,.2); display: inline-block; direction: ltr;
}


