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

:root {
    /* Dark + Neon Color Scheme */
    --bg-dark: #0a0e27;
    --bg-darker: #050810;
    --bg-light: #1a1f3a;
    --bg-lighter: #252d4a;
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff00ff;
    --neon-green: #39ff14;
    --neon-purple: #b200ff;
    --text-primary: #ffffff;
    --text-secondary: #b0b8c6;
    --border-color: #2a3150;
    --user-bubble: #1a0033;
    --assistant-bubble: #1a1f3a;
    --gradient-1: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    --gradient-accent: linear-gradient(135deg, #ff00ff 0%, #00f0ff 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gradient-1);
    color: var(--text-primary);
    overflow: hidden;
}

html, body, #app {
    height: 100%;
    width: 100%;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: flex;
}

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

/* ===== LOGIN SCREEN ===== */
#loginScreen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-light) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background-color: var(--bg-light);
    padding: 40px;
    border-radius: 12px;
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3), 0 10px 40px rgba(0, 0, 0, 0.7);
}

.login-box h1 {
    font-size: 28px;
    margin-bottom: 5px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.login-box .subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.error-message {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

/* ===== CHAT SCREEN ===== */
#chatScreen {
    flex-direction: row;
}

.chat-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 15px;
    gap: 15px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-size: 18px;
}

.sidebar-spacer {
    flex: 0;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 6px;
    text-align: left;
    transition: color 0.2s;
}

.btn-logout:hover {
    color: #ff4444;
}

