/* ============================================
   ADHX — Adaptive Digital Thought Hub
   Premium Dark Glassmorphism Theme
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    --bg-primary: #06060b;
    --bg-secondary: #0c0c14;
    --bg-surface: rgba(16, 16, 28, 0.65);
    --bg-surface-hover: rgba(22, 22, 38, 0.75);
    --bg-glass: rgba(18, 18, 32, 0.55);
    --bg-glass-strong: rgba(20, 20, 36, 0.85);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);

    --text-primary: #f0f0f8;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a80;
    --text-accent: #b8c0ff;

    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-cyan: #22d3ee;

    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-warm: linear-gradient(135deg, #f97316, #ec4899);
    --gradient-cool: linear-gradient(135deg, #22d3ee, #3b82f6);

    --priority-critical: #ef4444;
    --priority-high: #f97316;
    --priority-medium: #eab308;
    --priority-low: #22c55e;

    --progress-seed: #3b82f6;
    --progress-growing: #8b5cf6;
    --progress-blooming: #ec4899;
    --progress-archived: #6b7280;

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

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);

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

    --nav-height: 64px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Themes ---------- */

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-hover: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-strong: rgba(255, 255, 255, 0.95);

    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-medium: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.15);

    --text-primary: #1a1a2e;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-accent: #3b82f6;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.1);
}

/* Serenity Theme (Blue) */
[data-theme="serenity"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #e1e8f0;
    --bg-surface: rgba(225, 232, 240, 0.8);
    --bg-surface-hover: rgba(225, 232, 240, 0.9);
    --bg-glass: rgba(225, 232, 240, 0.6);
    --bg-glass-strong: rgba(225, 232, 240, 0.95);

    --border-subtle: rgba(59, 130, 246, 0.1);
    --border-medium: rgba(59, 130, 246, 0.2);
    --border-strong: rgba(59, 130, 246, 0.3);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-accent: #2563eb;

    --accent-blue: #2563eb;
    --gradient-primary: linear-gradient(135deg, #3b82f6, #60a5fa);
}

/* Sunset Theme (Warm) */
[data-theme="sunset"] {
    --bg-primary: #fffaf5;
    --bg-secondary: #fff5eb;
    --bg-surface: rgba(255, 245, 235, 0.8);
    --bg-surface-hover: rgba(255, 245, 235, 0.9);
    --bg-glass: rgba(255, 245, 235, 0.6);
    --bg-glass-strong: rgba(255, 245, 235, 0.95);

    --border-subtle: rgba(249, 115, 22, 0.1);
    --border-medium: rgba(249, 115, 22, 0.2);
    --border-strong: rgba(249, 115, 22, 0.3);

    --text-primary: #431407;
    --text-secondary: #7c2d12;
    --text-muted: #9a3412;
    --text-accent: #ea580c;

    --accent-blue: #f97316;
    --gradient-primary: linear-gradient(135deg, #f97316, #ec4899);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

::selection {
    background: rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---------- Animated Mesh Background ---------- */
#mesh-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.6;
    will-change: transform;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
    top: -15%;
    left: -10%;
    animation: blobFloat1 25s ease-in-out infinite;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18), transparent 70%);
    bottom: -15%;
    right: -10%;
    animation: blobFloat2 30s ease-in-out infinite;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.12), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: blobFloat3 20s ease-in-out infinite;
}

@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, 50px) scale(1.1); }
    66% { transform: translate(-40px, 80px) scale(0.95); }
}

@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, -40px) scale(1.05); }
    66% { transform: translate(50px, -70px) scale(0.9); }
}

@keyframes blobFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-40%, -60%) scale(1.15); }
}

/* ---------- Navigation ---------- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 100;
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    background: rgba(6, 6, 11, 0.7);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    cursor: pointer;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-purple);
    animation: pulse 2s ease-in-out infinite;
}

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

.nav-links {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thought-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-glass);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

/* ---------- Views System ---------- */
.view {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding-top: var(--nav-height);
    display: none;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.view.active {
    display: block;
    opacity: 1;
}

/* ---------- HOME VIEW ---------- */
.home-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - var(--nav-height));
    justify-content: center;
}

