/* ==============================
   NeuralChat — CSS Styles
   ============================== */

/* --- CSS Variables / Theming --- */
:root {
    /* Dark theme (default) */
    --bg-primary: #0d0d0d;
    --bg-secondary: #171717;
    --bg-tertiary: #212121;
    --bg-hover: #2a2a2a;
    --bg-active: #333333;
    --bg-message-ai: #1e1e1e;
    --bg-message-user: #2b5278;
    --bg-input: #1e1e1e;
    --bg-modal: #1a1a1a;
    --bg-code: #0d0d0d;

    --text-primary: #ececec;
    --text-secondary: #a0a0a0;
    --text-tertiary: #6b6b6b;
    --text-link: #7ab7ff;

    --border-color: #2e2e2e;
    --border-light: #383838;

    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --accent-light: rgba(108, 99, 255, 0.15);

    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --sidebar-width: 280px;
    --topbar-height: 56px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-tertiary: #efefef;
    --bg-hover: #e8e8e8;
    --bg-active: #dedede;
    --bg-message-ai: #f7f7f8;
    --bg-message-user: #e3f2fd;
    --bg-input: #ffffff;
    --bg-modal: #ffffff;
    --bg-code: #f4f4f5;

    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-tertiary: #999999;
    --text-link: #4a6cf7;

    --border-color: #e0e0e0;
    --border-light: #ebebeb;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-link);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

/* --- Layout --- */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    z-index: 100;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    position: absolute;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition-fast);
}
.new-chat-btn:hover {
    background: var(--accent-hover);
}

.sidebar-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.sidebar-conversations::-webkit-scrollbar {
    width: 4px;
}
.sidebar-conversations::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
}
.conv-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.conv-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
}
.conv-item .conv-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conv-item .conv-delete {
    opacity: 0;
    color: var(--text-tertiary);
    padding: 4px;
    border-radius: 4px;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}
.conv-item:hover .conv-delete {
    opacity: 1;
}
.conv-item .conv-delete:hover {
    color: var(--danger);
}

.conv-date-group {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.model-selector label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}
.model-selector select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
}
.model-selector select:hover,
.model-selector select:focus {
    border-color: var(--accent);
}

.settings-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.settings-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========== MAIN ========== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.toggle-sidebar-btn {
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.toggle-sidebar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-title-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* --- Chat Container --- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}
.chat-container::-webkit-scrollbar {
    width: 6px;
}
.chat-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

/* --- Welcome Screen --- */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    gap: 48px;
    animation: fadeIn 0.6s ease;
}

.welcome-logo {
    text-align: center;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    margin-bottom: 24px;
    animation: pulse 3s infinite ease-in-out;
}

.welcome-logo h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}
.welcome-logo p {
    font-size: 15px;
    color: var(--text-secondary);
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 640px;
    width: 100%;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    color: var(--text-secondary);
    text-align: left;
    transition: all var(--transition-fast);
}
.suggestion-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.suggestion-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* --- Messages --- */
.messages {
    max-width: 768px;
    margin: 0 auto;
    padding: 24px 16px 120px;
}

.message {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    animation: slideUp 0.3s ease;
}

.message + .message {
    border-top: 1px solid var(--border-color);
}

.message-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

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

.message.assistant .message-avatar {
    background: var(--accent-light);
    color: var(--accent);
}

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

.message-role {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.message-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text p {
    margin-bottom: 12px;
}
.message-text p:last-child {
    margin-bottom: 0;
}

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

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

.message-text ul, .message-text ol {
    margin: 8px 0 12px 20px;
}
.message-text li {
    margin-bottom: 4px;
}

.message-text h1, .message-text h2, .message-text h3,
.message-text h4, .message-text h5, .message-text h6 {
    margin: 16px 0 8px;
    font-weight: 600;
}
.message-text h1 { font-size: 22px; }
.message-text h2 { font-size: 19px; }
.message-text h3 { font-size: 17px; }

.message-text blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 12px 0;
    background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

/* Code blocks */
.message-text pre {
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin: 12px 0;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-tertiary);
}

