@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
}

.starfield { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
.star { position: absolute; background: #fff; border-radius: 50%; }
.star.small { width: 1px; height: 1px; }
.star.medium { width: 2px; height: 2px; }
.star.large { width: 3px; height: 3px; }
.star.twinkle-1 { animation: twinkle 3s ease-in-out infinite; }
.star.twinkle-2 { animation: twinkle 4s ease-in-out infinite; }
.star.twinkle-3 { animation: twinkle 5s ease-in-out infinite; }

@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.shooting-star { position: absolute; width: 80px; height: 1px; background: linear-gradient(90deg, #fff, transparent); animation: shoot 8s linear infinite; opacity: 0; }
@keyframes shoot { 0% { transform: translateX(-100px) translateY(0); opacity: 0; } 5% { opacity: 1; } 15% { transform: translateX(calc(100vw + 100px)) translateY(200px); opacity: 0; } 100% { opacity: 0; } }

.glass { background: rgba(255,255,255,0.03); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; }
.glass-strong { background: rgba(255,255,255,0.06); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; }

.app { position: relative; z-index: 1; max-width: 1500px; margin: 0 auto; padding: 20px; min-height: 100vh; display: flex; flex-direction: column; gap: 20px; }

.header { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; }
.header-left { display: flex; align-items: center; gap: 14px; }
.header-logo { width: 36px; height: 36px; }
.header-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.header-badge { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }

.main { display: grid; grid-template-columns: 320px 1fr; gap: 20px; flex: 1; }
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.panel { padding: 22px; }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.4); margin-bottom: 18px; }
.panel-title svg { width: 16px; height: 16px; opacity: 0.4; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: rgba(255,255,255,0.35); margin-bottom: 8px; }
.input-wrap { position: relative; }

input[type="text"], input[type="password"], select { width: 100%; padding: 10px 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; color: #fff; font-size: 13px; font-family: inherit; transition: all 0.2s; -webkit-appearance: none; }
select { cursor: pointer; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.3)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select option { background: #111; color: #fff; }
select option:disabled { color: rgba(255,255,255,0.3); }
input:focus, select:focus { outline: none; border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); }

.eye-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 4px; opacity: 0.3; transition: opacity 0.2s; }
.eye-btn:hover { opacity: 0.7; }
.eye-btn svg { width: 16px; height: 16px; }

.version-group { display: flex; flex-direction: column; gap: 8px; }
.version-option { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.version-option:hover { background: rgba(255,255,255,0.04); }
.version-option.active { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); }
.version-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); transition: all 0.2s; position: relative; flex-shrink: 0; }
.version-option.active .version-dot { border-color: #fff; }
.version-option.active .version-dot::after { content: ''; position: absolute; top: 3px; left: 3px; width: 6px; height: 6px; background: #fff; border-radius: 50%; }
.version-info strong { display: block; font-size: 13px; font-weight: 600; }
.version-info small { font-size: 11px; color: rgba(255,255,255,0.3); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.toggle-row span { font-size: 13px; color: rgba(255,255,255,0.6); }
.toggle { width: 40px; height: 22px; background: rgba(255,255,255,0.1); border-radius: 11px; cursor: pointer; position: relative; transition: background 0.3s; }
.toggle.on { background: rgba(255,255,255,0.3); }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform 0.3s; }
.toggle.on::after { transform: translateX(18px); }

.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.stat-row + .stat-row { border-top: 1px solid rgba(255,255,255,0.04); }
.stat-row span { font-size: 13px; color: rgba(255,255,255,0.35); }
.stat-row strong { font-size: 15px; font-weight: 600; }

.btn-docs { width: 100%; padding: 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-docs:hover { background: rgba(255,255,255,0.08); color: #fff; }
.btn-docs svg { width: 14px; height: 14px; }

.chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.chat-top h2 { font-size: 16px; font-weight: 600; }
.btn-sm { padding: 6px 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; color: rgba(255,255,255,0.5); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-sm:hover { background: rgba(255,255,255,0.08); color: #fff; }

.msg-list { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.msg-list::-webkit-scrollbar { width: 6px; }
.msg-list::-webkit-scrollbar-track { background: transparent; }
.msg-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.msg-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: rgba(255,255,255,0.2); gap: 16px; padding: 60px; }
.msg-empty svg { width: 64px; height: 64px; opacity: 0.15; }
.msg-empty p { font-size: 14px; }

.msg { display: flex; gap: 12px; animation: msgIn 0.3s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { flex-direction: row-reverse; }
.msg-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.msg-icon svg { width: 16px; height: 16px; }
.msg.user .msg-icon { background: rgba(255,255,255,0.1); }

.msg-bubble { max-width: 65%; padding: 12px 16px; border-radius: 14px; line-height: 1.6; font-size: 14px; }
.msg.user .msg-bubble { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.12); border-bottom-right-radius: 4px; }
.msg.assistant .msg-bubble { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-bottom-left-radius: 4px; }
.msg.err .msg-bubble { background: rgba(255,50,50,0.08); border: 1px solid rgba(255,50,50,0.2); color: rgba(255,100,100,0.9); }

.msg-bubble p { margin: 0 0 10px 0; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble strong, .msg-bubble b { font-weight: 600; color: #fff; }
.msg-bubble em, .msg-bubble i { font-style: italic; color: rgba(255,255,255,0.85); }
.msg-bubble code { font-family: 'JetBrains Mono', monospace; background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #a0d8ef; }
.msg-bubble pre { background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 14px; margin: 10px 0; overflow-x: auto; }
.msg-bubble pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; color: #e0e0e0; display: block; white-space: pre; }

.code-block { margin: 10px 0; }
.code-header { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.05); padding: 6px 12px; border-radius: 8px 8px 0 0; font-size: 12px; color: rgba(255,255,255,0.5); }
.code-block pre { margin: 0; border-radius: 0 0 8px 8px; }
.copy-btn { background: rgba(255,255,255,0.1); border: none; padding: 4px 10px; border-radius: 4px; color: rgba(255,255,255,0.6); font-size: 11px; cursor: pointer; transition: all 0.2s; }
.copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

.msg-bubble ul, .msg-bubble ol { margin: 10px 0; padding-left: 20px; }
.msg-bubble li { margin: 4px 0; }
.msg-bubble blockquote { border-left: 3px solid rgba(255,255,255,0.2); margin: 10px 0; padding: 8px 14px; background: rgba(255,255,255,0.03); border-radius: 0 8px 8px 0; color: rgba(255,255,255,0.7); }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4, .msg-bubble h5, .msg-bubble h6 { margin: 16px 0 8px 0; font-weight: 600; }
.msg-bubble h1 { font-size: 20px; } .msg-bubble h2 { font-size: 18px; } .msg-bubble h3 { font-size: 16px; } .msg-bubble h4, .msg-bubble h5, .msg-bubble h6 { font-size: 14px; }
.msg-bubble hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 16px 0; }
.msg-bubble a { color: #6db3f2; text-decoration: none; }
.msg-bubble a:hover { text-decoration: underline; }

.chat-input { display: flex; gap: 10px; padding: 18px 24px; border-top: 1px solid rgba(255,255,255,0.04); }
.chat-input textarea { flex: 1; padding: 12px 16px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; color: #fff; font-size: 14px; font-family: inherit; resize: none; min-height: 44px; max-height: 160px; transition: border-color 0.2s, opacity 0.2s; }
.chat-input textarea:focus { outline: none; border-color: rgba(255,255,255,0.15); }
.chat-input textarea::placeholder { color: rgba(255,255,255,0.2); }
.chat-input textarea:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-send { width: 44px; height: 44px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; }
.btn-send:hover:not(:disabled) { background: rgba(255,255,255,0.15); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-send svg { width: 18px; height: 18px; }
.btn-send.loading svg { display: none; }
.btn-send.loading::after { content: ''; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { max-width: 800px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 24px 28px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.modal-head h2 { font-size: 18px; font-weight: 600; }
.modal-x { width: 32px; height: 32px; background: rgba(255,255,255,0.04); border: none; border-radius: 8px; color: rgba(255,255,255,0.4); font-size: 18px; cursor: pointer; transition: all 0.2s; }
.modal-x:hover { background: rgba(255,255,255,0.1); color: #fff; }
.modal-inner { padding: 28px; }

.doc-block { margin-bottom: 28px; }
.doc-block:last-child { margin-bottom: 0; }
.doc-block h3 { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 14px; }
.doc-block pre { background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 16px; overflow-x: auto; font-size: 12px; line-height: 1.7; color: rgba(255,255,255,0.7); font-family: 'JetBrains Mono', monospace; position: relative; }
.doc-copy { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,0.1); border: none; padding: 4px 10px; border-radius: 4px; color: rgba(255,255,255,0.6); font-size: 11px; cursor: pointer; transition: all 0.2s; }
.doc-copy:hover { background: rgba(255,255,255,0.2); color: #fff; }

.endpoint { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); border-radius: 8px; margin-bottom: 8px; gap: 12px; }
.endpoint:last-child { margin-bottom: 0; }
.endpoint-main { flex: 1; min-width: 0; }
.endpoint code { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: rgba(255,255,255,0.8); font-size: 13px; word-break: break-all; }
.endpoint p { font-size: 12px; color: rgba(255,255,255,0.3); margin-top: 4px; margin-bottom: 0; }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    gap: 6px;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.on {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-badge.on::before {
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.status-badge.off {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-badge.off::before {
    background: #ef4444;
}

@media (max-width: 960px) { .main { grid-template-columns: 1fr; } .sidebar { order: 2; } .chat { order: 1; min-height: 500px; } }
@media (max-width: 600px) { 
    .app { padding: 12px; } 
    .header { padding: 14px 18px; } 
    .msg-bubble { max-width: 85%; } 
    .endpoint { flex-direction: column; align-items: flex-start; }
    .status-badge { margin-top: 8px; }
}