.home-hero {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeUp 0.8s ease-out;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero-line-1 {
    display: block;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 28px;
    letter-spacing: -0.5px;
}

.hero-line-2 {
    display: block;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-cursor {
    -webkit-text-fill-color: var(--accent-purple);
    animation: blink 1s step-end infinite;
}

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

.hero-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
}

/* ---------- Main Input ---------- */
/* ---------- TEMPLATE SELECTOR ---------- */
.template-selector {
    margin-bottom: 12px;
    padding: 0 4px;
    animation: fadeUp 0.8s ease-out 0.1s both;
}

.template-selector label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.template-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.template-chips::-webkit-scrollbar {
    display: none;
}

.template-chip {
    white-space: nowrap;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.template-chip:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.input-container {
    width: 100%;
    position: relative;
    animation: fadeUp 0.8s ease-out 0.2s both;
}

.input-glow {
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-xl) + 2px);
    background: var(--gradient-primary);
    opacity: 0;
    filter: blur(12px);
    transition: opacity var(--transition);
    pointer-events: none;
}

.input-container:focus-within .input-glow {
    opacity: 0.3;
}

.main-input {
    width: 100%;
    padding: 24px 140px 24px 24px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: var(--transition);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    box-sizing: border-box;
}

.main-input::placeholder {
    color: var(--text-muted);
}

.main-input:focus {
    border-color: rgba(139, 92, 246, 0.4);
    background: var(--bg-glass-strong);
}

.input-actions {
    position: absolute;
    right: 12px;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 5;
}

.voice-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.voice-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.voice-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    animation: pulse-recording 1s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.input-submit-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0.5;
    transform: scale(0.9);
}

.input-submit-btn:not(:disabled) {
    opacity: 1;
    transform: scale(1);
}

.input-submit-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.input-submit-btn:disabled {
    cursor: not-allowed;
}

/* ---------- Recent Thoughts ---------- */
.recent-section {
    width: 100%;
    margin-top: 48px;
    animation: fadeUp 0.8s ease-out 0.4s both;
}

.recent-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.recent-thoughts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.recent-card {
    padding: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.recent-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.recent-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-card-summary {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.recent-card-category {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-card-priority {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---------- Draft Cards ---------- */
.drafts-section {
    width: 100%;
    margin-top: 32px;
    animation: fadeUp 0.8s ease-out 0.3s both;
}

.drafts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.draft-card {
    padding: 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.draft-card:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.draft-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.draft-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.draft-preview {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.draft-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.draft-msg-count {
    font-size: 11px;
    color: var(--text-muted);
}

.draft-delete {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition-fast);
}

.draft-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.empty-home,
.empty-browse {
    text-align: center;
    padding: 60px 20px;
    animation: fadeUp 0.8s ease-out 0.4s both;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-subtext {
    font-size: 14px;
    color: var(--text-muted);
}

.empty-cta {
    margin-top: 20px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.empty-cta:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* ---------- BRAINSTORM VIEW ---------- */
.brainstorm-container {
    max-width: 800px;
    margin: 0 auto;
    height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
}

.brainstorm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(6, 6, 11, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.brainstorm-persona-quick {
    flex: 0 1 auto;
    margin: 0 12px;
}

.quick-persona-select {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
    max-width: 160px;
    font-family: var(--font-sans);
}

.quick-persona-select:hover {
    border-color: var(--text-accent);
    background: var(--bg-glass-strong);
}

.quick-persona-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.back-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
    background: var(--bg-glass);
}

.brainstorm-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 16px;
}

.crystallize-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.crystallize-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.3);
}

.crystallize-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---------- Messages ---------- */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

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

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

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
    width: fit-content;
    backdrop-filter: blur(10px);
}

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

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

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

/* ---------- Brainstorm Input ---------- */
.brainstorm-input-area {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(6, 6, 11, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.brainstorm-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 6px 6px 6px 16px;
    transition: var(--transition);
}

.brainstorm-input-wrap:focus-within {
    border-color: rgba(139, 92, 246, 0.4);
}

.brainstorm-input {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 150px;
    overflow-y: auto;
}

.brainstorm-input::placeholder {
    color: var(--text-muted);
}

/* Brainstorm Input Area - Fixed Layout */
.brainstorm-input-area {
    padding: 16px;
    background: rgba(6, 6, 11, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
}

.brainstorm-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: var(--transition);
}

.brainstorm-input-wrap:focus-within {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.brainstorm-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 120px;
}

.brainstorm-input::placeholder {
    color: var(--text-muted);
}

.brainstorm-send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0.5;
}

.brainstorm-voice-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.brainstorm-voice-btn:hover {
    color: var(--accent-pink);
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.3);
}

.brainstorm-voice-btn.recording {
    color: var(--priority-critical);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.brainstorm-send-btn:not(:disabled) {
    opacity: 1;
}

.brainstorm-send-btn:not(:disabled):hover {
    transform: scale(1.08);
}

.brainstorm-send-btn:disabled {
    cursor: not-allowed;
}

/* ---------- BROWSE VIEW ---------- */
.browse-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - var(--nav-height));
}

.browse-header {
    margin-bottom: 24px;
}

.browse-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.browse-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.search-input:focus {
    border-color: rgba(139, 92, 246, 0.4);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-select {
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236a6a80' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.filter-select:focus {
    border-color: rgba(139, 92, 246, 0.4);
}

.filter-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ---------- Kanban Board ---------- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    min-height: 500px;
}

.kanban-column {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 300px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.kanban-column.drag-over {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.05);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.1);
}

