:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --secondary-bg: #f3f4f6;
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --code-bg: #1e1e1e;
    --border-color: rgba(0,0,0,0.08);
    --gradient-bg: radial-gradient(circle at top right, #f5f7fa 0%, #eef2f3 100%);
    
    --book-bg: hsl(223, 10%, 90%);
    --book-fg: hsl(223, 10%, 10%);
}

[data-theme="dark"] {
    --bg-color: #050505;
    --text-color: #e2e8f0;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --secondary-bg: #111111;
    --sidebar-bg: rgba(10, 10, 10, 0.85);
    --code-bg: #0d1117;
    --border-color: rgba(255,255,255,0.08);
    --gradient-bg: radial-gradient(circle at top right, #0f172a 0%, #020617 100%);

    --book-bg: hsl(223, 10%, 30%);
    --book-fg: hsl(223, 10%, 90%);
}

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

body {
    font-family: 'Inter', sans-serif;
    background: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
    overflow: hidden;
    transition: color 0.3s, background 0.3s;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-nav {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    background: var(--sidebar-bg);
    z-index: 100;
}

.nav-left { display: flex; align-items: center; gap: 1rem; }
.logo-text { font-size: 1.5rem; font-weight: 800; color: var(--accent-color); text-decoration: none; display: flex; align-items: center; gap: 5px; }

.switch { font-size: 14px; position: relative; display: inline-block; width: 4em; height: 2.2em; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #2a2a2a; transition: .4s; border-radius: 30px; overflow: hidden; box-shadow: inset 0 2px 5px rgba(0,0,0,0.4); }
.slider:before { position: absolute; content: ""; height: 1.2em; width: 1.2em; border-radius: 50%; left: 0.5em; bottom: 0.5em; transition: .4s; box-shadow: inset 8px -4px 0px 0px #fff; }
.switch input:checked + .slider { background-color: #3b82f6; }
.switch input:checked + .slider:before { transform: translateX(1.8em); box-shadow: inset 15px -4px 0px 15px #ffcf48; }
.star { background-color: #fff; border-radius: 50%; position: absolute; width: 5px; height: 5px; opacity: 1; transition: 0.4s; }
.star_1 { left: 2.5em; top: 0.5em; } .star_2 { left: 2.2em; top: 1.2em; } .star_3 { left: 3em; top: 0.9em; }
.switch input:checked ~ .slider .star { opacity: 0; }
.cloud { width: 3.5em; position: absolute; bottom: -1.4em; left: -1.1em; opacity: 0; transition: .4s; }
.switch input:checked ~ .slider .cloud { opacity: 1; }

.docs-container { display: flex; flex: 1; overflow: hidden; }

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 2rem 1rem;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.sidebar-header { margin-bottom: 2rem; display: flex; justify-content: center; }
.interactive-logo { cursor: move; width: 120px; height: 120px; }

.menu-section { margin-bottom: 2rem; }
.menu-title {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1.2px;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 1rem;
    padding-left: 1rem;
    font-weight: 800;
}

.menu-link {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.8;
    margin-bottom: 4px;
    border: 1px solid transparent;
}

.menu-link:hover { background: var(--secondary-bg); opacity: 1; color: var(--accent-color); transform: translateX(4px); }
.menu-link.active { background: rgba(37, 99, 235, 0.1); color: var(--accent-color); font-weight: 600; opacity: 1; border-color: rgba(37, 99, 235, 0.2); }

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scroll-behavior: smooth;
    position: relative;
}

.markdown-body {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 10%;
    min-height: calc(100vh - 150px);
}

.markdown-body h1 { font-size: 3rem; margin-bottom: 1.5rem; line-height: 1.2; letter-spacing: -1px; background: linear-gradient(to right, var(--text-color), var(--accent-color)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.markdown-body h2 { font-size: 2rem; margin-top: 3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.markdown-body h3 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 1rem; color: var(--accent-color); }
.markdown-body p { margin-bottom: 1.2rem; font-size: 1.05rem; line-height: 1.7; opacity: 0.9; }
.markdown-body ul, .markdown-body ol { margin-bottom: 1.5rem; padding-left: 2rem; }
.markdown-body li { margin-bottom: 0.5rem; }
.markdown-body blockquote { border-left: 4px solid var(--accent-color); background: var(--secondary-bg); padding: 1rem 1.5rem; margin: 2rem 0; border-radius: 0 12px 12px 0; font-style: italic; }
.markdown-body a { color: var(--accent-color); text-decoration: none; border-bottom: 1px dashed var(--accent-color); transition: 0.2s; }
.markdown-body a:hover { border-bottom-style: solid; color: var(--accent-hover); }
.markdown-body hr { border: 0; height: 1px; background: var(--border-color); margin: 3rem 0; }
.markdown-body img { max-width: 100%; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.code-container {
    position: relative;
    background: var(--code-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin: 1.5rem 0;
    overflow: hidden;
}

.markdown-body pre {
    background: transparent !important;
    padding: 1.5rem;
    margin: 0;
    overflow-x: auto;
    border: none;
    box-shadow: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #abb2bf;
    line-height: 1.5;
}

.markdown-body code { 
    font-family: 'JetBrains Mono', monospace; 
}

.markdown-body p code, .markdown-body li code {
    background: rgba(128,128,128,0.15);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--accent-color);
}

.comment { color: #5c6370; font-style: italic; }
.string { color: #98c379; }
.keyword { color: #c678dd; font-weight: bold; }
.command { color: #61afef; }
.bracket { color: #e06c75; }
.escape { color: #56b6c2; }

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    z-index: 10;
}

.code-container:hover .copy-btn {
    opacity: 1;
}

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

.fade-in { animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

footer { text-align: center; padding: 2rem; border-top: 1px solid var(--border-color); color: gray; font-size: 0.9rem; margin-top: auto; }

#mobile-menu-btn { display: none; background: none; border: none; color: var(--text-color); cursor: pointer; padding: 0.5rem; }

@media (max-width: 768px) {
    #mobile-menu-btn { display: block; }
    .sidebar { position: fixed; left: -100%; top: 70px; bottom: 0; z-index: 99; width: 100%; box-shadow: 0 0 20px rgba(0,0,0,0.2); }
    .sidebar.open { left: 0; }
    .content-area { padding: 0; }
    .markdown-body { padding: 2rem 5%; }
    .markdown-body h1 { font-size: 2.2rem; }
}

.loader-wrapper { display: flex; justify-content: center; align-items: center; min-height: 60vh; width: 100%; }
.book { animation: cover 5s ease-in-out infinite; background-color: hsl(268, 90%, 65%); border-radius: 0.25em; box-shadow: 0 0.25em 0.5em hsla(0, 0%, 0%, 0.3), 0 0 0 0.25em hsl(278, 100%, 57%) inset; padding: 0.25em; perspective: 37.5em; position: relative; width: 8em; height: 6em; transform: translate3d(0, 0, 0); transform-style: preserve-3d; }
.book__pg-shadow, .book__pg { animation: cover 5s ease-in-out infinite; position: absolute; left: 0.25em; width: calc(50% - 0.25em); }
.book__pg-shadow { animation-name: shadow; background-image: linear-gradient(-45deg, hsla(0, 0%, 0%, 0) 50%, hsla(0, 0%, 0%, 0.3) 50%); filter: blur(0.25em); top: calc(100% - 0.25em); height: 3.75em; transform: scaleY(0); transform-origin: 100% 0%; }
.book__pg { animation-name: pg1; background-color: hsl(223, 10%, 100%); background-image: linear-gradient(90deg, hsla(223, 10%, 90%, 0) 87.5%, hsl(223, 10%, 90%)); height: calc(100% - 0.5em); transform-origin: 100% 50%; }
.book__pg--2, .book__pg--3, .book__pg--4 { background-image: repeating-linear-gradient(hsl(223, 10%, 10%) 0 0.125em, hsla(223, 10%, 10%, 0) 0.125em 0.5em), linear-gradient(90deg, hsla(223, 10%, 90%, 0) 87.5%, hsl(223, 10%, 90%)); background-repeat: no-repeat; background-position: center; background-size: 2.5em 4.125em, 100% 100%; }
.book__pg--2 { animation-name: pg2; }
.book__pg--3 { animation-name: pg3; }
.book__pg--4 { animation-name: pg4; }
@keyframes cover { from, 5%, 45%, 55%, 95%, to { animation-timing-function: ease-out; background-color: hsl(278, 84%, 67%); } 10%, 40%, 60%, 90% { animation-timing-function: ease-in; background-color: hsl(271, 90%, 45%); } }
@keyframes shadow { from, 10.01%, 20.01%, 30.01%, 40.01% { animation-timing-function: ease-in; transform: translate3d(0, 0, 1px) scaleY(0) rotateY(0); } 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { animation-timing-function: ease-out; transform: translate3d(0, 0, 1px) scaleY(0.2) rotateY(90deg); } 10%, 20%, 30%, 40%, 50%, to { animation-timing-function: ease-out; transform: translate3d(0, 0, 1px) scaleY(0) rotateY(180deg); } 50.01%, 60.01%, 70.01%, 80.01%, 90.01% { animation-timing-function: ease-in; transform: translate3d(0, 0, 1px) scaleY(0) rotateY(180deg); } 60%, 70%, 80%, 90%, to { animation-timing-function: ease-out; transform: translate3d(0, 0, 1px) scaleY(0) rotateY(0); } }
@keyframes pg1 { from, to { animation-timing-function: ease-in-out; background-color: hsl(223, 10%, 100%); transform: translate3d(0, 0, 1px) rotateY(0.4deg); } 10%, 15% { animation-timing-function: ease-out; background-color: hsl(223, 10%, 100%); transform: translate3d(0, 0, 1px) rotateY(180deg); } 20%, 80% { animation-timing-function: ease-in; background-color: hsl(223, 10%, 45%); transform: translate3d(0, 0, 1px) rotateY(180deg); } 85%, 90% { animation-timing-function: ease-in-out; background-color: hsl(223, 10%, 100%); transform: translate3d(0, 0, 1px) rotateY(180deg); } }
@keyframes pg2 { from, to { animation-timing-function: ease-in; background-color: hsl(223, 10%, 45%); transform: translate3d(0, 0, 1px) rotateY(0.3deg); } 90%, 95% { animation-timing-function: ease-out; background-color: hsl(223, 10%, 100%); transform: translate3d(0, 0, 1px) rotateY(0.3deg); } }
@keyframes pg3 { from, 10%, 90%, to { animation-timing-function: ease-in; background-color: hsl(223, 10%, 45%); transform: translate3d(0, 0, 1px) rotateY(0.2deg); } }
@keyframes pg4 { from, 20%, 80%, to { animation-timing-function: ease-in; background-color: hsl(223, 10%, 45%); transform: translate3d(0, 0, 1px) rotateY(0.1deg); } }
