/* Modern, clean styling for Video Transcription Note Manager */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.nav {
    display: flex;
    gap: 1.5rem;
}

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

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

.nav a.active {
    color: var(--primary-color);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="url"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

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

.btn-success {
    background-color: var(--success-color);
    color: white;
}

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

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

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.video-card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.video-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background-color: #e2e8f0;
}

.video-info {
    padding: 1rem;
}

.video-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.video-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background-color: #e0e7ff;
    color: #4338ca;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab:hover {
    color: var(--primary-color);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Alert messages */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Notes display */
.notes-content {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.notes-content h1,
.notes-content h2,
.notes-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.notes-content h1 {
    font-size: 1.5rem;
}

.notes-content h2 {
    font-size: 1.25rem;
}

.notes-content h3 {
    font-size: 1.1rem;
}

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

.notes-content ul,
.notes-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.notes-content code {
    background-color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Utility classes */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.flex { display: flex; }
.flex-gap { gap: 1rem; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

/* ============================================
   Local Video Upload Styles
   ============================================ */

/* Upload zone - drag and drop area */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-zone-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* File info display */
.file-info {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

/* Checkbox label styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Button row for form actions */
.button-row {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

/* Progress steps container */
.progress-steps {
    margin: 1.5rem 0;
}

/* Individual progress step */
.progress-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    opacity: 0.5;
    transition: all 0.2s;
}

.progress-step.active {
    opacity: 1;
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.progress-step.complete {
    opacity: 1;
    border-color: var(--success-color);
    background: rgba(22, 163, 74, 0.05);
}

.progress-step .step-icon {
    width: 1.5rem;
    text-align: center;
    font-weight: bold;
}

.progress-step.complete .step-icon {
    color: var(--success-color);
}

.progress-step .step-text {
    flex: 1;
}

/* Progress status text */
.progress-status {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Small spinner for progress steps */
.spinner-small {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   NOTEBOOK STYLES
   ============================================ */

/* 1. Notebook CSS Variables */
:root {
    /* Notebook-specific layout variables */
    --notebook-sidebar-width: 260px;
    --notebook-toc-width: 200px;
    --notebook-content-max: 65ch;
    --notebook-line-height: 1.65;

    /* Light mode (default) colors */
    --nb-bg-primary: #ffffff;
    --nb-bg-secondary: #f6f8fa;
    --nb-bg-tertiary: #eaeef2;
    --nb-text-primary: #1f2328;
    --nb-text-secondary: #656d76;
    --nb-border: #d0d7de;
    --nb-accent: #0969da;
    --nb-code-bg: #f6f8fa;
}

/* 2. Dark Mode Colors */
@media (prefers-color-scheme: dark) {
    :root {
        --nb-bg-primary: #0d1117;
        --nb-bg-secondary: #161b22;
        --nb-bg-tertiary: #21262d;
        --nb-text-primary: #e6edf3;
        --nb-text-secondary: #8b949e;
        --nb-border: #30363d;
        --nb-accent: #58a6ff;
        --nb-code-bg: #161b22;
    }
}

/* 3. Layout Styles */
.notebook-layout {
    display: flex;
    min-height: calc(100vh - 60px);
    background: var(--nb-bg-primary);
}

.notebook-sidebar {
    width: var(--notebook-sidebar-width);
    background: var(--nb-bg-secondary);
    border-right: 1px solid var(--nb-border);
    overflow-y: auto;
    flex-shrink: 0;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
}

.notebook-main {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-width: 100%;
}

.notebook-toc {
    width: var(--notebook-toc-width);
    padding: 2rem 1rem;
    border-left: 1px solid var(--nb-border);
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    flex-shrink: 0;
}

/* 4. Sidebar Styles */
.notebook-search {
    padding: 1rem;
    border-bottom: 1px solid var(--nb-border);
}

.notebook-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--nb-border);
    border-radius: 0.375rem;
    background: var(--nb-bg-primary);
    color: var(--nb-text-primary);
    font-size: 0.875rem;
}

.notebook-search input:focus {
    outline: none;
    border-color: var(--nb-accent);
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.notebook-channels {
    padding: 0.5rem 0;
}

.notebook-channel {
    margin-bottom: 0.25rem;
}

.notebook-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
}

.notebook-channel-header:hover {
    background: var(--nb-bg-tertiary);
}

.notebook-channel-title {
    font-weight: 600;
    color: var(--nb-text-primary);
    font-size: 0.875rem;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notebook-channel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    background: var(--nb-accent);
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.notebook-channel-toggle {
    width: 1rem;
    height: 1rem;
    color: var(--nb-text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.notebook-channel-toggle.open {
    transform: rotate(90deg);
}

.notebook-channel-notes {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.notebook-channel-notes.open {
    max-height: 2000px;
}

.notebook-note-link {
    display: block;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--nb-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notebook-note-link:hover {
    background: var(--nb-bg-tertiary);
    color: var(--nb-text-primary);
}

.notebook-note-link.active {
    background: var(--nb-accent);
    color: white;
    font-weight: 500;
}

.notebook-show-more {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: none;
    border: none;
    color: var(--nb-text-secondary);
    text-align: left;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.notebook-show-more:hover {
    background: var(--nb-bg-tertiary);
    color: var(--nb-text-primary);
}

/* 5. Content Styles */
.notebook-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--nb-text-secondary);
    font-size: 0.875rem;
}

.notebook-breadcrumbs a {
    color: var(--nb-accent);
    text-decoration: none;
}

.notebook-breadcrumbs a:hover {
    text-decoration: underline;
}

.notebook-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--nb-border);
}

.notebook-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--nb-text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.notebook-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.notebook-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--nb-text-secondary);
}

.notebook-content {
    max-width: var(--notebook-content-max);
    line-height: var(--notebook-line-height);
    color: var(--nb-text-primary);
}

.notebook-content.markdown-body {
    font-size: 1rem;
}

.notebook-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--nb-border);
}

.notebook-nav-link {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--nb-text-primary);
    transition: all 0.15s ease;
    max-width: 45%;
}

.notebook-nav-link:hover {
    background: var(--nb-bg-tertiary);
    border-color: var(--nb-accent);
}

.notebook-nav-label {
    font-size: 0.75rem;
    color: var(--nb-text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.notebook-nav-title {
    font-weight: 500;
}

/* 6. TOC Styles */
.notebook-toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nb-text-secondary);
    margin-bottom: 1rem;
}

.notebook-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notebook-toc-link {
    display: block;
    padding: 0.375rem 0.75rem;
    color: var(--nb-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
}

.notebook-toc-link:hover {
    background: var(--nb-bg-tertiary);
    color: var(--nb-text-primary);
}

.notebook-toc-link.active {
    color: var(--nb-accent);
    font-weight: 600;
    border-left-color: var(--nb-accent);
    background: var(--nb-bg-tertiary);
}

/* 7. Markdown Enhancement Styles */

/* Code blocks */
.notebook-content pre {
    position: relative;
    background: var(--nb-code-bg);
    border: 1px solid var(--nb-border);
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.notebook-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--nb-bg-tertiary);
    border: 1px solid var(--nb-border);
    border-radius: 0.25rem;
    color: var(--nb-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
}

.notebook-content pre:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--nb-accent);
    color: white;
    border-color: var(--nb-accent);
}

.code-language-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--nb-bg-tertiary);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: var(--nb-text-secondary);
    text-transform: uppercase;
}

