:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f7;
    --bg-sidebar: #fafafa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --accent-color: #f74c00;
    --accent-hover: #d64000;
    --link-color: #0066cc;
    --link-hover: #0052a3;
    --code-bg: #f5f5f5;
    --code-border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --sidebar-width: 280px;
    --header-height: 60px;
}

[data-theme="dark"] {
    --bg-primary: #282c34;
    --bg-secondary: #21252b;
    --bg-sidebar: #2c313c;
    --text-primary: #abb2bf;
    --text-secondary: #828997;
    --text-muted: #5c6370;
    --border-color: #3e4451;
    --accent-color: #e06c75;
    --accent-hover: #ff8787;
    --link-color: #61afef;
    --link-hover: #528bcc;
    --code-bg: #21252b;
    --code-border: #3e4451;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-sidebar);
    z-index: 10;
}

.book-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.book-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
}

.nav-list {
    list-style: none;
}

.nav-item {
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-secondary);
}

.nav-item.active {
    background-color: var(--bg-secondary);
    border-left-color: var(--accent-color);
}

.nav-item a {
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    line-height: 1.5;
}

.nav-item.active a {
    color: var(--accent-color);
    font-weight: 500;
}

.nav-item.loading {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.nav-category {
    padding: 0.75rem 1.5rem 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.nav-category:first-of-type {
    border-top: none;
    margin-top: 0;
}

.nav-category-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
}

.nav-sub-item {
    padding-left: 2.5rem;
    font-size: 0.85rem;
}

.nav-sub-item a {
    color: var(--text-secondary);
}

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

.nav-sub-item.active a {
    color: var(--accent-color);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background-color: var(--bg-sidebar);
}

.github-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.github-link:hover {
    color: var(--link-color);
}

/* Main Content Styles */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.content-header {
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mobile-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
}

.mobile-sidebar-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(247, 76, 0, 0.1);
}

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

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.theme-toggle:hover {
    background-color: var(--bg-primary);
    border-color: var(--accent-color);
}

.theme-icon {
    width: 20px;
    height: 20px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-icon.moon-icon {
    display: none;
}

[data-theme="dark"] .theme-icon.sun-icon {
    display: none;
}

[data-theme="dark"] .theme-icon.moon-icon {
    display: block;
}

.article {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Welcome Screen */
.welcome-screen {
    text-align: center;
    padding: 3rem 1rem;
}

.welcome-screen h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.intro-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.intro-text a {
    color: var(--link-color);
    text-decoration: none;
}

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

.motivation-section {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: left;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.motivation-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.motivation-content {
    line-height: 1.8;
}

.motivation-content p {
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    font-size: 1rem;
}

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

.author-section {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: left;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.author-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.author-content {
    line-height: 1.8;
}

.author-content p {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.author-content strong {
    color: var(--accent-color);
    font-weight: 600;
}

.loading-status {
    color: var(--text-muted);
    font-style: italic;
}

/* FRP Content Styles */
.frp-content {
    animation: fadeIn 0.3s ease;
}

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

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

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

.frp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.frp-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.status-active {
    background-color: #e6f7e6;
    color: #2d7a2d;
}

.status-badge.status-completed {
    background-color: #e6f0ff;
    color: #1a5fb3;
}

.status-badge.status-stagnant {
    background-color: #f5f5f5;
    color: #666666;
}

[data-theme="dark"] .status-badge.status-active {
    background-color: #2d4a2d;
    color: #98c379;
}

[data-theme="dark"] .status-badge.status-completed {
    background-color: #1a2f4a;
    color: #61afef;
}

[data-theme="dark"] .status-badge.status-stagnant {
    background-color: #3e4451;
    color: #828997;
}

.frp-body {
    line-height: 1.8;
}

.frp-body h1,
.frp-body h2,
.frp-body h3,
.frp-body h4,
.frp-body h5,
.frp-body h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.frp-body h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.frp-body h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.frp-body h3 {
    font-size: 1.25rem;
}

.frp-body p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.frp-body ul,
.frp-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.frp-body li {
    margin-bottom: 0.5rem;
}

.frp-body code {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--accent-color);
}

[data-theme="dark"] .frp-body code {
    color: #e06c75;
}

[data-theme="dark"] .frp-body pre {
    background-color: #21252b;
    border-color: #3e4451;
}

[data-theme="dark"] .frp-body pre code {
    color: #abb2bf;
}

.frp-body pre {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.frp-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

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

.frp-body a {
    color: var(--link-color);
    text-decoration: none;
}

.frp-body a:hover {
    text-decoration: underline;
}

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

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

.frp-body th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.frp-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1rem 0;
}

/* Error State */
.error-message {
    padding: 2rem;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    color: #c33;
    margin: 2rem 0;
}

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

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
    }

    .mobile-sidebar-toggle {
        display: flex;
    }

    .sidebar-toggle {
        display: flex;
    }

    .article {
        padding: 1.5rem 1rem;
    }

    .welcome-screen h1 {
        font-size: 2rem;
    }


    .content-header {
        padding: 1rem;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb,
[data-theme="dark"] .sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

