/* 
 * Claude Chat - Apple-Inspired Design System
 * Clean, minimal, obsessive attention to detail
 */

/* ============================================
   Design Tokens
   ============================================ */
:root {
    /* Colors - Inspired by macOS */
    --bg-primary: #000000;
    --bg-secondary: #0d0d0d;
    --bg-tertiary: #161616;
    --bg-elevated: #1c1c1e;
    --bg-hover: #2c2c2e;
    
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --surface-active: rgba(255, 255, 255, 0.12);
    
    --border: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.05);
    
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-tertiary: rgba(255, 255, 255, 0.35);
    
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-subtle: rgba(10, 132, 255, 0.15);
    
    --success: #30d158;
    --warning: #ffd60a;
    --error: #ff453a;
    
    /* User message - subtle blue */
    --user-bg: rgba(10, 132, 255, 0.12);
    --user-border: rgba(10, 132, 255, 0.2);
    
    /* Assistant message - subtle neutral */
    --assistant-bg: rgba(255, 255, 255, 0.04);
    --assistant-border: rgba(255, 255, 255, 0.08);
    
    /* Other user in group */
    --other-bg: rgba(175, 82, 222, 0.12);
    --other-border: rgba(175, 82, 222, 0.2);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    --font-mono: 'SF Mono', SFMono-Regular, Menlo, Monaco, monospace;
    
    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    
    --tracking-tight: -0.02em;
    --tracking-normal: -0.01em;
    
    /* Spacing - 4px base */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
    
    /* Layout */
    --sidebar-width: 240px;
    --header-height: 56px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    letter-spacing: var(--tracking-normal);
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
}

::selection {
    background: var(--accent);
    color: white;
}

/* ============================================
   App Layout
   ============================================ */
.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-mark {
    width: 28px;
    height: 28px;
    color: var(--text-primary);
}

.logo-text {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
}

/* Navigation */
.nav {
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-align: left;
    width: 100%;
}

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

.nav-item.active {
    background: var(--surface-active);
    color: var(--text-primary);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.config-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.config-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.config-input {
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    transition: all var(--duration-fast) var(--ease-out);
}

.config-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-hover);
}

.config-input::placeholder {
    color: var(--text-tertiary);
}

/* User Config */
.user-config {
    display: flex;
    gap: var(--space-2);
}

.user-input {
    flex: 1;
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
    transition: all var(--duration-fast) var(--ease-out);
}

.user-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-hover);
}

.user-input::placeholder {
    color: var(--text-tertiary);
}

.btn-signin {
    padding: var(--space-3);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-signin svg {
    width: 16px;
    height: 16px;
}

.btn-signin:hover {
    background: var(--accent-hover);
    transform: translateX(2px);
}

.user-status {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border-radius: var(--radius-sm);
    display: none;
}

.user-status.active {
    display: block;
    color: var(--success);
    background: rgba(48, 209, 88, 0.1);
}

/* ============================================
   Main Content
   ============================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

/* Views */
.view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.view.active {
    display: flex;
}

/* ============================================
   Header
   ============================================ */
.view-header {
    height: var(--header-height);
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: var(--bg-primary);
}

.header-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-title h1 {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

.room-badge {
    font-size: var(--text-xs);
    font-weight: 500;
    font-family: var(--font-mono);
    padding: var(--space-1) var(--space-2);
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: none;
}

.room-badge.active {
    display: inline-block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn-text {
    padding: var(--space-2) var(--space-4);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

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

.btn-text.secondary {
    background: var(--surface);
    color: var(--text-primary);
}

.btn-text.secondary:hover {
    background: var(--surface-hover);
}

.room-input {
    width: 80px;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
}

.room-input:focus {
    outline: none;
    border-color: var(--accent);
}

.room-input::placeholder {
    color: var(--text-tertiary);
    text-transform: none;
    letter-spacing: normal;
}

.filter-select {
    padding: var(--space-2) var(--space-3);
    padding-right: var(--space-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Participants Bar */
.participants-bar {
    padding: var(--space-2) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: none;
}

.participants-bar.active {
    display: block;
}

#participantsList {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.participant {
    font-size: var(--text-xs);
    font-weight: 500;
    padding: var(--space-1) var(--space-3);
    background: var(--surface);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

/* ============================================
   Messages Area
   ============================================ */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: var(--radius-full);
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-8);
    margin: auto;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-6);
}

.empty-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    max-width: 280px;
    line-height: var(--leading-relaxed);
}

/* Message Bubbles */
.message {
    max-width: 720px;
    animation: messageIn var(--duration-normal) var(--ease-out);
}

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

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message.other-user {
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
    padding: 0 var(--space-2);
}

.message-sender {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-tertiary);
}

.message-time {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    opacity: 0.7;
}

.message-body {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
}

.message.user .message-body {
    background: var(--user-bg);
    border: 1px solid var(--user-border);
    border-bottom-right-radius: var(--radius-sm);
}

.message.assistant .message-body {
    background: var(--assistant-bg);
    border: 1px solid var(--assistant-border);
    border-bottom-left-radius: var(--radius-sm);
}

.message.other-user .message-body {
    background: var(--other-bg);
    border: 1px solid var(--other-border);
    border-bottom-left-radius: var(--radius-sm);
}

/* Code in messages */
.message-body pre {
    background: var(--bg-primary);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-3) 0;
    border: 1px solid var(--border);
}