/* GitHub Alerts */
.alert {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 4px solid;
    border-radius: 0.375rem;
}

.alert-note {
    background: rgba(9, 105, 218, 0.1);
    border-color: var(--nb-accent);
}

.alert-tip {
    background: rgba(22, 163, 74, 0.1);
    border-color: #16a34a;
}

.alert-important {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border-color: #eab308;
}

.alert-caution {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.alert-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

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

/* Tables */
.notebook-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.notebook-content th {
    background: var(--nb-bg-secondary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--nb-border);
}

.notebook-content td {
    padding: 0.75rem;
    border: 1px solid var(--nb-border);
}

.notebook-content tr:hover {
    background: var(--nb-bg-tertiary);
}

/* Blockquotes */
.notebook-content blockquote {
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--nb-accent);
    background: var(--nb-bg-secondary);
    font-style: italic;
    color: var(--nb-text-secondary);
}

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

/* Headings with scroll margin for anchor links */
.notebook-content h1,
.notebook-content h2,
.notebook-content h3,
.notebook-content h4,
.notebook-content h5,
.notebook-content h6 {
    scroll-margin-top: 80px;
}

/* 8. Mobile Responsive (CRITICAL) */

/* Mobile hamburger menu button */
.notebook-mobile-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 1rem;
    z-index: 1001;
    background: var(--nb-bg-primary);
    border: 1px solid var(--nb-border);
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
}

.notebook-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.notebook-overlay.open {
    display: block;
}

/* Mobile TOC (inline collapsible) */
.notebook-mobile-toc {
    display: none;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 0.5rem;
}

.notebook-mobile-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--nb-text-primary);
}

.notebook-mobile-toc-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.notebook-mobile-toc-content.open {
    max-height: 500px;
    margin-top: 1rem;
}

