:root {
    --primary-color: #2563eb;
    --primary-light: #eff6ff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --sidebar-width: 400px;
    --toc-width: 300px;
    --header-height: 60px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout Wrapper */
.wp-doc-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    width: 100%;
}

/* Left Sidebar */
.wp-doc-sidebar {
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 2rem 1.5rem;
    z-index: 10;
}

.wp-doc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.wp-doc-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* Sidebar Search */
.sidebar-search {
    position: relative;
    margin-bottom: 2rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-body);
    transition: var(--transition);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sidebar-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    display: block;
}

.sidebar-nav-group {
    margin-bottom: 5px;
}

.sidebar-nav-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.sidebar-nav-header:hover {
    color: var(--primary-color);
}

.btn-view-category {
    margin-left: 0.5rem;
    color: var(--text-muted);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.sidebar-nav-header:hover .btn-view-category {
    opacity: 1;
}

.btn-view-category:hover {
    color: var(--primary-color);
}

.sidebar-nav-header::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: var(--transition);
}

.sidebar-nav-group.is-active .sidebar-nav-header::after {
    transform: rotate(180deg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
}

.sidebar-nav-header i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.sidebar-nav-list {
    list-style: none;
    border-left: 1px solid var(--border-color);
    margin-left: 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    margin-bottom: 0;
    padding-left: 5px;
}

.sidebar-nav-group.is-active .sidebar-nav-list {
    max-height: max-content;
    margin-bottom: 1rem;
}

.sidebar-nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
    margin-left: -1px;
}

.sidebar-nav-link:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.sidebar-nav-link.active {
    color: var(--primary-color);
    background: var(--primary-light);
    font-weight: 500;
    border-left: 2px solid var(--primary-color);
}

/* Main Content */
.wp-doc-main {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
    padding: 3rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.doc-article {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.article-category {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
}

.article-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.btn-copy {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.btn-copy:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.article-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.meta-divider {
    color: var(--border-color);
}

.mt-2 {
    margin-top: 0.5rem;
}

.article-meta span i {
    color: var(--primary-color);
}

.article-content {
    font-size: 1.1rem;
    color: #334155;
}

.article-content h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1.25rem;
    color: var(--text-main);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 2rem 0;
}

.info-box {
    background: var(--primary-light);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
}

.info-box i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Right Sidebar (TOC) */
.wp-doc-toc-wrapper {
    width: var(--toc-width);
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    padding: 2rem 1.5rem;
    overflow-y: auto;
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.toc-list {
    list-style: none;
    border-left: 1px solid var(--border-color);
    padding-left: 0px;
}

.toc-item {
    padding-left: 1rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.toc-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: block;
    transition: var(--transition);
}

.toc-link:hover,
.toc-link.active {
    color: var(--primary-color);
}

.toc-link.active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.doc-article {
    animation: fadeIn 0.6s ease-out;
}

/* Breadcrumbs */
.article-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.article-breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.article-breadcrumbs a:hover {
    color: var(--primary-color);
}

.crumb-divider {
    color: var(--border-color);
}

.article-breadcrumbs .current {
    color: var(--text-main);
    font-weight: 500;
}

/* Code Blocks */
.code-block-wrapper {
    background: #1e293b;
    border-radius: 12px;
    margin: 2rem 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-block-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wp-caption {
    max-width: 100%;
}

.code-block-header span {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #94a3b8;
}

.btn-copy-code {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy-code:hover {
    background: rgba(255, 255, 255, 0.2);
}

.code-block-wrapper pre {
    padding: 1.5rem;
    margin: 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e2e8f0;
}

/* Article Footer */
.article-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.article-pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.pagination-prev,
.pagination-next {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    transition: var(--transition);
}

.pagination-prev {
    align-items: flex-start;
    text-align: left;
}

.pagination-next {
    align-items: flex-end;
    text-align: right;
}

.pagination-prev:hover,
.pagination-next:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.pagination-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.pagination-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
}

.article-feedback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-body);
    border-radius: 12px;
}

.article-feedback span {
    font-weight: 600;
    color: var(--text-main);
}

.feedback-buttons {
    display: flex;
    gap: 1rem;
}

.btn-feedback {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-feedback:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Responsive */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 350px;
        --toc-width: 250px;
    }
}

@media (max-width: 992px) {
    .wp-doc-toc-wrapper {
        display: none;
    }
}

@media (max-width: 768px) {
    .wp-doc-layout {
        flex-direction: column;
    }

    .wp-doc-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        padding: 1.5rem;
    }

    .sidebar-nav-list {
        border-left: none;
        margin-left: 0;
    }

    .wp-doc-main {
        padding: 1.5rem;
    }

    .doc-article {
        padding: 1.5rem;
    }

    .article-pagination {
        grid-template-columns: 1fr;
    }

    .article-title {
        font-size: 1.875rem;
    }
}