.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.column-icon {
    font-size: 16px;
}

.column-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.column-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.column-cards {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    min-height: 60px;
}

/* ---------- Thought Card ---------- */
.thought-card {
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: var(--transition);
    user-select: none;
}

.thought-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.thought-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg) scale(1.02);
}

.thought-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.thought-card-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.thought-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}

.thought-card-summary {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

.thought-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.thought-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.thought-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.thought-card-connections {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(var(--accent-primary-rgb), 0.1);
    color: var(--accent-primary);
    white-space: nowrap;
}

.thought-card-connections svg {
    opacity: 0.8;
}

.thought-card-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Category colors */
.cat-work { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.cat-personal { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.cat-creative { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.cat-learning { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.cat-finance { background: rgba(234, 179, 8, 0.15); color: #fbbf24; }
.cat-health { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.cat-relationships { background: rgba(244, 114, 182, 0.15); color: #f472b6; }
.cat-technology { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.cat-philosophy { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.cat-goals { background: rgba(249, 115, 22, 0.15); color: #fb923c; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity var(--transition);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    overflow-y: auto;
    position: relative;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1;
}

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

.modal-body {
    padding: 32px;
}

.modal-thought-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    padding-right: 40px;
}

.modal-thought-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.modal-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-date {
    font-size: 12px;
    color: var(--text-muted);
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.modal-section-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.modal-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.modal-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* Brainstorm history in modal */
.modal-history {
    margin-top: 10px;
}

.modal-history-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    background: none;
    border: none;
    color: var(--text-accent);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.modal-history-toggle:hover {
    color: var(--accent-purple);
}

.modal-history-toggle svg {
    transition: transform var(--transition);
}

.modal-history-toggle.open svg {
    transform: rotate(90deg);
}

.modal-history-messages {
    display: none;
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    max-height: 300px;
    overflow-y: auto;
}

.modal-history-messages.open {
    display: block;
}

.modal-history-msg {
    font-size: 13px;
    line-height: 1.6;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-history-msg:last-child {
    border-bottom: none;
}

.modal-history-msg-role {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.modal-history-msg-role.user {
    color: var(--accent-blue);
}

.modal-history-msg-role.assistant {
    color: var(--accent-purple);
}

.modal-history-msg-content {
    color: var(--text-secondary);
}

/* Modal actions */
.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.modal-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-progress-wrap label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
}

.modal-action-btn.primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.modal-action-btn.danger {
    color: var(--text-tertiary);
}

.modal-action-btn.danger:hover {
    color: var(--priority-critical);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Modal progress selector */
.modal-progress-select {
    padding: 8px 32px 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236a6a80' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--transition-fast);
}

.modal-progress-select:hover {
    border-color: var(--border-medium);
    background-color: var(--bg-surface-hover);
}

.modal-progress-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

.modal-progress-select option {
    background: #1a1a2e;
    color: var(--text-primary);
    padding: 10px;
}

/* Modal Related Thoughts */
.modal-related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.modal-related-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-related-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
    background: rgba(var(--accent-primary-rgb), 0.05);
}

.modal-related-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.modal-related-text {
    flex: 1;
    min-width: 0;
}

.modal-related-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.modal-related-summary {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-no-related {
    padding: 12px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    font-style: italic;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-subtle);
}

.modal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.modal-section-action {
    background: none;
    border: none;
    padding: 4px;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-section-action:hover {
    background: var(--bg-surface);
    color: var(--accent-primary);
}

/* ---------- Crystallize Overlay ---------- */
.crystallize-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.crystallize-overlay.active {
    display: flex;
    opacity: 1;
}

.crystallize-content {
    text-align: center;
    animation: fadeUp 0.5s ease-out;
}

.crystallize-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-purple);
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.crystallize-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.crystallize-subtext {
    font-size: 14px;
    color: var(--text-muted);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    z-index: 400;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }

    .hero-line-1 {
        font-size: 18px;
    }

    .main-input {
        padding: 20px 20px 20px 20px;
        min-height: 70px;
    }

    .nav-link span {
        display: none;
    }

    .nav-link {
        padding: 8px 12px;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .browse-filters {
        flex-direction: column;
    }

    .search-wrap {
        min-width: unset;
    }

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

    .messages-container {
        padding: 16px;
    }

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

    .modal-card {
        max-height: 90vh;
    }

    .modal-body {
        padding: 24px;
    }

    .thought-count {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }

    .hero-line-1 {
        font-size: 16px;
    }

    .main-input {
        font-size: 18px;
        padding: 20px;
        min-height: 120px;
        border-radius: var(--radius-lg);
    }

    .input-container {
        padding: 0 8px;
    }

    .input-actions {
        position: absolute;
        top: 10px;
        right: 16px;
        left: 16px;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        z-index: 5;
    }

    .voice-btn {
        width: 36px;
        height: 36px;
    }

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

    .input-submit-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

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

    .recent-thoughts {
        grid-template-columns: 1fr;
    }

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

    .brainstorm-input {
        padding: 12px 44px 12px 12px;
        min-height: 50px;
        font-size: 15px;
    }

    .brainstorm-input-actions {
        bottom: 16px;
        right: 12px;
    }
}

/* ---------- Nav Settings Button ---------- */
.nav-settings-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.nav-settings-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
    background: var(--bg-glass);
}

.nav-settings-btn:hover svg {
    animation: settingsSpin 2s linear infinite;
}

@keyframes settingsSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------- AI Settings Panel ---------- */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity var(--transition);
}

.settings-overlay.active {
    display: flex;
    opacity: 1;
}

.settings-panel {
    width: 100%;
    max-width: 520px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    overflow: hidden;
    animation: modalSlide 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-title svg {
    color: var(--accent-purple);
}

.settings-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.settings-close:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
    background: var(--bg-surface-hover);
}

.settings-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-group {
    margin-bottom: 20px;
}

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

.settings-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.settings-input:focus {
    border-color: rgba(139, 92, 246, 0.4);
    background: var(--bg-surface-hover);
}

.settings-input::placeholder {
    color: var(--text-muted);
}

.settings-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236a6a80' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.settings-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.settings-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.settings-key-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.settings-key-wrap .settings-input {
    padding-right: 44px;
}

.settings-toggle-key {
    position: absolute;
    right: 4px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.settings-toggle-key:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

/* Zen Models Selector Styles */
.zen-models-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.zen-models-container .settings-select {
    flex: 1;
}

.zen-refresh-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-medium);
    background: var(--bg-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.zen-refresh-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

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

.zen-refresh-btn.spinning svg {
    animation: spin 1s linear infinite;
}

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

.zen-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    gap: 12px;
}

.settings-footer-right {
    display: flex;
    gap: 8px;
}

.settings-footer-left {
    display: flex;
    gap: 8px;
}

.settings-btn {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.settings-btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.settings-btn-primary:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-glow);
}

.settings-btn-secondary {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.settings-btn-secondary:hover {
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.settings-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.settings-btn-ghost:hover {
    color: var(--priority-critical);
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}

@media (max-width: 768px) {
    .settings-panel {
        max-width: 100%;
    }

    .settings-footer {
        flex-direction: column;
    }

    .settings-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ---------- Attachment Styles ---------- */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
    animation: chipSlideIn 0.2s ease-out;
}

@keyframes chipSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.attachment-chip:hover {
    border-color: var(--accent-purple);
    background: var(--bg-surface-hover);
}

.chip-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.chip-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chip-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-primary);
}

.chip-size {
    font-size: 10px;
    color: var(--text-muted);
}

.chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    margin-left: 4px;
}

.chip-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

[dir='rtl'] .chip-remove {
    margin-left: 0;
    margin-right: 4px;
}

/* RTL Support */
[dir='rtl'] .nav-links {
    flex-direction: row-reverse;
}

[dir='rtl'] .hero-content {
    text-align: right;
}

[dir='rtl'] .main-input-wrap {
    padding: 8px 16px 8px 8px;
}

[dir='rtl'] .input-actions {
    margin-left: 0;
    margin-right: auto;
}

[dir='rtl'] .search-icon {
    left: auto;
    right: 14px;
}

[dir='rtl'] .search-input {
    padding: 10px 40px 10px 16px;
}

[dir='rtl'] .kanban-column-header {
    flex-direction: row-reverse;
}

[dir='rtl'] .modal-content {
    text-align: right;
}

[dir='rtl'] .modal-close {
    right: auto;
    left: 20px;
}

[dir='rtl'] .settings-panel {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}

[dir='rtl'] .settings-panel.active {
    transform: translateX(0);
}

[dir='rtl'] .settings-header {
    flex-direction: row-reverse;
}

[dir='rtl'] .settings-label {
    text-align: right;
}


/* ---------- RTL Support ---------- */
[dir='rtl'] body {
    font-family: 'Inter', sans-serif;
}

[dir='rtl'] .main-input {
    padding: 20px 24px 20px 60px;
}

[dir='rtl'] .input-actions {
    right: auto;
    left: 12px;
}

[dir='rtl'] .message.user .message-bubble {
    border-bottom-right-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
}

[dir='rtl'] .message.assistant .message-bubble {
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: 4px;
}

[dir='rtl'] .message.user .message-time {
    text-align: left;
}

[dir='rtl'] .brainstorm-input-wrap {
    padding: 6px 16px 6px 6px;
}

[dir='rtl'] .search-icon {
    left: auto;
    right: 14px;
}

[dir='rtl'] .search-input {
    padding: 10px 40px 10px 16px;
}

[dir='rtl'] .filter-select,
[dir='rtl'] .settings-select,
[dir='rtl'] .modal-progress-select {
    background-position: left 14px center;
    padding-right: 16px;
    padding-left: 36px;
}

[dir='rtl'] .modal-thought-title {
    padding-right: 0;
    padding-left: 40px;
}

[dir='rtl'] .modal-close,
[dir='rtl'] .settings-close {
    right: auto;
    left: 16px;
}

[dir='rtl'] .settings-toggle-key {
    right: auto;
    left: 4px;
}

[dir='rtl'] .settings-key-wrap .settings-input {
    padding-right: 14px;
    padding-left: 44px;
}

[dir='rtl'] .back-btn svg {
    transform: rotate(180deg);
}

[dir='rtl'] .nav-logo {
    flex-direction: row-reverse;
}


/* ---------- RTL Support (Additional) ---------- */
[dir='rtl'] .nav-inner { flex-direction: row-reverse; }
[dir='rtl'] .nav-links { flex-direction: row-reverse; }
[dir='rtl'] .nav-actions { flex-direction: row-reverse; }
[dir='rtl'] .hero-title { text-align: center; }
[dir='rtl'] .input-submit-btn { transform: scaleX(-1); }
[dir='rtl'] .input-submit-btn:not(:disabled):hover { transform: scaleX(-1) scale(1.05); }
[dir='rtl'] .brainstorm-header { flex-direction: row-reverse; }
[dir='rtl'] .back-btn { flex-direction: row-reverse; }
[dir='rtl'] .back-btn svg { transform: scaleX(-1); }
[dir='rtl'] .brainstorm-send-btn svg { transform: scaleX(-1); }
[dir='rtl'] .kanban-column { text-align: right; }
[dir='rtl'] .column-header { flex-direction: row-reverse; }
[dir='rtl'] .thought-card-header { flex-direction: row-reverse; }
[dir='rtl'] .thought-card-footer { flex-direction: row-reverse; }
[dir='rtl'] .modal-close { left: 16px; right: auto; }
[dir='rtl'] .modal-thought-meta { flex-direction: row-reverse; }
[dir='rtl'] .modal-section-title { text-align: right; }
[dir='rtl'] .modal-section-content { text-align: right; }
[dir='rtl'] .modal-history-toggle { flex-direction: row-reverse; }
[dir='rtl'] .modal-history-toggle svg { transform: scaleX(-1); }
[dir='rtl'] .modal-history-msg-role { text-align: right; }
[dir='rtl'] .modal-history-msg-content { text-align: right; }
[dir='rtl'] .modal-progress-wrap { flex-direction: row-reverse; }
[dir='rtl'] .modal-btns { flex-direction: row-reverse; }

/* ---------- Team Brainstorm Button (Home View) ---------- */
.team-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
    color: var(--accent-purple);
    border-color: rgba(139, 92, 246, 0.3);
}

.team-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.25));
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.team-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(236, 72, 153, 0.35));
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* ---------- Brainstorm Input Actions ---------- */
.brainstorm-input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.brainstorm-persona-select {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
    max-width: 100px;
    font-family: var(--font-sans);
}

.brainstorm-persona-select:hover {
    border-color: var(--text-accent);
    background: var(--bg-glass-strong);
}

.brainstorm-persona-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ---------- Brainstorm Action Buttons ---------- */
.brainstorm-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.brainstorm-action-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.brainstorm-action-btn.recording {
    color: var(--priority-critical);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    animation: pulseGlow 1.5s infinite;
}

/* Team button special styling in brainstorm mode */
.brainstorm-action-btn.team-action-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    color: var(--accent-purple);
    border-color: rgba(139, 92, 246, 0.3);
}

.brainstorm-action-btn.team-action-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.brainstorm-action-btn.team-action-btn.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3));
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* ---------- Team Mode Typing Indicator ---------- */
.team-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-muted);
    margin: 8px 0;
    animation: fadeUp 0.3s ease-out;
}