.copy-code-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}
.copy-code-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.message-text pre code {
    display: block;
    padding: 16px;
    overflow-x: auto;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
}
.message-text code {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.message-text pre code {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}
.message-text th, .message-text td {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    text-align: left;
}
.message-text th {
    background: var(--bg-tertiary);
    font-weight: 600;
}
.message-text tr:nth-child(even) {
    background: var(--bg-secondary);
}

.message-text hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

/* Message actions */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.message:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-tertiary);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
}
.msg-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Inline edit */
.inline-edit-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.inline-edit-textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    resize: vertical;
}
.inline-edit-textarea:focus {
    border-color: var(--accent);
}
.inline-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* --- Input Area --- */
.input-area {
    padding: 16px 24px 20px;
    background: var(--bg-primary);
    position: relative;
}

.input-wrapper {
    max-width: 768px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
    padding: 6px 4px;
}
.input-wrapper textarea::placeholder {
    color: var(--text-tertiary);
}

.voice-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}
.voice-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.voice-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    animation: pulse 1s infinite alternate;
}

.send-btn, .stop-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.send-btn {
    background: var(--accent);
    color: white;
}
.send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}
.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stop-btn {
    background: var(--danger);
    color: white;
}
.stop-btn:hover {
    opacity: 0.9;
}

.input-disclaimer {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    font-size: 24px;
    color: var(--text-tertiary);
    padding: 4px;
    transition: color var(--transition-fast);
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.setting-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.setting-desc {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.api-key-input-wrapper {
    display: flex;
    gap: 8px;
}
.api-key-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast);
}
.api-key-input-wrapper input:focus {
    border-color: var(--accent);
}

.setting-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}
.setting-select:focus {
    border-color: var(--accent);
}

.setting-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast);
}
.setting-input:focus {
    border-color: var(--accent);
}
.toggle-visibility {
    padding: 10px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}
.toggle-visibility:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.setting-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast);
}
.setting-group textarea:focus {
    border-color: var(--accent);
}

.theme-toggle {
    display: flex;
    gap: 8px;
}
.theme-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}
.theme-btn:hover {
    background: var(--bg-hover);
}
.theme-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    padding: 10px 24px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition-fast);
}
.btn-primary:hover {
    background: var(--accent-hover);
}

/* --- Toast notifications --- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    z-index: 2000;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Slider --- */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-wrapper input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}
.slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: transform var(--transition-fast);
}
.slider-wrapper input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.slider-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    min-width: 30px;
    text-align: center;
}

/* --- Data actions --- */
.data-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.btn-secondary {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.import-label {
    display: inline-flex;
    align-items: center;
}
.btn-danger {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--danger);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* --- Search bar in sidebar --- */
.sidebar-search {
    padding: 8px 12px;
}
.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 8px center;
}
.sidebar-search input:focus {
    border-color: var(--accent);
}
.sidebar-search input::placeholder {
    color: var(--text-tertiary);
}

/* --- Keyboard shortcut hints --- */
.shortcut-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-family: monospace;
    margin-left: auto;
}

/* --- Word count --- */
.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 768px;
    margin: 0 auto;
}
.char-count {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: right;
    min-width: 60px;
}

/* --- Regenerate button --- */
.regenerate-wrapper {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}
.regenerate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all var(--transition-fast);
}
.regenerate-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* --- Confirmation dialog --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}
.confirm-box {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}
.confirm-box h4 {
    margin-bottom: 8px;
    font-size: 16px;
}
.confirm-box p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}
.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.btn-cancel {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: all var(--transition-fast);
}
.btn-cancel:hover {
    background: var(--bg-hover);
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

/* Streaming cursor */
.streaming-cursor::after {
    content: '▋';
    animation: blink 1s step-end infinite;
    color: var(--accent);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
        box-shadow: var(--shadow-lg);
        z-index: 200;
    }
    .sidebar.open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

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

    .welcome-suggestions {
        grid-template-columns: 1fr;
    }

    .welcome-logo h2 {
        font-size: 22px;
    }

    .messages {
        padding: 16px 12px 120px;
    }

    .input-area {
        padding: 12px 12px 16px;
    }
}
