/* ============================================
   Community AI - Chat Interface Styles
   Based on llama.cpp webui design
   ============================================ */

/* CSS Variables - Light Theme (Default) */
:root {
    --radius: 0.625rem;
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.145 0 0);
    --primary: oklch(0.205 0 0);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.95 0 0);
    --secondary-foreground: oklch(0.205 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.556 0 0);
    --accent: oklch(0.95 0 0);
    --accent-foreground: oklch(0.205 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --border: oklch(0.875 0 0);
    --input: oklch(0.92 0 0);
    --ring: oklch(0.708 0 0);
    --sidebar: oklch(0.987 0 0);
    --sidebar-foreground: oklch(0.145 0 0);
    --sidebar-accent: oklch(0.97 0 0);
    --sidebar-accent-foreground: oklch(0.205 0 0);
    --sidebar-border: oklch(0.922 0 0);
    --code-background: oklch(0.97 0 0);
    --code-foreground: oklch(0.145 0 0);
    
    /* Layout */
    --sidebar-width: 280px;
    --chat-form-area-height: 8rem;
    --max-message-height: max(24rem, min(80dvh, calc(100dvh - var(--chat-form-area-height) - 12rem)));
}

/* Dark Theme */
.dark {
    --background: oklch(0.16 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.205 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.29 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --border: oklch(1 0 0 / 30%);
    --input: oklch(1 0 0 / 30%);
    --ring: oklch(0.556 0 0);
    --sidebar: oklch(0.19 0 0);
    --sidebar-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-accent-foreground: oklch(0.985 0 0);
    --sidebar-border: oklch(1 0 0 / 10%);
    --code-background: oklch(0.225 0 0);
    --code-foreground: oklch(0.875 0 0);
}

@media (min-width: 640px) {
    :root {
        --chat-form-area-height: 24rem;
    }
}

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

html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

/* Scrollbar Styling */
* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s ease;
}

*:hover {
    scrollbar-color: rgba(128, 128, 128, 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.2s ease;
}

*:hover::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 1rem;
    padding-bottom: 0.5rem;
    background: linear-gradient(to bottom, var(--sidebar) 80%, transparent);
    backdrop-filter: blur(12px);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem 1rem;
}

.sidebar-group {
    margin-top: 1rem;
}

.sidebar-label {
    display: block;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--sidebar-foreground);
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.conversation-item:hover {
    background-color: var(--sidebar-accent);
}

.conversation-item.active {
    background-color: var(--sidebar-accent);
}

.conversation-title {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conversation-menu {
    opacity: 0;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--muted-foreground);
    border-radius: 0.25rem;
    transition: opacity 0.15s, background-color 0.15s;
}

.conversation-item:hover .conversation-menu {
    opacity: 1;
}

.conversation-menu:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

.conversation-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.rename-chat-btn,
.delete-chat-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--muted-foreground);
    border-radius: 0.25rem;
    transition: background-color 0.15s, color 0.15s;
}

.rename-chat-btn:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

.delete-chat-btn:hover {
    background-color: var(--destructive);
    color: white;
}

/* Sidebar Trigger */
.sidebar-trigger {
    position: absolute;
    left: var(--sidebar-width);
    top: 0;
    z-index: 900;
    width: 2rem;
    height: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.25rem;
    margin: 1rem;
    border-radius: var(--radius);
    transition: left 0.2s ease, background-color 0.15s, color 0.15s;
}

.sidebar-trigger:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

.sidebar.collapsed ~ .sidebar-trigger {
    left: 0;
}

/* Settings Trigger */
.settings-trigger {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 900;
    width: 2rem;
    height: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.25rem;
    margin: 1rem;
    border-radius: var(--radius);
    transition: background-color 0.15s, color 0.15s;
}

.settings-trigger:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 1rem;
    position: relative;
}

@media (min-width: 768px) {
    .chat-container {
        padding: 0 1.5rem;
    }
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem;
}

.empty-state h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--muted-foreground);
    font-size: 1.125rem;
}

/* ============================================
   Chat Messages
   ============================================ */

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding-top: 4rem;
    padding-bottom: 4rem;
    max-width: 48rem;
    margin: 0 auto;
    width: 100%;
}

.chat-messages:empty + .empty-state {
    display: block;
}

.chat-messages:not(:empty) + .empty-state {
    display: none;
}

.message {
    width: 100%;
}

.message-content {
    display: flex;
    flex-direction: column;
}

/* User Message */
.message-user .message-content {
    align-items: flex-end;
    gap: 0.5rem;
}

.message-bubble {
    max-width: 80%;
    padding: 0.5rem 1rem;
    border-radius: 1.125rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.message-bubble-user {
    background-color: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(12px);
}

.dark .message-bubble-user {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Assistant Message */
.message-assistant .message-content {
    gap: 0.75rem;
}

.message-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.5rem;
}

.model-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background-color: var(--secondary);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.75rem;
    font-weight: 500;
}

.model-badge::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0.5;
}

.message-stats {
    font-variant-numeric: tabular-nums;
}

/* Message Actions */
.message-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions-left {
    justify-content: flex-start;
}

.message-actions-right {
    justify-content: flex-end;
    max-width: 80%;
}

/* Loading dots animation */
.loading-dots {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ============================================
   Markdown Content
   ============================================ */

.markdown-content {
    font-size: 1rem;
    line-height: 1.75;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.25rem; }
.markdown-content h3 { font-size: 1.125rem; }

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content pre {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--code-background);
    border-radius: var(--radius);
    overflow-x: auto;
}

