:root {
    --bg-color: #0b0f19;
    --surface-color: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-primary: #8b5cf6;
    --accent-secondary: #3b82f6;
    --gradient-accent: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --sidebar-width: 280px;
    --font-family: 'Inter', sans-serif;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Premium Webkit Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 2px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5); /* Accent primary with opacity */
}

/* Views */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: scale(0.95);
}

.view.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    z-index: 10;
}

/* 3D Canvas */
.webgl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Landing Page Scaffolding */
#landing-page {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.15) 0%, var(--bg-color) 40%);
}

/* Header */
.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
}

.header-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.landing-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.landing-nav a:hover {
    color: var(--text-primary);
}

.small-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Hero Section */
.landing-hero {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: 2rem 5%;
    z-index: 2;
}

.hero-content {
    flex: 1;
    z-index: 3;
    padding-right: 2rem;
    animation: slideUp 1s ease-out forwards;
}

.gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 500px;
}

.hero-chat-animation {
    flex: 1;
    z-index: 3;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.animated-chat-box {
    width: 100%;
    max-width: 450px;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: rotateY(-5deg) rotateX(5deg);
    transition: transform 0.3s ease;
}

.animated-chat-box:hover {
    transform: rotateY(0deg) rotateX(0deg);
}

.chat-header-fake {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255,255,255,0.02);
}

.dots {
    display: flex;
    gap: 6px;
}
.dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #475569;
}
.dots span:nth-child(1) { background: #ef4444; }
.dots span:nth-child(2) { background: #eab308; }
.dots span:nth-child(3) { background: #22c55e; }

.chat-body-fake {
    height: 300px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: hidden;
}

.fake-msg {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(10px);
    animation: slideUpFade 0.3s forwards ease-out;
}
.fake-user {
    align-self: flex-end;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-top-right-radius: 2px;
}
.fake-ai {
    align-self: flex-start;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-top-left-radius: 2px;
}

.chat-input-fake {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.fake-input {
    flex: 1;
    height: 35px;
    background: var(--surface-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.fake-input::after {
    content: '|';
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.fake-send {
    width: 35px;
    height: 35px;
    background: var(--surface-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* About Section */
.about-section {
    padding: 5rem 5%;
    background: var(--bg-color);
    z-index: 2;
}

.about-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 4rem;
}

.about-text {
    flex: 1;
}
.about-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}
.about-text p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.about-image {
    flex: 1;
    display: flex;
    justify-content: center;
}
.about-image img {
    width: 100%;
    max-width: 300px;
    border-radius: 20px;
    filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.3));
}

/* Footer */
.landing-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 3rem 5% 1.5rem;
    border-top: 1px solid var(--border-color);
    z-index: 2;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    max-width: 1000px;
    margin: 0 auto 2rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.footer-brand img {
    width: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}
.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-bottom {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--surface-color);
    padding-top: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* Buttons */
.primary-btn {
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.4);
}

.secondary-btn {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
}

.secondary-btn:hover {
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.danger-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.icon-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Animated Background */
.blob {
    position: absolute;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.4;
    animation: float 10s infinite alternate ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -10%;
    left: -10%;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-secondary);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #ec4899;
    top: 40%;
    left: 40%;
    animation-duration: 15s;
}

/* Chat Page Layout */
#chat-page {
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: rgba(11, 15, 25, 0.8);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
    opacity: 0;
}

.sidebar-header {
    margin-bottom: 2rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.brand h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    /* Always show a thin scrollbar track */
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.5) rgba(255, 255, 255, 0.04);
}

/* Webkit custom scrollbar for chat history */
.chat-history::-webkit-scrollbar {
    width: 5px;
}

.chat-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.9);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
}

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

.nav-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-primary);
}

.nav-item i {
    font-size: 1.2rem;
}

.chat-history h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

#history-list {
    list-style: none;
}

.history-item {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-item i {
    flex-shrink: 0;
}

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

.history-item.active {
    background: var(--surface-color);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-primary);
}

/* Main Chat Area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top center, rgba(30, 41, 59, 0.5) 0%, var(--bg-color) 100%);
    position: relative;
}

.chat-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

.welcome-message {
    margin: auto;
    text-align: center;
    animation: fadeIn 1s ease;
}

.welcome-message h3 {
    margin-top: 1rem;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.suggestion-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.2rem;
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.suggestion-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(56, 189, 248, 0.8));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.suggestion-card:hover {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-primary);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

.suggestion-card:hover::before {
    opacity: 1;
}

.suggestion-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-card:hover .suggestion-icon {
    background: linear-gradient(135deg, #8b5cf6, #38bdf8);
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
    transform: scale(1.1) rotate(5deg);
}

.suggestion-text {
    line-height: 1.5;
    font-weight: 500;
    z-index: 1;
}

/* Messages */
.message {
    display: flex;
    gap: 15px;
    max-width: 80%;
    animation: slideUpFade 0.4s ease forwards;
}

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

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

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user .avatar {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.ai .avatar {
    background: var(--gradient-accent);
}

.ai .avatar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.message-content {
    background: var(--surface-color);
    padding: 1rem 1.2rem;
    border-radius: 16px;
    line-height: 1.6;
    border: 1px solid var(--border-color);
}

.user .message-content {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    border-top-right-radius: 4px;
}

.ai .message-content {
    border-top-left-radius: 4px;
    width: 100%;
    overflow-x: auto;
}

/* Markdown Styling */
.message-content h1, .message-content h2, .message-content h3, .message-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.message-content h1:first-child, .message-content h2:first-child, .message-content h3:first-child {
    margin-top: 0;
}

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

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

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

.message-content li {
    margin-bottom: 0.5rem;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #e2e8f0;
}

.message-content pre {
    background: #0f172a;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.message-content pre code {
    background: transparent;
    padding: 0;
    color: #38bdf8;
}

.message-content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.message-content th, .message-content td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.message-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-primary);
}

