:root {
    --bg: #ffffff;
    --text-primary: #171717;
    --text-muted: #666666;
    --border: #e5e5e5;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --bg-secondary: #fafafa;
    --sidebar-bg: #f9f9f9;
    --error: #dc2626;
    --success: #16a34a;
    --modal-bg: rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --text-primary: #ededed;
    --text-muted: #a1a1a1;
    --border: #262626;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --bg-secondary: #171717;
    --sidebar-bg: #111111;
    --modal-bg: rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;

/* Mouse glow spotlight */
.landing-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(700px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(37, 99, 235, 0.07), transparent 40%);
    pointer-events: none;
    z-index: 0;
}
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.1s ease;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body:not(.landing-page) {
    height: 100vh;
    overflow: hidden;
}

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

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

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

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.logo-icon {
    width: 20px;
    height: 20px;
    background: var(--text-primary);
    border-radius: 4px;
}

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

h2 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.notebook-item {
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notebook-item:hover {
    background: var(--border);
}

.notebook-item.active {
    background: var(--border);
    font-weight: 600;
}

/* Main Container */
.main-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg);
}

.main-header {
    padding: 2rem 3rem 1rem;
}

.header-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.content-area {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.knowledge-overview {
    padding: 0 3rem;
    margin: 1.5rem auto 0;
    max-width: 800px;
    width: 100%;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.file-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.visible { display: flex; }

.modal-content {
    background: var(--bg);
    padding: 2rem;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-content h3 { margin-bottom: 0.5rem; }
.modal-content p { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9375rem; }
.modal-content input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-bottom: 2rem;
    outline: none;
}

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

/* Shared Components Integration */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.btn { padding: 0.625rem 1.25rem; border-radius: 8px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: #fff; color: #171717; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 0.9375rem; transition: opacity 0.2s, background 0.2s; }
.btn.primary { background: #2563eb; color: #fff; border: none; }
.btn.secondary { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); }
.btn.lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn.full { width: 100%; }
.btn:hover { opacity: 0.8; }
.highlight { color: #2563eb; }

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.25rem 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .navbar {
    background: rgba(10, 10, 10, 0.8);
}

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

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Hero Section */
.hero {
    padding: 12rem 0 8rem;
    text-align: center;
}

.hero-content {
    max-width: 900px;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin-bottom: 2rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Features */
.features, .how-it-works, .contact {
    padding: 8rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    text-transform: none;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    display: block;
}

.feature-card h3 {
    margin-bottom: 1rem;
    font-weight: 700;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* How it Works */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 4rem;
}

.step-num {
    font-size: 0.875rem;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 1rem;
}

.step p {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Contact */
.contact-card {
    max-width: 700px;
    margin: 0 auto;
    padding: 4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

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

.form-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, .form-group textarea {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1.5px solid #555;
    background: #1a1a1a;
    color: #ededed;
    font-family: inherit;
    font-size: 0.9375rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Override browser autofill so Name & Email look identical */
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #1a1a1a inset;
    -webkit-text-fill-color: #ededed;
    border-color: #555;
    transition: background-color 5000s ease-in-out 0s;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Setup Guide */
.setup-guide {
    background: var(--bg);
}

.setup-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.setup-step {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-step h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.setup-step p {
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.setup-step pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
}

.setup-step code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: pre;
}

.step-hint {
    margin-top: 0.5rem;
    font-style: italic;
    color: #2563eb;
}

.footer {
    padding: 4rem 0;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 2rem;
}

/* Animations */
.fade-in { animation: fadeIn 0.8s ease-out forwards; opacity: 0; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

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

@media (max-width: 900px) {
    .hero h1 { font-size: 3rem; }
    .form-row { flex-direction: column; }
    .contact-card { padding: 2rem; }
}

.upload-box:hover { border-color: var(--text-primary); background: #f4f4f4; }
.upload-content p { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.5rem; }

.chat-box { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1rem; padding-bottom: 6rem; }
.message { display: flex; gap: 1rem; }
.avatar { width: 32px; height: 32px; border-radius: 6px; background: var(--bg-secondary); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.msg-content { font-size: 0.9375rem; padding-top: 4px; }

.input-container { position: sticky; bottom: 0; background: var(--bg); padding: 1.5rem 3rem 2rem; margin-top: auto; }
.input-area { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 4px 6px 4px 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
input[type="text"] { flex-grow: 1; border: none; outline: none; padding: 0.75rem 0; font-size: 0.9375rem; background: transparent; color: var(--text-primary); }

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.theme-toggle svg { width: 18px; height: 18px; }

.btn { padding: 0.5rem 1rem; border-radius: 8px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: #fff; color: #171717; }
.btn.primary { background: #2563eb; color: #fff; border: none; }
.btn:hover { opacity: 0.8; }

.icon-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--border); color: var(--text-primary); }

#send-btn { width: 36px; height: 36px; background: var(--text-primary); color: #fff; border: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; opacity: 0.5; }
#send-btn.active { opacity: 1; }

.status-message { font-size: 0.8125rem; margin-top: 0.5rem; text-align: center; display: none; }
.status-message.visible { display: block; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-header, .content-area, .knowledge-overview, .input-container { padding: 1.5rem; }
}
