﻿#content p, #content span, #content .ql-code-block {
    font-size: clamp(1rem, 0.95rem + 0.25vw, 0.938rem) !important;
    font-weight: 400;
    line-height: 2;
}

#content h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    line-height: 1.4;
}

#content h2 {
    font-size: clamp(1.3rem, 3vw, 1.5rem);
    font-weight: 800;
    line-height: 1.5;
}

#content h3 {
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    font-weight: 700;
    line-height: 1.6;
}

#content h4 {
    font-size: clamp(1.063rem, 1.8vw, 1.125rem);
    font-weight: 600;
    line-height: 1.6;
}

#content a {
    text-decoration: underline;
    color: #0081ff;
    cursor: pointer;
}


.ql-editor.dir-rtl {
    direction: rtl !important;
    text-align: right !important;
}

.ql-editor.dir-ltr {
    direction: ltr !important;
    text-align: left !important;
}

/* کلاس‌های direction برای بلاک‌ها */
.ql-direction-rtl {
    direction: rtl !important;
    text-align: right !important;
}

.ql-direction-ltr {
    direction: ltr !important;
    text-align: left !important;
}

blockquote {
    background-color: #f1f1f1;
    padding: 20px 60px;
}

.dark blockquote {
    background-color: #1e2939;
    border: 1px solid #272f3d;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 16px 0;
    text-align: center;
}

th,
td {
    border: 1px solid #99dbfe;
    padding: 8px 5px;
    text-align: center;
    vertical-align: middle;
    word-break: break-word;
    font-size: 16px;
}

th {
    font-weight: bold;
    background-color: #f0f9ff;
}

@media screen and (max-width: 600px) {
    th, td {
        padding: 5px 3px;
        font-size: 12px;
    }
}

#content p {
    direction: ltr
}

.ql-align-right {
    text-align: right !important;
    direction: rtl !important;
}

.ql-align-justify {
    text-align: justify !important;
    direction: rtl;
    text-justify: inter-word;
}

.ql-align-center img {
    display: block;
    margin: 0 auto;
    border-radius: 20px;
}

.ql-align-justify img {
    display: block;
    margin: 0 auto;
    border-radius: 20px;
}

.ql-align-center {
    text-align: center !important;
}

#content ol {
    padding-left: 1.5em;
}

#content ol {
    margin-right: 20px;
}

#content .ql-ui {
    position: absolute;
}

ol li .ql-ui {
    right: -5px;
}

#content li[data-list=bullet] > .ql-ui:before {
    content: '\2022';
}

#content li > .ql-ui:before {
    display: inline-block;
    margin-left: -1.5em;
    margin-right: .3em;
    text-align: right;
    white-space: nowrap;
    width: 1.2em;
}

.ql-code-block-container {
    background-color: #282c34;
    border-radius: 8px;
    margin: 12px 0;
    padding: 12px 0 12px 0;
    direction: ltr;
    text-align: left;
    overflow: hidden;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.hljs-copy-wrapper {
    position: relative;
}

.hljs-copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.hljs-copy-button:hover {
    background: #2d3748;
}

.hljs-copy-button.copied {
    background: #48bb78;
}

    .ql-code-block-container .ql-code-block {
        padding: 2px 16px;
        white-space: pre-wrap;
        word-break: break-word;
        color: #abb2bf;
        font-size: 14px;
        line-height: 1.6;
        unicode-bidi: plaintext;
    }

    /* دراپ&zwnj;داون انتخاب زبان */
    .ql-code-block-container select.ql-ui {
        display: block;
        margin: 0 16px 8px auto;
        background-color: #3a3f4b;
        color: #dcdcdc;
        border: 1px solid #4b5263;
        border-radius: 4px;
        padding: 3px 8px;
        font-size: 12px;
        outline: none;
        cursor: pointer;
    }

        .ql-code-block-container select.ql-ui:hover {
            background-color: #444a58;
        }

.ql-code-block-container {
    overflow-x: auto;
}

    .ql-code-block-container select.ql-ui {
        display: none !important;
    }

#mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 360px;
    height: 100%;
    background: #fff;
    z-index: 9999;
    overflow-y: auto;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.12);
    transition: all .5s;
}

    #mobile-drawer.open {
        right: 0;
    }

#drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

    #drawer-overlay.open {
        opacity: 1;
        pointer-events: all;
    }

@media (max-width: 1023px) {
    #hamburger-btn {
        display: flex;
    }

    .desktop-nav {
        display: none !important;
    }

    .header-nav-col {
        display: none !important;
    }

    .sidebar-col {
        display: none !important;
    }

    .articles-col {
        grid-column: span 8 / span 8 !important;
    }
}

.drawer-submenu {
    padding-right: 16px;
}

    .drawer-submenu.open {
        display: block;
    }

.drawer-menu-item > .drawer-toggle-icon {
    transition: transform 0.25s ease;
}

.drawer-menu-item.open > .drawer-toggle-icon {
    transform: rotate(180deg);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #2b39be;
    border-radius: 10px;
}

.ql-code-block[data-language="python"] {
    direction: ltr !important;
}

/*-------------------toc-------------------*/
html {
    scroll-behavior: smooth;
}

#content h1,
#content h2,
#content h3,
#content h4,
#content h5,
#content h6 {
    scroll-margin-top: 90px; /* ارتفاع هدر ثابت سایتت رو اینجا لحاظ کن */
}

.toc-link.active {
    color: #2b39be;
    font-weight: 700;
    background-color: #E9EBFF;
}

.dark .toc-link.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}


/* اسکرول‌بار باریک و شیک برای لیست TOC */
.toc-scroll::-webkit-scrollbar {
    width: 5px;
}

.toc-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.toc-scroll::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 10px;
}

.dark .toc-scroll::-webkit-scrollbar-thumb {
    background-color: #4b5563;
}