/* Cheatsheets Page Styles */

.cheatsheets-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Override terminal window margins for cheatsheets page */
.cheatsheets-wrapper .terminal-window {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Header specific styling */
.cheatsheets-wrapper header.terminal-window {
    width: 100%;
}

@media (min-width: 768px) {
    .cheatsheets-wrapper {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .cheatsheets-wrapper {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .cheatsheets-wrapper {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

/* Main Container */
.cheatsheets-container {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    align-items: flex-start;
    width: 100%;
}

/* Sidebar */
.sidebar-terminal {
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    margin-left: 0rem;
}

.sidebar-terminal .terminal-window {
    margin: 0;
    height: 120%;
    display: flex;
    flex-direction: column;
}

.sidebar-inner {
    overflow-y: auto;
    flex: 1;
    padding: 1rem !important;
}

.sidebar-section {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 204, 51, 0.1);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-category {
    padding: 8px 12px;
    margin-bottom: 2px;
}

.category-title {
    color: var(--terminal-text);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--matrix-green);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 400;
    gap: 10px;
    border-radius: 4px;
    margin: 2px 0;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-item:hover {
    background-color: rgba(0, 204, 51, 0.08);
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--glow-color);
    border-left: 2px solid var(--matrix-green);
}

.sidebar-item.active-item {
    color: var(--neon-green);
    background-color: rgba(0, 255, 65, 0.1);
    font-weight: 500;
    text-shadow: 0 0 5px var(--glow-color);
    border-left: 3px solid var(--neon-green);
}

.sidebar-item.expandable {
    user-select: none;
}

.sidebar-item.expandable .toggle-icon {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.sidebar-item.expandable.expanded .toggle-icon {
    transform: rotate(90deg);
}

.sidebar-item.expandable:not(.expanded) .toggle-icon {
    transform: rotate(0deg);
}

.item-icon {
    color: var(--matrix-green);
    font-size: 14px;
    min-width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.post-count-badge {
    font-size: 10px;
    padding: 2px 6px;
    background-color: rgba(0, 204, 51, 0.1);
    border-radius: 8px;
    opacity: 0.7;
    margin-left: auto;
    font-weight: 500;
}

.sidebar-item:hover .post-count-badge {
    opacity: 1;
    background-color: rgba(0, 204, 51, 0.15);
}

.sidebar-subsection {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.sidebar-subsection.expanded {
    max-height: 2000px;
    opacity: 1;
}

.sidebar-item.sub-item {
    padding-left: 40px;
    font-size: 13px;
}

.sidebar-footer {
    margin-top: 40px;
    padding: 20px;
    border-top: 1px solid rgba(0, 204, 51, 0.2);
}

.gitbook-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: rgba(0, 204, 51, 0.1);
    border: 1px solid var(--matrix-green);
    border-radius: 4px;
    color: var(--matrix-green);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gitbook-button:hover {
    background-color: rgba(0, 255, 65, 0.2);
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 10px var(--glow-color);
}

.gitbook-icon {
    font-size: 14px;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.main-content .terminal-window {
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.content-wrapper {
    padding: 0;
    max-width: 100%;
    width: 100%;
}

/* Right Sidebar - Table of Contents */
.toc-sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
}

.toc-sidebar .terminal-window {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.toc-inner {
    overflow-y: auto;
    flex: 1;
    padding: 1rem !important;
}

#table-of-contents {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    display: block;
    padding: 6px 12px;
    color: var(--matrix-green);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    margin-left: 0;
}

.toc-item:hover {
    color: var(--neon-green);
    background-color: rgba(0, 204, 51, 0.1);
    border-left-color: var(--matrix-green);
    text-shadow: 0 0 5px var(--glow-color);
}

.toc-item.active {
    color: var(--neon-green);
    border-left-color: var(--neon-green);
    background-color: rgba(0, 255, 65, 0.1);
    font-weight: 500;
    text-shadow: 0 0 5px var(--glow-color);
}

.toc-item-h1 {
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
    margin-bottom: 4px;
}

.toc-item-h2 {
    padding-left: 12px;
    margin-top: 4px;
}

.toc-item-h3 {
    padding-left: 24px;
    font-size: 12px;
    margin-top: 2px;
}

.toc-item-h4 {
    padding-left: 36px;
    font-size: 11px;
    margin-top: 2px;
}

.toc-item-h5 {
    padding-left: 48px;
    font-size: 11px;
    margin-top: 2px;
}

.toc-item-h6 {
    padding-left: 60px;
    font-size: 10px;
    margin-top: 2px;
}

.toc-section-title {
    color: var(--terminal-text);
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 204, 51, 0.2);
}

/* Scrollbar for TOC */
.toc-inner::-webkit-scrollbar {
    width: 8px;
}

.toc-inner::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.toc-inner::-webkit-scrollbar-thumb {
    background: var(--matrix-green);
    border-radius: 4px;
}

.toc-inner::-webkit-scrollbar-thumb:hover {
    background: var(--neon-green);
}

.content-intro p {
    line-height: 1.6;
}

.content-list {
    list-style: none;
    padding: 0;
}

.content-list li {
    line-height: 1.8;
    padding-left: 0;
}

.content-signature {
    margin-top: 2rem;
    padding-top: 1.5rem;
}

/* Heading styles in main content */
#main-content h1,
#main-content h2,
#main-content h3,
#main-content h4,
#main-content h5,
#main-content h6 {
    scroll-margin-top: 1rem;
}

#main-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#main-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

#main-content h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

#main-content h5,
#main-content h6 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Scrollbar for Sidebar */
.sidebar-inner::-webkit-scrollbar {
    width: 6px;
}

.sidebar-inner::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-inner::-webkit-scrollbar-thumb {
    background: rgba(0, 204, 51, 0.3);
    border-radius: 3px;
}

.sidebar-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 204, 51, 0.5);
}

/* Responsive Design */
@media (max-width: 1280px) {
    .toc-sidebar {
        display: none;
    }
}

@media (max-width: 1024px) {
    .cheatsheets-container {
        flex-direction: column;
    }

    .sidebar-terminal {
        width: 100%;
        position: relative;
        top: 0;
        max-height: 400px;
    }

    .sidebar-terminal .terminal-window {
        height: auto;
        max-height: 400px;
    }

    .toc-sidebar {
        display: none;
    }
}

@media (max-width: 500px) {
    .cheatsheets-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .sidebar-item {
        font-size: 12px;
        padding: 6px 10px;
    }

    .category-title {
        font-size: 11px;
    }
}

/* Yellow Theme Support */
.theme-yellow .sidebar-item {
    color: var(--matrix-yellow);
    border-left: 3px solid transparent;
}

.theme-yellow .sidebar-item:hover {
    background-color: rgba(255, 193, 7, 0.08);
    color: var(--neon-yellow);
    text-shadow: 0 0 5px var(--glow-color-yellow);
    border-left: 2px solid var(--terminal-border-yellow);
}

.theme-yellow .sidebar-item.active-item {
    color: var(--neon-yellow);
    background-color: rgba(255, 193, 7, 0.1);
    text-shadow: 0 0 5px var(--glow-color-yellow);
    border-left: 3px solid var(--neon-yellow);
}

.theme-yellow .item-icon {
    color: var(--matrix-yellow);
}

.theme-yellow .gitbook-button {
    background-color: rgba(255, 193, 7, 0.1);
    border-color: var(--terminal-border-yellow);
    color: var(--matrix-yellow);
}

.theme-yellow .gitbook-button:hover {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    box-shadow: 0 0 10px var(--glow-color-yellow);
}
