:root {
    /* GitBook Color Palette */
    --bg-sidebar: #f5f7f9;
    --bg-content: #ffffff;
    --border-color: #e6ecf1;
    --text-primary: #242a31;
    --text-secondary: #7f8fa4;
    /* Lighter text for metadata/descriptions */
    --link-color: #5c6975;
    --link-hover: #3884ff;
    /* GitBook Blue Hover */
    --accent-color: #3884ff;
    /* Primary Blue */
    --hover-bg: #e6ecf1;

    --sidebar-width: 300px;
    /* Slightly wider for better readability */

    /* Typography - Clean Sans-Serif Stack */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    --font-mono: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-content);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    position: sticky;
    top: 0;
    background: var(--bg-sidebar);
    z-index: 10;
    border-bottom: 1px solid transparent;
    /* Cleaner look without hard line */
}

/* Search Input Styling (Visual Only) */
.search-container {
    position: relative;
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #e6ecf1;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent-color);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9daab6;
    font-size: 14px;
}

.sidebar-title-link {
    display: block;
    margin-top: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.sidebar-content {
    padding: 0 0 20px 0;
}

/* TOC List */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.toc-link {
    display: block;
    padding: 10px 20px 10px 20px;
    color: var(--link-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.1s, background-color 0.1s, border-color 0.1s;
    border-right: 1px solid transparent;
    /* Right border highlight style also popular, or bg change */
}

.toc-link:hover {
    color: var(--text-primary);
    background-color: #fff;
    /* White highlight on hover */
    /* border-right: 3px solid var(--accent-color); Optional accent */
}

/* H1 Headers in TOC */
.toc-h1>.toc-link {
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 5px;
    text-transform: none;
    /* GitBook keeps it natural casing usually */
    font-size: 15px;
}

/* Sublist items (H2) */
.toc-sublist .toc-link {
    padding-left: 35px;
    font-size: 14px;
    color: #5c6975;
}

.toc-sublist .toc-link:hover {
    color: var(--text-primary);
}


/* Main Content */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--bg-content);
    position: relative;
    scroll-behavior: smooth;
}

.content-wrapper {
    max-width: 960px;
    /* Wider content area */
    margin: 0 auto;
    padding: 50px 60px;
}

/* Markdown Content Typography */
.markdown-body {
    line-height: 1.7;
    font-family: var(--font-sans);
    font-size: 16px;
    color: var(--text-primary);
}

.markdown-body h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 0.5em;
    padding-bottom: 0;
    border-bottom: none;
    letter-spacing: -0.01em;
    color: #242a31;
}

.markdown-body h1:first-child {
    margin-top: 0;
}

.markdown-body h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2.5em;
    /* More breathing room */
    margin-bottom: 0.75em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
    color: #242a31;
}

.markdown-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 0.5em;
    color: #242a31;
}

.markdown-body p {
    margin-bottom: 1.5em;
    color: #3b454e;
    /* Slightly softer than pure black */
}

/* Lists */
.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
    margin-bottom: 1.5em;
    color: #3b454e;
}

.markdown-body li {
    margin-bottom: 0.5em;
}

/* Blockquotes / Callouts */
.markdown-body blockquote {
    color: #5c6975;
    background: #f5f7f9;
    border-left: 4px solid var(--accent-color);
    margin: 1.5em 0;
    padding: 15px 20px;
    border-radius: 0 3px 3px 0;
}

.markdown-body blockquote p {
    margin-bottom: 0;
    /* Remove bottom margin for p inside quote */
}

/* Code Blocks */
.markdown-body pre {
    background-color: #f5f7f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.markdown-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 5px;
    background-color: rgba(38, 42, 49, 0.05);
    /* Light gray for inline */
    color: #e04e54;
    /* Reddish for code */
    border-radius: 3px;
}

.markdown-body pre code {
    background-color: transparent;
    color: var(--text-primary);
    padding: 0;
}

/* Tables */
.markdown-body table {
    width: 100%;
    margin: 2em 0;
    border-collapse: collapse;
    overflow-x: hidden;
    /* Changed from auto to hide standard scrollbar if feasible, or use wrapper */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    border-style: hidden;
    /* hide standard border to rely on shadow/radius if needed, but standard is fine */
    box-shadow: 0 0 0 1px var(--border-color);
    /* rounded border trick */
    border-radius: 5px;
}

.markdown-body th,
.markdown-body td {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-body th {
    background-color: #fafbfc;
    font-weight: 600;
    color: var(--text-primary);
}

.markdown-body tr:nth-child(even) {
    background-color: #ffffff;
    /* GitBook usually white tables, clean lines */
}

.markdown-body tr:hover {
    background-color: #f6f8fa;
}

/* Links */
.markdown-body a {
    color: var(--accent-color);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

/* Mobile Header */
.mobile-header {
    display: none;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    padding: 0 20px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
    justify-content: space-between;
}

.mobile-menu-btn {
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
}

/* Responsive */
@media screen and (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        /* Standard mobile hidden */
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 100%;
        z-index: 100;
        border-right: none;
    }

    .sidebar.open {
        display: flex;
        /* Show when toggled */
    }

    .mobile-header {
        display: flex;
        /* Show on mobile */
    }

    .content-wrapper {
        padding: 30px 20px;
    }
}

/* Custom Styles for Spanish Tutorial */
/* LaTeX Math Styling */
.latex-math {
    font-family: 'Times New Roman', Times, serif;
    font-style: italic;
    font-size: 1.1em;
}

.latex-math sup {
    font-style: normal;
    font-size: 0.8em;
}

/* Example styling - Clean and Professional */
.es-example {
    color: #2b6cb0;
    /* Strong Blue */
    font-weight: 600;
}

.en-translation {
    color: #7f8fa4;
    /* Muted Slate */
    font-style: italic;
    font-family: var(--font-sans);
}