/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Modern Dashboard Theme */
:root {
    /* Modern color palette - Notion/Linear inspired */
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-tertiary: #eef0f2;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --text-primary: #181818;
    --text-secondary: #505050;
    --text-tertiary: #808080;
    --accent-purple: #7c3aed;
    --accent-purple-light: #a78bfa;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --border-light: #e5e7eb;
    --shadow-sm: rgba(0, 0, 0, 0.05);
    --shadow-md: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* Theme mappings */
    --color-canvas-default: var(--bg-secondary);
    --color-canvas-subtle: var(--bg-primary);
    --color-border-default: var(--border-light);
    --color-border-muted: var(--border-light);
    --color-fg-default: var(--text-primary);
    --color-fg-muted: var(--text-secondary);
    --color-fg-subtle: var(--text-tertiary);
    --color-accent-fg: var(--accent-purple);
    --color-accent-emphasis: var(--accent-purple);
    --color-danger-fg: var(--accent-pink);
    --color-success-fg: var(--accent-green);
    --color-attention-subtle: #fef3c7;
    --color-btn-hover-bg: var(--bg-tertiary);
    --color-btn-active-bg: var(--bg-secondary);
    --color-btn-text: #ffffff;
    --color-header-bg: var(--glass-bg);
    --color-code-bg: var(--bg-tertiary);

    /* Legacy variables for compatibility */
    --primary-color: var(--text-primary);
    --secondary-color: var(--accent-purple);
    --accent-color: var(--accent-pink);
    --background-color: var(--bg-secondary);
    --card-background: var(--bg-primary);
    --text-color: var(--text-primary);
    --text-light: var(--text-secondary);
    --border-color: var(--border-light);
    --code-background: var(--bg-tertiary);
    --tag-background: var(--bg-tertiary);
    --hover-color: var(--accent-purple-light);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #0f0f0f;
        --bg-tertiary: #2a2a2a;
        --glass-bg: rgba(26, 26, 26, 0.7);
        --text-primary: #f0f0f0;
        --text-secondary: #b0b0b0;
        --text-tertiary: #808080;
        --border-light: #333333;
        --shadow-sm: rgba(0, 0, 0, 0.3);
        --shadow-md: rgba(0, 0, 0, 0.4);
        --shadow-lg: rgba(0, 0, 0, 0.5);
    }
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #0f0f0f;
    --bg-tertiary: #2a2a2a;
    --glass-bg: rgba(26, 26, 26, 0.7);
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --border-light: #333333;
    --shadow-sm: rgba(0, 0, 0, 0.3);
    --shadow-md: rgba(0, 0, 0, 0.4);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-tertiary: #eef0f2;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --text-primary: #181818;
    --text-secondary: #505050;
    --text-tertiary: #808080;
    --border-light: #e5e7eb;
    --shadow-sm: rgba(0, 0, 0, 0.05);
    --shadow-md: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--color-fg-default);
    background-color: var(--color-canvas-default);
}

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

/* Header */
.site-header {
    background-color: var(--color-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-default);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-fg-default);
    font-weight: 700;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo svg {
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline-short {
    color: var(--color-fg-muted);
    font-size: 13px;
    padding-left: 16px;
    border-left: 1px solid var(--color-border-default);
}

/* Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--color-fg-default);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background-color: var(--color-btn-hover-bg);
    color: var(--color-accent-fg);
}

.nav-item:active {
    background-color: var(--color-btn-active-bg);
}

/* Theme Toggle Button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    margin-left: 8px;
    background: transparent;
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    color: var(--color-fg-default);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--color-btn-hover-bg);
    border-color: var(--color-fg-muted);
    transform: rotate(180deg);
}

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

/* Main Content */
main {
    padding: 3rem 0;
    min-height: calc(100vh - 280px);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 2rem;
    background: var(--gradient-1);
    color: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.95;
}

/* Examples Grid */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Example Card */
.example-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px var(--shadow-sm);
}

.example-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--shadow-md);
    border-color: var(--accent-purple-light);
}

.example-header h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.example-header h3 a {
    color: var(--text-primary);
    text-decoration: none;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity 0.2s ease;
}

.example-header h3 a:hover {
    opacity: 0.8;
}