.sidebar-context-wrapper {
    margin-top: 10px;
    padding: 10px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-context-header {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.context-pills {
    max-height: 60px;
    overflow-y: auto;
}

.context-dropdown-wrapper.sidebar-context-dropdown-wrapper {
    position: relative;
}

.context-dropdown-wrapper.sidebar-context-dropdown-wrapper .context-dropdown {
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    z-index: 30;
}

.context-files-list {
    max-height: 170px;
    overflow-y: auto;
}

.context-file-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}

.context-file-item:last-child {
    border-bottom: none;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: var(--bg-lighter);
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
}

.chat-history-list h3 {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 10px;
    padding: 5px;
}

.history-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-item {
    padding: 10px;
    background-color: var(--bg-lighter);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.history-item.active {
    background-color: var(--primary-color);
}

.history-item-container {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

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

.history-item-delete {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-item-delete:hover {
    background-color: rgba(220, 38, 38, 0.1);
    opacity: 1;
}

/* ===== CHAT MAIN AREA ===== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
    overflow: hidden;
}

.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 10px;
    padding: 10px 20px 0;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-dark);
}

.context-bar {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.context-pills {
    min-height: 36px;
    max-height: 100px;
    overflow-y: auto;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
}

.context-dropdown-wrapper {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.context-toggle {
    width: 100%;
}

.context-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 42px;
    max-height: 260px;
    overflow-y: auto;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 0 0 6px 6px;
    z-index: 30;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.context-dropdown.up {
    top: auto;
    bottom: 42px;
    border-radius: 6px 6px 0 0;
}

.context-files-list {
    max-height: 210px;
    overflow-y: auto;
}

.context-files-list .context-file-item {
    display: flex;
    align-items: center;
}

.upload-button-inline {
    align-self: flex-start;
    margin-top: 6px;
    min-width: 160px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 16px;
}

/* ===== MESSAGE BUBBLES ===== */
.message {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

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

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.message.user .message-bubble {
    background-color: var(--user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
    border-left: 3px solid var(--neon-magenta);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
}

.message.assistant .message-bubble {
    background-color: var(--assistant-bubble);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--neon-cyan);
    border-left: 3px solid var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

/* ===== COPY BUTTON ===== */
.message-bubble {
    position: relative;
}

.btn-copy {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
    line-height: 1;
}

.message-bubble:hover .btn-copy {
    opacity: 0.7;
}

.btn-copy:hover {
    opacity: 1 !important;
    border-color: var(--neon-cyan);
}

/* ===== MARKDOWN RENDERING ===== */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    margin-top: 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.message-bubble h1 { font-size: 1.5em; }
.message-bubble h2 { font-size: 1.3em; }
.message-bubble h3 { font-size: 1.1em; }

.message-bubble p {
    margin-bottom: 8px;
}

.message-bubble code {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-bubble pre {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-bubble pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.message-bubble ul,
.message-bubble ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.message-bubble li {
    margin-bottom: 4px;
}

.message-bubble blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 12px;
    margin: 8px 0;
    opacity: 0.8;
}

.message-bubble a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-bubble a:hover {
    text-decoration: underline;
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble em {
    font-style: italic;
}

.message-bubble table {
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.9em;
}

.message-bubble table td,
.message-bubble table th {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
}

.message-bubble table th {
    background-color: rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 5px;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

.loading-bubble {
    background-color: var(--assistant-bubble);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 4px;
    align-items: flex-end;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: bounce 1.4s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ===== INPUT AREA ===== */
.input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    max-height: 100px;
    transition: border-color 0.3s;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

#chatForm.disabled .input-wrapper {
    opacity: 0.45;
    pointer-events: none;
}

#chatForm.disabled #messageInput {
    background-color: var(--bg-dark);
    border-color: var(--border-color);
    cursor: not-allowed;
}

.btn-send {
    padding: 12px 16px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    background-color: #1d4ed8;
}

.btn-send:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
}

.btn-upload {
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-upload:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.context-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.context-selector label {
    flex-shrink: 0;
}

.context-selector select {
    flex: 1;
    padding: 8px;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

/* ===== CONTEXT PILLS & DROPDOWN ===== */
.context-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    opacity: 100%;
    min-height: 24px;
}

.context-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    animation: slideIn 0.2s ease-out;
}

.context-pill-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    display: flex;
    align-items: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.context-pill-remove:hover {
    opacity: 1;
}

.context-dropdown-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.context-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.context-toggle:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.context-toggle.active {
    border-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--text-primary);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.context-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.context-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.context-search {
    width: calc(100% - 16px);
    margin: 8px;
    padding: 8px 12px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
}

.context-search:focus {
    outline: none;
    border-color: var(--primary-color);
}

.context-files-list {
    display: flex;
    flex-direction: column;
}

.context-file-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-file-item:last-child {
    border-bottom: none;
}

.context-file-item:hover {
    background-color: var(--bg-dark);
}

.context-file-item.selected {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--primary-color);
}

.context-file-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.context-no-results {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
}

.history-header h3 {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin: 0;
}

.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    color: var(--danger-color);
    background-color: rgba(220, 38, 38, 0.1);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #ff00ff 0%, #00f0ff 100%);
    color: var(--bg-dark);
    font-weight: 600;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.7), 0 0 15px rgba(0, 240, 255, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--bg-lighter);
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.2);
}

.btn-secondary:hover {
    background-color: var(--bg-lighter);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.4), 0 0 15px rgba(0, 240, 255, 0.3);
}

.btn-danger {
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

.btn-danger:hover {
    background-color: rgba(255, 0, 0, 1);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-content.large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-light);
    z-index: 2;
}

.modal-header h2 {
    font-size: 16px;
    letter-spacing: 0.5px;
}

.session-id-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    opacity: 0.7;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
}

.config-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 18px;
    margin-bottom: 18px;
}

.config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Model Behavior spans full width */
.config-section:nth-child(6) {
    grid-column: 1 / -1;
}