.article-content-wordpress #ez-toc-container {
    display: none;
}

/* Blog List Spacing Fixes for Archive */
.article-content-wordpress .blog-list__item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.article-content-wordpress .blog-list__thumb {
    width: 240px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

.article-content-wordpress .blog-list__thumb img {
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16/10;
}

.article-content-wordpress .blog-list__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.article-content-wordpress .blog-list__content p {
    margin-bottom: 0.5rem;
}

.article-content-wordpress .blog-card__category {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 0.5rem !important;
}

.article-content-wordpress .blog-list__content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    line-height: 1.3;
}

.article-content-wordpress .blog-list__content h3 a {
    text-decoration: none;
    color: var(--text-main);
}

.article-content-wordpress .blog-card__summary {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 5px !important;
    line-height: 1.5;
}

.article-content-wordpress .blog-card__meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.article-content-wordpress .blog-card__link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.term-description .wp-caption.alignnone {
    max-width: 100%;
}

.article-content-wordpress img {
    margin-bottom: 10px;
    max-width: 100%;
    margin-top: 0;
}

.wp-caption-text {
    text-align: center;
}

.article-content-wordpress h2 {
    font-size: 30px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
}

.article-content-wordpress h3 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
}

.article-content-wordpress ul li {
    margin-bottom: 10px;
    list-style: disc;
}

@media (max-width: 1499px) {
    aside.wp-doc-sidebar {
        width: 300px;
    }

    main.wp-doc-main {
        padding: 30px;
    }

    aside.wp-doc-toc-wrapper {
        padding-left: 0;
    }

    .article-content-wordpress .blog-list__item {
        gap: 0px;
    }
}

/* Mobile Controls */
.doc-mobile-controls {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-top: 0;
}

.btn-toggle-sidebar,
.btn-toggle-toc {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    transition: var(--transition);
}

.btn-toggle-sidebar:hover,
.btn-toggle-toc:hover {
    color: var(--primary-color);
    background: var(--primary-light);
    border-radius: 6px;
}

.doc-mobile-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Overlay */
.doc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 90;
    backdrop-filter: blur(2px);
}

.doc-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1199px) {
    .doc-article {
        padding: 20px;
    }

    .doc-mobile-controls {
        display: flex;
    }

    .article-content-wordpress {
        padding: 0;
    }

    .wp-doc-layout {
        position: relative;
    }

    /* Left Sidebar Mobile (Off-canvas) */
    aside.wp-doc-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        z-index: 100;
        transition: left 0.3s ease;
    }

    .site-nav {
        box-shadow: none;
    }

    aside.wp-doc-sidebar.active {
        left: 0;
    }

    /* Right Sidebar Mobile (Off-canvas) */
    aside.wp-doc-toc-wrapper {
        display: block !important;
        /* Force show even if hidden by other media queries */
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        z-index: 100;
        transition: right 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        background: var(--bg-card);
        padding-left: 1.5rem !important;
    }

    aside.wp-doc-toc-wrapper.active {
        right: 0;
    }

    /* Main Content Full Width */
    main.wp-doc-main {
        width: 100%;
        max-width: 100%;
        padding: 20px;
    }
}

@media (max-width: 767px) {
    .doc-mobile-controls {
        padding: 0;
        margin-bottom: 10px;
    }

    main.wp-doc-main {
        overflow: hidden;
        padding: 10px;
        padding-top: 0;
    }

    .doc-article {
        padding: 10px;
        border-radius: 6px;
    }

    h1.article-title {
        font-size: 23px;
        margin-bottom: 5px;
    }

    .meta-row {
        font-size: 11px;
    }

    header.article-header {
        padding-bottom: 15px;
        margin-bottom: 15px;
    }

    .article-header-top {
        align-items: center;
    }

    .article-category {
        margin-bottom: 0;
    }

    .article-content.article-content-wordpress {
        font-size: 16px;
    }

    .article-content-wordpress h2 {
        font-size: 20px;
    }

    .article-content-wordpress h3 {
        font-size: 16px;
        line-height: 24px;
    }

    .wp-doc-main section.blog-single__comments .container {
        padding: 0;
    }

    .article-content-wordpress .blog-list__thumb img {
        border-radius: 4px;
    }

    .article-content-wordpress .blog-list__thumb {
        width: 120px;
        height: 120px;
    }

    .article-content-wordpress .blog-list__content {
        padding-left: 15px;
    }

    .blog-list {
        gap: 0;
    }

    .meta-row {
        gap: 10px;
    }
}