/* Mobile base (default) */
@media (max-width: 767px) {
    .notebook-sidebar {
        position: fixed;
        left: -280px;
        top: 60px;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s ease;
        height: calc(100vh - 60px);
    }

    .notebook-sidebar.open {
        left: 0;
    }

    .notebook-main {
        padding: 1rem;
    }

    .notebook-toc {
        display: none;
    }

    .notebook-mobile-toggle {
        display: block;
    }

    .notebook-mobile-toc {
        display: block;
    }

    .notebook-layout {
        display: block;
    }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .notebook-sidebar {
        position: static;
        width: 220px;
    }

    .notebook-layout {
        display: flex;
    }

    .notebook-overlay {
        display: none !important;
    }

    .notebook-mobile-toggle {
        display: none;
    }

    .notebook-mobile-toc {
        display: none;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .notebook-sidebar {
        width: var(--notebook-sidebar-width);
    }
}

/* Wide desktop (1400px+) */
@media (min-width: 1400px) {
    .notebook-toc {
        display: block;
    }

    .notebook-mobile-toc {
        display: none;
    }
}

/* 9. Transitions & Polish */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.notebook-search input:focus,
.notebook-note-link:focus,
.notebook-toc-link:focus,
.notebook-nav-link:focus {
    outline: 2px solid var(--nb-accent);
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition-timing-function: ease;
}

.notebook-note-link,
.notebook-toc-link,
.notebook-nav-link,
.notebook-channel-header,
.code-copy-btn {
    transition: all 0.15s ease;
}

.notebook-channel-toggle,
.notebook-channel-notes {
    transition: transform 0.2s ease, max-height 0.3s ease;
}

/* Loading states */
.notebook-content-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Print styles */
@media print {
    .notebook-sidebar,
    .notebook-toc,
    .notebook-nav,
    .notebook-mobile-toggle {
        display: none !important;
    }

    .notebook-main {
        max-width: 100%;
        padding: 0;
    }
}

/* ============================================
   AGGREGATED NOTE PAGE STYLES
   ============================================ */

/* Page container */
.aggregated-note-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    background: var(--nb-bg-primary);
    min-height: calc(100vh - 60px);
}

/* Back link */
.aggregated-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--nb-accent);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.aggregated-back-link:hover {
    text-decoration: underline;
}

/* Header */
.aggregated-note-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--nb-border);
}

.aggregated-note-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--nb-text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

/* Metadata badges row */
.aggregated-note-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.aggregated-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--nb-text-secondary);
}

.aggregated-badge-primary {
    background: var(--nb-accent);
    color: white;
    border-color: var(--nb-accent);
}

/* Source videos section */
.aggregated-source-videos {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 0.5rem;
}

.aggregated-source-videos h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nb-text-secondary);
    margin-bottom: 0.75rem;
}

/* Video chips container */
.aggregated-video-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.aggregated-video-chip {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--nb-bg-primary);
    border: 1px solid var(--nb-border);
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--nb-text-primary);
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.aggregated-video-chip:hover {
    background: var(--nb-accent);
    color: white;
    border-color: var(--nb-accent);
}

.aggregated-video-chip small {
    display: block;
    font-size: 0.75rem;
    color: var(--nb-text-secondary);
    margin-top: 0.125rem;
}

.aggregated-video-chip:hover small {
    color: rgba(255, 255, 255, 0.85);
}

/* Table of Contents */
.aggregated-toc {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 0.5rem;
}

.aggregated-toc h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nb-text-secondary);
    margin-bottom: 0.75rem;
}

.aggregated-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.aggregated-toc-list li {
    margin-bottom: 0.25rem;
}

.aggregated-toc-list a {
    display: block;
    padding: 0.25rem 0.5rem;
    color: var(--nb-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
}

.aggregated-toc-list a:hover {
    background: var(--nb-bg-tertiary);
    color: var(--nb-text-primary);
}

/* Action buttons row */
.aggregated-actions {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--nb-border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.aggregated-actions .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Dark mode toggle button */
.aggregated-dark-toggle {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 100;
    padding: 0.5rem;
    background: var(--nb-bg-secondary);
    border: 1px solid var(--nb-border);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: all 0.15s ease;
}

.aggregated-dark-toggle:hover {
    background: var(--nb-bg-tertiary);
}

/* Dark mode overrides */
[data-theme="dark"] {
    --nb-bg-primary: #0d1117;
    --nb-bg-secondary: #161b22;
    --nb-bg-tertiary: #21262d;
    --nb-text-primary: #e6edf3;
    --nb-text-secondary: #8b949e;
    --nb-border: #30363d;
    --nb-accent: #58a6ff;
    --nb-code-bg: #161b22;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .aggregated-note-page {
        padding: 1rem;
    }

    .aggregated-note-header h1 {
        font-size: 1.5rem;
    }

    .aggregated-actions {
        flex-direction: column;
    }

    .aggregated-actions .btn {
        width: 100%;
        text-align: center;
    }

    .aggregated-dark-toggle {
        top: auto;
        bottom: 1rem;
        right: 1rem;
    }
}

/* Print styles for aggregated notes */
@media print {
    .aggregated-dark-toggle,
    .aggregated-actions,
    .aggregated-back-link {
        display: none !important;
    }

    .aggregated-note-page {
        max-width: 100%;
        padding: 0;
    }
}