.team-typing-indicator .typing-name {
    font-weight: 600;
    color: var(--accent-purple);
}

.team-typing-indicator .typing-dots {
    display: flex;
    gap: 3px;
}

.team-typing-indicator .typing-dots span {
    width: 4px;
    height: 4px;
    background: var(--accent-purple);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.team-typing-indicator .typing-dots span:nth-child(1) { animation-delay: 0s; }
.team-typing-indicator .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.team-typing-indicator .typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ---------- Team Mode Badge ---------- */
.team-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-purple);
}

.team-mode-badge .badge-icon {
    font-size: 12px;
}

/* ---------- Team Message Styling ---------- */
.team-message {
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

.team-message.agent1 {
    align-self: flex-start;
}

.team-message.agent2 {
    align-self: flex-end;
}

.team-message .agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 4px;
}

.team-message.agent1 .agent-badge {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.1));
    color: var(--accent-purple);
}

.team-message.agent2 .agent-badge {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.1));
    color: var(--accent-pink);
}

/* ---------- Team Round Indicator ---------- */
#team-round-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-muted);
    margin: 12px auto;
    max-width: fit-content;
}


/* ---------- Message Action Buttons ---------- */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .message-actions,
.message.assistant:focus-within .message-actions {
    opacity: 1;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    padding: 0;
}

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