.config-section h3 {
    color: var(--neon-cyan);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 14px;
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.config-group:last-child {
    margin-bottom: 0;
}

.config-group label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.config-group input[type="checkbox"] {
    width: auto;
    margin-right: 4px;
}

.config-group input[type="number"],
.config-group input[type="range"],
.config-group select {
    padding: 7px 10px;
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    width: 100%;
}

.config-group select option {
    background-color: var(--bg-darker);
    color: var(--text-primary);
}

.select-with-reload {
    display: flex;
    gap: 6px;
    align-items: center;
}

.select-with-reload select {
    flex: 1;
}

.btn-reload {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.btn-reload:hover {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
}

.config-group input[type="range"] {
    flex: 1;
    padding: 5px;
}

.config-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.config-header label {
    flex: 1;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--neon-cyan);
    color: var(--bg-dark);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.floating-tooltip {
    position: fixed;
    background: var(--bg-darker);
    color: var(--text-primary);
    border: 1px solid var(--neon-cyan);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    pointer-events: none;
    z-index: 10000;
    font-weight: normal;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-darker);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-container input[type="range"].colored-slider {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        #39ff14 0%, 
        #39ff14 20%, 
        #ffff00 40%, 
        #ff9500 70%, 
        #ff0000 100%
    );
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    transition: all 0.2s;
}

.slider-container input[type="range"].colored-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    border: 2px solid var(--bg-light);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.7);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    transition: all 0.2s;
}

.slider-container input[type="range"].colored-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: 2px solid var(--bg-light);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.7);
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
}

.slider-container input[type="range"]::-moz-range-thumb:hover {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
}

.slider-value {
    min-width: 50px;
    text-align: right;
    color: var(--neon-cyan);
    font-weight: 600;
}

.indicator-bar {
    position: relative;
    height: 4px;
    background: linear-gradient(90deg, 
        #39ff14 0%, 
        #39ff14 20%, 
        #ffff00 40%, 
        #ff9500 70%, 
        #ff0000 100%
    );
    border-radius: 2px;
    margin: 8px 0;
}

.indicator-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--neon-cyan);
    border: 2px solid var(--bg-light);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

.config-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin-bottom: 4px;
    gap: 4px;
}

.label-safe {
    color: #39ff14;
    font-weight: 600;
}

.label-moderate {
    color: #ffff00;
    font-weight: 600;
}

.label-strict {
    color: #ff0000;
    font-weight: 600;
}

.config-detail {
    background: var(--bg-darker);
    padding: 8px 10px;
    border-left: 3px solid var(--neon-magenta);
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-top: 6px;
}

.config-detail strong {
    color: var(--neon-cyan);
    display: inline;
    margin-right: 4px;
}

.config-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-style: italic;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background-color: var(--bg-light);
    z-index: 2;
}

.modal-footer .btn {
    min-width: 100px;
}

/* ===== LOADING INDICATOR ===== */
.loading-indicator {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--bg-light);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 999;
    align-items: center;
    gap: 10px;
}

.loading-indicator.show {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-indicator p {
    font-size: 13px;
    white-space: nowrap;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ===== SIDEBAR TOGGLE & OVERLAY ===== */
.sidebar-toggle-btn {
    display: none;
    background: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-height: 44px;
    flex-shrink: 0;
}

.sidebar-toggle-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.sidebar-toggle-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.sidebar-toggle-btn.active span:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: 1px solid var(--border-color);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .chat-main {
        position: relative;
    }

    .chat-controls {
        padding-left: 10px;
    }

    .message-bubble {
        max-width: 85%;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .config-section:nth-child(5) {
        grid-column: auto;
    }

    .login-container {
        max-width: 90%;
    }

    .login-box {
        padding: 30px 24px;
    }

    .docs-layout {
        flex-direction: column;
    }

    .docs-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .sidebar {
        width: 85vw;
        max-width: 300px;
    }

    .chat-controls {
        padding: 10px 10px 15px 10px;
        gap: 6px;
    }

    .context-dropdown-wrapper {
        min-width: 140px;
    }

    .chat-input {
        padding: 12px;
    }

    .input-wrapper {
        gap: 6px;
    }

    #messageInput {
        font-size: 16px;
        padding: 10px 12px;
    }

    .btn-send {
        padding: 10px 14px;
        font-size: 16px;
    }

    .btn-upload {
        padding: 10px;
        font-size: 16px;
    }

    .message-bubble {
        max-width: 92%;
        font-size: 14px;
    }

    .message-time {
        font-size: 9px;
    }

    .modal-content {
        width: 98%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 10px 16px;
    }

    .login-box {
        padding: 24px 20px;
    }

    .login-box h1 {
        font-size: 22px;
    }
}

/* ===== SIDEBAR CONFIG ===== */
.sidebar-config {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-config-header {
    padding: 8px 12px;
    background-color: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    font-weight: 600;
}

.sidebar-config-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-config-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-config-group label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-config-group input[type="checkbox"] {
    width: auto;
}

.sidebar-config-group input[type="number"] {
    width: 100%;
    padding: 4px 8px;
    background-color: var(--bg-lighter);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
}

.sidebar-config-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    background: linear-gradient(90deg, #39ff14 0%, #ffff00 40%, #ff9500 70%, #ff0000 100%);
    outline: none;
}

.sidebar-config-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
}

.sidebar-config-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
}

