/* Notion-like styles for HTML documentation */

/* Content container with sidebar */
.content-container {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar TOC - BACK TO LEFT SIDE */
.sidebar-toc {
    width: 300px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: calc(var(--header-height) + 3px);
    left: 0;
    height: calc(100vh - var(--header-height) - 3px);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 900;
    padding: 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-toc.active {
    transform: translateX(0);
}

/* BETTER TOC Header with hamburger-style toggle */
.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.toc-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Hamburger-style toggle button */
.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    position: relative;
}

.toc-toggle:hover {
    background: var(--border-color);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.toc-toggle.collapsed .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.toc-toggle.collapsed .hamburger-line:nth-child(2) {
    opacity: 0;
}

.toc-toggle.collapsed .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* TOC Content */
.toc-content {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100vh - var(--header-height) - 100px);
}

.toc-nav {
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.toc-nav.collapsed {
    display: none;
}

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

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

.toc-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 400;
}

.toc-nav a:hover {
    background: var(--background-color);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
}

.toc-nav a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

/* Nested TOC items */
.toc-nav .toc-level-2 {
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

.toc-nav .toc-level-3 {
    padding-left: 2.5rem;
    font-size: 0.8rem;
}

.toc-nav .toc-level-4 {
    padding-left: 3.5rem;
    font-size: 0.75rem;
}

/* Main content adjustments */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    transition: margin-left 0.3s ease;
}

.content-container.with-sidebar .main-content {
    margin-left: 300px;
}

/* Better TOC toggle button for mobile */
.toc-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 5rem;
    left: 1rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toc-mobile-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.toc-mobile-toggle svg {
    transition: transform 0.3s ease;
}

.toc-mobile-toggle.active svg {
    transform: rotate(180deg);
}

/* MUCH BIGGER MERMAID ZOOM MODAL */
.mermaid-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mermaid-modal.active {
    opacity: 1;
    visibility: visible;
}

.mermaid-modal-content {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 1rem;
    padding: 1.5rem;
    width: 98vw;
    height: 98vh;
    max-width: none;
    max-height: none;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
}

.mermaid-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.mermaid-modal-title {
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.mermaid-modal-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.mermaid-control-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 0.9rem;
}

.mermaid-control-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.05);
}

.mermaid-modal-diagram {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: grab;
}

.mermaid-modal-diagram:active {
    cursor: grabbing;
}

.mermaid-modal-diagram .mermaid {
    transform-origin: center;
    transition: transform 0.3s ease;
    cursor: grab;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
}

.mermaid-modal-diagram .mermaid:active {
    cursor: grabbing;
}

/* Zoom level indicator */
.zoom-indicator {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-indicator.visible {
    opacity: 1;
}

/* Notion-style content */
.notion-content {
    font-family: "Inter", sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
}

/* MUCH BETTER CODE BLOCKS */
.notion-content pre {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    padding: 1.5rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #334155;
    font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.notion-content pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    display: block;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
}

/* Language labels for code blocks */
.notion-content pre::after {
    content: attr(data-lang);
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: rgba(59, 130, 246, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Specific language styling */
.notion-content pre.language-java::after {
    content: "Java";
    background: rgba(245, 101, 101, 0.2);
    border-color: rgba(245, 101, 101, 0.3);
}

.notion-content pre.language-jsp::after {
    content: "JSP";
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.3);
}

.notion-content pre.language-javascript::after {
    content: "JavaScript";
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.3);
}

.notion-content pre.language-html::after {
    content: "HTML";
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
}

.notion-content pre.language-css::after {
    content: "CSS";
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.notion-content pre.language-xml::after {
    content: "XML";
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
}

.notion-content pre.language-sql::after {
    content: "SQL";
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.3);
}

.notion-content pre.language-flow::after {
    content: "Flow";
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.3);
}

/* Enhanced Java token colors */
.notion-content .language-java .token.class-name {
    color: #34d399 !important;
    font-weight: 600;
}

.notion-content .language-java .token.keyword {
    color: #a78bfa !important;
    font-weight: 600;
}

.notion-content .language-java .token.string {
    color: #60a5fa !important;
}

.notion-content .language-java .token.comment {
    color: #94a3b8 !important;
    font-style: italic;
}

.notion-content .language-java .token.annotation {
    color: #fbbf24 !important;
    font-weight: 600;
}

.notion-content .language-java .token.number {
    color: #fb7185 !important;
    font-weight: 500;
}

.notion-content .language-java .token.operator {
    color: #f59e0b !important;
    font-weight: 500;
}

.notion-content .language-java .token.punctuation {
    color: #e2e8f0 !important;
}

.notion-content .language-java .token.function {
    color: #06d6a0 !important;
    font-weight: 500;
}

/* Enhanced JSP token colors */
.notion-content .language-jsp .token.tag {
    color: #f97316 !important;
    font-weight: 600;
}

.notion-content .language-jsp .token.attr-name {
    color: #06d6a0 !important;
    font-weight: 500;
}

.notion-content .language-jsp .token.attr-value {
    color: #60a5fa !important;
}

.notion-content .language-jsp .token.jsp-directive {
    color: #8b5cf6 !important;
    font-weight: 600;
}

.notion-content .language-jsp .token.jsp-expression {
    color: #06d6a0 !important;
}

/* Inline code */
.notion-content code:not(pre code) {
    background: var(--background-color);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

/* Enhanced Mermaid styling */
.notion-content .mermaid {
    background: linear-gradient(135deg, #1e293b, #334155) !important;
    padding: 2rem;
    border-radius: 0.75rem;
    margin: 2rem 0;
    border: 1px solid #334155;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.notion-content .mermaid::before {
    content: "🔍 Click to zoom";
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(59, 130, 246, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.notion-content .mermaid:hover::before {
    opacity: 1;
}

.notion-content .mermaid:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

/* Rest of the styles remain the same... */
/* Notion-style headings */
.notion-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 2rem 0 1.5rem 0;
    color: var(--text-primary);
    border-bottom: none;
    padding-bottom: 0;
}

.notion-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
}

.notion-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
}

.notion-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
    color: var(--text-primary);
}

.notion-content h5 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.notion-content h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
    color: var(--text-primary);
}

/* Notion-style paragraphs */
.notion-content p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Notion-style lists */
.notion-content ul,
.notion-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.notion-content li {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Notion-style tables */
.notion-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--surface-color);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.notion-content table th {
    background: var(--background-color);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.notion-content table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.notion-content table tr:hover {
    background: var(--background-color);
}

/* Responsive design */
@media (max-width: 1024px) {
    .sidebar-toc {
        width: 280px;
    }
    
    .content-container.with-sidebar .main-content {
        margin-left: 280px;
    }
}

@media (max-width: 768px) {
    .sidebar-toc {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .content-container.with-sidebar .main-content {
        margin-left: 0;
    }
    
    .toc-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .mermaid-modal-content {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        padding: 1rem;
    }
    
    .mermaid-modal-title {
        font-size: 1.1rem;
    }
    
    .mermaid-control-btn {
        width: 40px;
        height: 40px;
        padding: 0.5rem;
    }
}