.message-content tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 0.5rem;
}

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

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

/* Input Area */
.input-area {
    padding: 2rem;
    background: linear-gradient(to top, var(--bg-color) 70%, transparent);
}

.input-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem;
    display: flex;
    align-items: flex-end;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    padding: 0.8rem;
    resize: none;
    max-height: 150px;
    outline: none;
}

textarea::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    background: var(--accent-primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    margin-bottom: 4px;
    margin-right: 4px;
    font-size: 1.3rem;
}

.upload-btn {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    margin-left: 4px;
    display: flex;
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

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

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

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.mobile-only {
    display: none;
}

.file-preview-doc {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.file-preview-doc i {
    font-size: 1.2rem;
    color: var(--accent-primary);
}

/* Animations */
@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

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

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

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.floating {
    animation: float 6s infinite alternate ease-in-out;
}
.floating-delayed {
    animation: float 6s infinite alternate ease-in-out;
    animation-delay: -3s;
}

/* File Upload & Preview */
.upload-btn {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.upload-btn:hover {
    color: var(--accent-primary);
}

/* Lens button — purple accent, matches upload-btn layout */
.lens-btn {
    color: #c084fc;
    font-size: 1.25rem;
}

.lens-btn:hover {
    color: #e879f9;
    background: rgba(192, 132, 252, 0.1);
}

.lens-btn.active {
    color: #e879f9;
    background: rgba(192, 132, 252, 0.15);
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.3);
}

.file-preview-container {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    z-index: 20;
    animation: slideUpFade 0.3s ease;
}

#file-preview-img {
    max-height: 80px;
    max-width: 120px;
    border-radius: 6px;
    object-fit: cover;
}

.remove-file-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin-top: 10px;
    margin-bottom: 5px;
    object-fit: contain;
}

/* History Item Actions */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-content {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
}

.history-actions {
    display: none;
    gap: 5px;
}

.history-item:hover .history-actions {
    display: flex;
}

.history-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.history-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.history-action-btn.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.premium-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    padding: 2rem;
    z-index: 1001;
    width: 90%;
    max-width: 400px;
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-modal.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.premium-modal h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.premium-modal p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.premium-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-header .icon-btn {
    font-size: 1.6rem;
    padding: 0.6rem;
}

/* User Profile Panel */
.profile-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 350px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.profile-panel.active {
    right: 0;
}

.profile-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2.5rem;
}

.profile-info .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 16px rgba(56, 189, 248, 0.2);
}

.profile-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.2rem;
}

.profile-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.analytics-section h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: 250px;
}

.profile-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.full-width {
    width: 100%;
    justify-content: center;
}

/* Message Actions */
.message {
    position: relative; /* Ensure the actions stick to the message */
}

.message-actions {
    position: absolute;
    bottom: -15px;
    right: 15px;
    display: flex;
    gap: 8px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.message:hover .message-actions {
    opacity: 1;
    visibility: visible;
    bottom: -10px;
}

.message-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.message-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Inline Edit */
.edit-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 8px;
}

.edit-textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.edit-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.edit-actions button {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Branch Navigation */
.branch-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 12px;
    margin-top: 4px;
}

.branch-nav button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.branch-nav button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.branch-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Developer HUD */
.dev-hud {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    padding: 16px 24px;
    z-index: 999;
    display: none;
    flex-direction: column;
    min-width: max-content;
}