.markdown-content code {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
    font-size: 0.875rem;
}

.markdown-content :not(pre) > code {
    padding: 0.125rem 0.375rem;
    background-color: var(--code-background);
    border-radius: 0.25rem;
}

.markdown-content blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--border);
    background-color: var(--muted);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.markdown-content blockquote p {
    margin-bottom: 0;
}

.markdown-content strong {
    font-weight: 600;
}

.markdown-content em {
    font-style: italic;
}

/* ============================================
   Chat Form
   ============================================ */

.chat-form-container {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--background) 85%, transparent);
    padding-top: 2rem;
    padding-bottom: 1rem;
    margin-top: auto;
}

.chat-form {
    max-width: 48rem;
    margin: 0 auto;
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--card);
    border: 1px solid var(--input);
    border-radius: 1.5rem;
    backdrop-filter: blur(12px);
    transition: box-shadow 0.15s ease;
}

.chat-input-wrapper:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-input {
    width: 100%;
    min-height: 48px;
    max-height: 200px;
    padding: 0.875rem 1.25rem;
    padding-bottom: 0.5rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--foreground);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
}

.chat-input::placeholder {
    color: var(--muted-foreground);
}

.char-counter {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    padding: 0 1.25rem 0.5rem;
    text-align: right;
    transition: color 0.15s;
}

.chat-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
}

/* Model Selector */
.model-selector {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
}

.model-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--muted);
    border: none;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.model-selector-btn:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

.model-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: var(--muted-foreground);
}

.model-status-dot.online {
    background-color: #22c55e;
}

.model-status-dot.offline {
    background-color: #ef4444;
}

.model-dropdown {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    background-color: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 1000;
}

.model-selector.open .model-dropdown {
    opacity: 1;
    visibility: visible;
}

.model-option {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid var(--border);
}

.model-option:last-child {
    border-bottom: none;
}

.model-option:hover {
    background-color: var(--accent);
}

.model-option.selected {
    background-color: var(--accent);
}

.model-option-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-option-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.model-option-status {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-left: auto;
}

.model-option-status.online {
    background-color: #22c55e;
}

.model-option-status.offline {
    background-color: #ef4444;
}

.model-option-description {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.chat-helper-text {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.chat-helper-text kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background-color: var(--muted);
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 0.6875rem;
}

/* ============================================
   Buttons & Actions
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    border: none;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background-color: var(--accent);
}

.btn-full {
    width: 100%;
    justify-content: flex-start;
}

.btn-send {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-radius: 50%;
}

.btn-send:hover {
    opacity: 0.9;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--muted-foreground);
    transition: background-color 0.15s, color 0.15s;
}

.action-btn:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

/* ============================================
   Icons
   ============================================ */

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.icon-sm {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-trigger {
        left: 0;
    }
}

/* ============================================
   Modals
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    color: var(--foreground);
}

.modal-subtitle {
    color: var(--muted-foreground);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--muted-foreground);
    transition: all 0.15s;
}

.tab-btn:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

.tab-btn.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-error {
    color: var(--destructive);
    font-size: 0.875rem;
    margin: 0;
    min-height: 1.25rem;
}

.btn-hash {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: opacity 0.15s;
}

.btn-hash:hover {
    opacity: 0.9;
}

.hash-input-container {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hash-input-container.visible {
    display: flex;
}

.hash-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    font-size: 0.75rem;
    font-family: ui-monospace, monospace;
    word-break: break-all;
}

.hash-input:focus {
    outline: none;
    border-color: var(--primary);
}

.hash-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.btn-secondary {
    background-color: var(--muted);
    color: var(--foreground);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.15s;
}

.btn-secondary:hover {
    background-color: var(--accent);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: opacity 0.15s;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Settings */
.settings-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.settings-description {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin: 0 0 0.75rem 0;
}

.settings-section textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
}

.settings-section textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.settings-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.password-change-section {
    margin-top: 1rem;
}

.password-change-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.settings-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary);
}

.password-error {
    color: var(--destructive);
    font-size: 0.75rem;
    margin: 0;
}

.password-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--muted);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #22c55e;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Agent Status */
.agent-status {
    margin-bottom: 0.5rem;
}

.status-text-gradient {
    background: linear-gradient(
        90deg,
        var(--muted-foreground),
        var(--foreground),
        var(--muted-foreground)
    );
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shine 1.5s linear infinite;
    font-size: 0.875rem;
    font-weight: 500;
}

@keyframes gradient-shine {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* No conversations */
.no-conversations {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    padding: 1rem;
    text-align: center;
}

/* ============================================
   Disclaimer Modal
   ============================================ */

.disclaimer-modal {
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.disclaimer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.disclaimer-icon {
    width: 2rem;
    height: 2rem;
    color: #f59e0b;
    flex-shrink: 0;
}

.disclaimer-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.disclaimer-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.disclaimer-content h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.disclaimer-content h4 {
    font-size: 1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.disclaimer-content p {
    margin-bottom: 0.75rem;
}

.disclaimer-content ul {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.disclaimer-content li {
    margin-bottom: 0.25rem;
}

.disclaimer-warning {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    color: #ef4444;
}

.legal-note {
    background-color: var(--muted);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
}

.disclaimer-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.disclaimer-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.disclaimer-checkbox label {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.disclaimer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.disclaimer-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