.repo-info {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.repo-info a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.repo-info a:hover {
    text-decoration: underline;
}

.example-body {
    margin: 1rem 0;
}

.description {
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.code-location {
    background: var(--gradient-3);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin: 1rem 0;
    font-family: "JetBrains Mono", "Menlo", "Monaco", monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    color: white;
    font-weight: 500;
}

.paper-reference {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border-left: 4px solid var(--accent-purple);
    border-radius: 12px;
}

.paper-reference strong {
    color: var(--text-primary);
    font-weight: 600;
}

.authors {
    display: block;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

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

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: white;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--shadow-sm);
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-md);
}

/* Detail Page */
.breadcrumb {
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.example-detail {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 24px var(--shadow-sm);
}

.detail-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.detail-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.detail-section {
    margin: 2rem 0;
}

.detail-section h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.code-info {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 1.5rem;
    border-radius: 16px;
}

.info-row {
    margin: 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.info-row strong {
    min-width: 100px;
    color: var(--text-light);
    font-weight: 600;
}

.info-row code {
    background-color: var(--bg-primary);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-family: "JetBrains Mono", "Menlo", "Monaco", monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-light);
}

.view-code-btn, .paper-link, .back-link {
    display: inline-block;
    background: var(--gradient-1);
    color: white;
    padding: 0.85rem 1.75rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    box-shadow: 0 4px 16px var(--shadow-md);
}

.view-code-btn:hover, .paper-link:hover, .back-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-lg);
}

.paper-card {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 1.5rem;
    /* border-radius: 16px; */
    /* border: 1px solid var(--border-light); */
}

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

.paper-meta {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.algorithm-tag {
    display: inline-block;
    background: var(--gradient-2);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px var(--shadow-md);
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-404 {
    font-size: 6rem;
    margin: 0 0 1rem 0;
    color: var(--text-tertiary);
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.error-page h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.error-links {
    font-size: 1rem;
    margin-top: 2rem;
}

.error-links a {
    color: var(--accent-purple);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.error-links a:hover {
    color: var(--accent-purple-light);
    text-decoration: underline;
}

/* Footer */
footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--color-border-default);
    padding: 32px 0;
    margin-top: 64px;
    text-align: center;
}

footer p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.footer-newsletter {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border-default);
}

.newsletter-cta {
    color: var(--color-fg-default);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Filter Section */
.filter-section {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px var(--shadow-sm);
}

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

.filter-header strong {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.clear-filter {
    color: var(--accent-purple);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.clear-filter:hover {
    text-decoration: underline;
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag-filter {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tag-filter:hover {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.tag-filter.active {
    background: var(--gradient-1);
    color: white;
    border-color: transparent;
}

/* Examples Count */
.examples-count {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    padding: 2rem 0;
}

.page-link {
    background: var(--gradient-1);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow-md);
}

.page-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-lg);
}

.page-info {
    color: var(--text-primary);
    font-weight: 500;
}

/* Paper References */
.paper-references {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

.paper-references p {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.paper-references pre {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid var(--border-light);
}

.paper-references code {
    font-family: "JetBrains Mono", "Menlo", "Monaco", monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-container {
        padding: 0 16px;
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding-top: 12px;
        padding-bottom: 12px;
        gap: 12px;
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
    }

    .tagline-short {
        display: none;
    }

    .header-nav {
        width: 100%;
        justify-content: flex-start;
        gap: 4px;
    }

    .nav-item {
        padding: 6px 12px;
        font-size: 13px;
    }

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

    .hero h2 {
        font-size: 1.75rem;
    }

    .detail-header h2 {
        font-size: 1.5rem;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    /* 404 Page Mobile */
    .error-404 {
        font-size: 4rem;
    }

    .error-page {
        padding: 2rem 1rem;
    }

    .error-page h2 {
        font-size: 1.5rem;
    }

    .error-page p {
        font-size: 1rem;
    }

    .error-links {
        font-size: 0.95rem;
    }
}

/* Lists */
.entity-list {
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
    overflow: hidden;
}

.entity-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border-default);
    background: var(--color-canvas-default);
    transition: background 0.1s;
}

.entity-item:last-child {
    border-bottom: none;
}

.entity-item:hover {
    background: var(--color-canvas-subtle);
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-default);
}

.page-title {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-fg-default);
}

.page-description {
    margin: 0;
    color: var(--color-fg-muted);
    font-size: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-fg-muted);
    background: var(--color-canvas-default);
    border: 1px solid var(--color-border-default);
    border-radius: 6px;
}

.empty-state p {
    margin: 0.5rem 0;
}