.msg-action-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.msg-action-btn.copied::after {
    content: '✓';
    font-size: 12px;
    position: absolute;
}

/* Persona Dropdown */
.regen-wrapper {
    position: relative;
    display: inline-block;
}

.persona-dropdown {
    position: fixed;
    z-index: 1000;
    min-width: 160px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 8px 0;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.persona-dropdown.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.persona-dropdown-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px 6px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}

.persona-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.persona-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

/* ---------- Enhanced Mobile Styles ---------- */
@media (max-width: 768px) {
    /* Landing page input improvements */
    .input-container {
        width: 100%;
    }
    
    .main-input {
        padding: 60px 16px 20px 16px;
        font-size: 16px;
        min-height: 100px;
    }
    
    .input-actions {
        position: absolute;
        top: 12px;
        right: 12px;
        bottom: auto;
        gap: 6px;
    }
    
    .voice-btn {
        width: 36px;
        height: 36px;
    }
    
    .input-submit-btn {
        width: 36px;
        height: 36px;
    }
    
    /* Brainstorm input improvements */
    .brainstorm-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    
    .brainstorm-title {
        order: -1;
        width: 100%;
        text-align: left;
        padding: 0;
        margin-bottom: 4px;
        font-size: 13px;
    }
    
    .back-btn {
        order: 0;
    }
    
    .brainstorm-persona-quick {
        order: 1;
        flex: 1;
        margin: 0;
    }
    
    .quick-persona-select {
        width: 100%;
        max-width: none;
    }
    
    .crystallize-btn {
        order: 2;
        padding: 8px 12px;
    }
    
    .crystallize-btn span {
        display: none;
    }
    
    /* Brainstorm input area mobile */
    .brainstorm-input-area {
        padding: 12px;
    }
    
    .brainstorm-input-wrap {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px;
    }
    
    .brainstorm-input {
        order: 1;
        width: 100%;
        flex: none;
        padding: 8px 0;
        min-height: 44px;
        font-size: 16px;
    }
    
    .brainstorm-input-actions {
        order: 2;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
    }
    
    .brainstorm-persona-select {
        flex: 1;
        min-width: 0;
        max-width: none;
    }
    
    .brainstorm-action-btn {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .brainstorm-send-btn {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    /* Messages on mobile */
    .message {
        max-width: 92%;
    }
    
    .message-actions {
        opacity: 1;
    }
    
    .msg-action-btn {
        width: 32px;
        height: 32px;
    }
    
    /* Persona dropdown mobile positioning */
    .persona-dropdown {
        position: fixed;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        max-width: 300px;
    }
    
    .persona-dropdown-item {
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 24px;
        letter-spacing: -1px;
    }
    
    .hero-line-1 {
        font-size: 14px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .main-input {
        font-size: 16px;
        padding: 56px 12px 16px 12px;
        min-height: 90px;
    }
    
    .input-actions {
        top: 10px;
        right: 10px;
        gap: 4px;
    }
    
    .voice-btn {
        width: 32px;
        height: 32px;
    }
    
    .voice-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .input-submit-btn {
        width: 32px;
        height: 32px;
    }
    
    .input-submit-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .template-chips {
        gap: 6px;
    }
    
    .template-chip {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    /* Brainstorm view */
    .brainstorm-input {
        font-size: 16px;
    }
    
    .brainstorm-persona-select {
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .brainstorm-action-btn {
        width: 32px;
        height: 32px;
    }
    
    .brainstorm-send-btn {
        width: 32px;
        height: 32px;
    }
    
    /* Message bubbles */
    .message-bubble {
        padding: 12px 14px;
        font-size: 14px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .message-actions {
        opacity: 1;
    }
    
    .msg-action-btn {
        width: 36px;
        height: 36px;
    }
    
    .voice-btn:hover,
    .input-submit-btn:hover,
    .msg-action-btn:hover,
    .brainstorm-action-btn:hover,
    .brainstorm-send-btn:hover {
        transform: none;
    }
}