.dev-hud.active {
    display: flex;
    animation: slideInHUD 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInHUD {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.dev-hud-header {
    padding: 0 0 12px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
    margin-bottom: 12px;
}

.dev-hud-header h3 {
    margin: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.dev-hud-body {
    display: flex;
    gap: 12px;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.8);
}

.stat-label {
    color: rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100%;
        z-index: 50;
        opacity: 1; /* override collapsed opacity if applied */
        background: rgba(11, 15, 25, 0.95);
    }
    
    .sidebar.open {
        left: 0;
        box-shadow: 100vw 0 0 rgba(0,0,0,0.5); /* backdrop effect */
    }
    
    .mobile-only {
        display: block;
    }
    
    .message {
        max-width: 95%;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }
    
    .gradient-text {
        font-size: 2.2rem;
    }
    
    .chat-container {
        padding: 1rem;
    }
    
    .input-area {
        padding: 1rem;
    }
    
    .input-wrapper {
        padding: 0.5rem 1rem;
    }
    
    .hero-chat-animation {
        display: none; /* Hide 3D element on mobile to save space */
    }
    
    .hero-content {
        padding-right: 0;
        text-align: center;
    }
    
    .welcome-message h3 {
        font-size: 1.5rem;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   Spatial Memory Canvas
   ========================================================================== */

.chat-and-canvas-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 70px);
}

.chat-and-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* prevent flex blowout */
}

.spatial-canvas {
    width: 0;
    opacity: 0;
    overflow: hidden;
    background-color: rgba(15, 20, 35, 0.95);
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    border-left: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.spatial-canvas.open {
    width: 40%;
    opacity: 1;
}

/* Fullscreen overlay mode — purely additive, doesn't change existing layout */
.spatial-canvas.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    opacity: 1 !important;
    z-index: 9999;
    border-left: none;
    border-radius: 0;
    animation: canvasFullscreenIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes canvasFullscreenIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.canvas-header {
    position: relative;
    padding: 1rem 1.5rem;
    background: rgba(11, 15, 25, 0.95);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.canvas-header h3 {
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-primary);
}

.canvas-header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.canvas-board {
    flex: 1;
    position: relative;
    overflow: auto;
}

/* Sticky Note Styles */
.sticky-note {
    position: absolute;
    width: 250px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(139, 92, 246, 0.1);
    display: flex;
    flex-direction: column;
    cursor: grab;
    backdrop-filter: blur(10px);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
    z-index: 100;
}

.sticky-note:active {
    cursor: grabbing;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(139, 92, 246, 0.2);
    transform: scale(1.02);
    z-index: 999;
}

.sticky-header {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticky-drag-handle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sticky-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
    padding: 2px;
    display: flex;
    border-radius: 4px;
}

.sticky-close:hover {
    color: #ef4444;
    background: rgba(255, 255, 255, 0.1);
}

.sticky-content {
    padding: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
    max-height: 250px;
    overflow-y: auto;
    word-break: break-word;
    user-select: none; /* prevent text selection while dragging */
}

.sticky-content pre {
    margin: 0;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.sticky-content code {
    font-family: monospace;
}

/* Drop target styles */
.input-area.drag-over {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.1);
}
.input-area.drag-over textarea {
    background: transparent;
}
/* Glass Box Hacker Terminal */
.dev-hud-terminal {
    margin-top: 15px;
    background: #000;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    height: 150px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8rem;
    color: #22c55e;
    box-shadow: inset 0 0 10px rgba(34, 197, 94, 0.1);
}

.terminal-line {
    margin-bottom: 4px;
    word-break: break-word;
}

.term-time {
    color: #64748b;
    margin-right: 5px;
}
.term-warn { color: #eab308; }
.term-err { color: #ef4444; }
.term-success { color: #10b981; }
/* ==========================================================================
   DOM Morphing Themes
   ========================================================================== */

body.theme-hacker {
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --border-color: #166534;
    --text-primary: #22c55e;
    --text-secondary: #16a34a;
    --accent-primary: #22c55e;
    --accent-hover: #16a34a;
}
body.theme-hacker * {
    font-family: 'Courier New', Courier, monospace !important;
}

body.theme-minimal {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
}
/* Features Section */
.features-section {
    padding: 100px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.features-header {
    text-align: center;
    margin-bottom: 60px;
}

.features-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.features-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 30px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Target Section */
.target-section {
    padding: 80px 20px;
    max-width: 1200px;
    margin: 0 auto;
}
.target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}
.target-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    transition: all 0.3s ease;
}
.target-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(59, 130, 246, 0.3);
}
.target-card i {
    font-size: 3rem;
    color: var(--accent-secondary);
    margin-bottom: 20px;
}
.target-card h4 {
    font-size: 1.4rem;
    margin-bottom: 15px;
}
.target-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Comparison Table */
.comparison-section {
    padding: 80px 20px 120px;
    max-width: 1000px;
    margin: 0 auto;
}
.table-container {
    overflow-x: auto;
    background: rgba(11, 19, 43, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}
.comparison-table th, .comparison-table td {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.comparison-table th {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    background: rgba(0,0,0,0.2);
}
.comparison-table td {
    font-size: 1rem;
    color: var(--text-secondary);
}
.comparison-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.highlight-col {
    background: rgba(139, 92, 246, 0.05);
    border-left: 1px solid rgba(139, 92, 246, 0.2);
    border-right: 1px solid rgba(139, 92, 246, 0.2);
}
.comparison-table th.highlight-col {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
    border-top: 2px solid var(--accent-primary);
}
.comparison-table i {
    font-size: 1.4rem;
}