.sidebar-config-group strong {
    color: var(--neon-cyan);
}

.btn-docs {
    font-size: 13px;
}

/* ===== SIDEBAR CHAT HISTORY ===== */
.sidebar-history {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.sidebar-history-header {
    padding: 8px 12px;
    background-color: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.btn-clear-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-clear-all:hover {
    opacity: 1;
}

.sidebar-history-list {
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 12px 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
    background-color: transparent;
}

.history-item:hover {
    background-color: var(--bg-lighter);
}

.history-item.active {
    background-color: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.history-item.active-chat .history-item-title {
    color: var(--neon-cyan);
}

.history-item.previewing {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
}

.history-resume {
    background-color: rgba(0, 240, 255, 0.05);
    border: 1px dashed rgba(0, 240, 255, 0.3);
    margin-bottom: 4px;
}

.history-resume .history-item-title {
    color: var(--neon-cyan);
    font-weight: 600;
}

.history-resume:hover {
    background-color: rgba(0, 240, 255, 0.12);
}

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

.history-item-title {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.history-item .btn-delete-chat {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

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

.history-item .btn-delete-chat:hover {
    opacity: 1;
    color: #ff4444;
}

/* ===== DOCUMENTATION SCREEN ===== */
#docsScreen {
    flex-direction: row;
}

.docs-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.docs-sidebar {
    width: 240px;
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 15px;
    gap: 10px;
}

.docs-sidebar h2 {
    font-size: 18px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.docs-sidebar-spacer {
    flex: 1;
}

.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.docs-nav-item {
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.docs-nav-item:hover {
    background-color: var(--bg-lighter);
    color: var(--text-primary);
}

.docs-nav-item.active {
    background-color: var(--bg-lighter);
    color: var(--neon-cyan);
    border-left: 3px solid var(--neon-cyan);
}

.docs-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    background-color: var(--bg-dark);
}

.docs-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.docs-section:last-child {
    border-bottom: none;
}

.docs-section h1 {
    font-size: 24px;
    margin-bottom: 12px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.docs-section h2 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--neon-cyan);
}

.docs-section h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.docs-section h4 {
    font-size: 14px;
    margin: 16px 0 8px;
    color: var(--neon-magenta);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.docs-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
    font-size: 14px;
}

.docs-section code {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--neon-green);
}

.docs-section pre {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 10px 0;
}

.docs-section pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

.docs-endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.docs-method {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.docs-method.get {
    background-color: rgba(57, 255, 20, 0.15);
    color: var(--neon-green);
    border: 1px solid var(--neon-green);
}

.docs-method.post {
    background-color: rgba(0, 240, 255, 0.15);
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
}

.docs-endpoint code {
    font-size: 16px;
    font-weight: 600;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}

.docs-table th {
    background-color: var(--bg-darker);
    color: var(--neon-cyan);
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.docs-table td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.docs-table tr:hover td {
    background-color: rgba(0, 240, 255, 0.05);
}

.docs-info-box {
    background-color: var(--bg-lighter);
    border-left: 3px solid var(--neon-cyan);
    padding: 15px 18px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.docs-info-box strong {
    color: var(--neon-cyan);
}

.docs-example {
    background-color: var(--bg-lighter);
    border-left: 3px solid var(--neon-magenta);
    padding: 15px 18px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 13px;
}

.docs-example strong {
    color: var(--neon-magenta);
}