.message-body code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.message-body pre code {
    background: none;
    padding: 0;
}

.message-body :not(pre) > code {
    background: var(--surface);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

/* Loading State */
.message.loading .message-body::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--text-secondary);
    border-radius: 2px;
    margin-left: var(--space-1);
    animation: blink 1s ease-in-out infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Typing Indicator for Group Chat */
.thinking-indicator .message-body {
    padding: var(--space-3) var(--space-5);
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
    margin-top: var(--space-2);
    padding: 0 var(--space-2);
}

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

.msg-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.msg-action svg {
    width: 14px;
    height: 14px;
}

.msg-action:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}

.msg-action.highlight:hover {
    background: rgba(255, 214, 10, 0.15);
    border-color: var(--warning);
    color: var(--warning);
}

.msg-action.tag:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.msg-action.remove:hover {
    background: rgba(255, 69, 58, 0.15);
    border-color: var(--error);
    color: var(--error);
}

/* Highlighted Message */
.message.highlighted .message-body {
    border-color: var(--warning);
    background: rgba(255, 214, 10, 0.08);
}

.message.highlighted .msg-action.highlight {
    background: rgba(255, 214, 10, 0.2);
    border-color: var(--warning);
    color: var(--warning);
}

/* Message Tags */
.message-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-2);
    padding: 0 var(--space-2);
}

.msg-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--accent-subtle);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--accent);
}

.msg-tag .remove-tag {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--duration-fast);
}

.msg-tag .remove-tag:hover {
    opacity: 1;
}

.msg-tag .remove-tag svg {
    width: 10px;
    height: 10px;
}

/* Off Record (Removed) Message */
.message.off-record {
    opacity: 0.4;
}

.message.off-record .message-body {
    text-decoration: line-through;
    border-style: dashed;
}

.message.off-record::after {
    content: 'Off record';
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
    padding: 0 var(--space-2);
}

/* Saved Messages Container */
.saved-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.saved-container::-webkit-scrollbar {
    width: 8px;
}

.saved-container::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: var(--radius-full);
}

.saved-message {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    animation: messageIn var(--duration-normal) var(--ease-out);
}

.saved-message.highlighted {
    border-color: var(--warning);
    background: rgba(255, 214, 10, 0.05);
}

.saved-message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
}

.saved-message-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.saved-message-sender {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.saved-message-time {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.saved-message-content {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
}

.saved-message-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-3);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    animation: modalIn var(--duration-normal) var(--ease-out);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
}

.existing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    min-height: 32px;
}

.existing-tags:empty::before {
    content: 'No tags yet';
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.tag-option {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.tag-option:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.tag-option.selected {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.new-tag-input {
    display: flex;
    gap: var(--space-2);
}

.new-tag-input input {
    flex: 1;
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-sm);
}

.new-tag-input input:focus {
    outline: none;
    border-color: var(--accent);
}

.new-tag-input input::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   Composer
   ============================================ */
.composer {
    padding: var(--space-4) var(--space-6) var(--space-6);
    background: var(--bg-primary);
}

.composer-inner {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    transition: border-color var(--duration-fast) var(--ease-out);
}

.composer-inner:focus-within {
    border-color: var(--accent);
}

.composer textarea {
    flex: 1;
    padding: var(--space-2) var(--space-2);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    resize: none;
    max-height: 160px;
}

.composer textarea:focus {
    outline: none;
}

.composer textarea::placeholder {
    color: var(--text-tertiary);
}

.btn-send {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}

.btn-send svg {
    width: 16px;
    height: 16px;
}

.btn-send:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.btn-send:active {
    transform: scale(0.95);
}

/* ============================================
   History Layout
   ============================================ */
.history-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.history-list {
    width: 280px;
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    background: var(--bg-secondary);
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: var(--radius-full);
}

.history-empty {
    padding: var(--space-6);
    text-align: center;
}

.history-empty p {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.history-item {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}

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

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

.history-item h3 {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item p {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item .meta {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.history-detail {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.filter-badge {
    padding: var(--space-2) var(--space-4);
    background: var(--accent-subtle);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--accent);
    align-self: flex-start;
    margin-bottom: var(--space-2);
}

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed;
    bottom: var(--space-8);
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + var(--space-8)));
    padding: var(--space-3) var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-out);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: var(--success);
    background: rgba(48, 209, 88, 0.15);
}

.toast.error {
    border-color: var(--error);
    background: rgba(255, 69, 58, 0.15);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 72px;
    }
    
    .logo-text,
    .nav-item span,
    .config-section,
    .user-input {
        display: none;
    }
    
    .sidebar-header {
        padding: var(--space-4);
        display: flex;
        justify-content: center;
    }
    
    .nav {
        padding: var(--space-2);
    }
    
    .nav-item {
        justify-content: center;
        padding: var(--space-3);
    }
    
    .sidebar-footer {
        padding: var(--space-3);
    }
    
    .user-config {
        justify-content: center;
    }
    
    .btn-signin {
        width: 40px;
        height: 40px;
    }
    
    .view-header {
        padding: 0 var(--space-4);
    }
    
    .messages {
        padding: var(--space-4);
    }
    
    .composer {
        padding: var(--space-3) var(--space-4) var(--space-4);
    }
    
    .history-layout {
        flex-direction: column;
    }
    
    .history-list {
        width: 100%;
        height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
}
