/* =========================================================
   CAMPUSNOTES — RESOURCE PAGE STYLES
   Exact 1:1 match to the design specification
   ========================================================= */

/* --- RESET & GLOBAL --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    background:
        radial-gradient(circle at 75% 35%,
            #e7e1ff 0%,
            transparent 32%),
        radial-gradient(circle at 15% 75%,
            #f0ebff 0%,
            transparent 35%),
        linear-gradient(120deg,
            #fafaff,
            #f2f1ff);
    background-attachment: fixed;
    color: #111827;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* --- MAIN PAGE WRAPPER --- */
.resource-page-wrapper {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

/* --- BACK BUTTON --- */
.back-btn-container {
    margin-bottom: 20px;
}

.back-to-subject-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background-color: #ede9fe;
    color: #5b36f5;
    font-size: 13px;
    font-weight: 600;
    border-radius: 9999px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.back-to-subject-btn:hover {
    background-color: #e4ddfe;
    transform: translateX(-3px);
}

.back-to-subject-btn .arrow {
    font-size: 15px;
    line-height: 1;
}

/* --- TOP 6 RESOURCE CATEGORY TABS --- */
.category-tabs-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.category-tab-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e8eaf2;
    border-radius: 14px;
    padding: 16px 10px 14px;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-tab-card:hover {
    transform: translateY(-2px);
    border-color: #c4b5fd;
    box-shadow: 0 4px 14px rgba(101, 66, 245, 0.06);
}

/* Tab Icon Container */
.tab-icon-badge {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 11px;
    flex-shrink: 0;
}

.tab-icon-badge img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    display: block;
}

/* Tab Texts */
.tab-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.25;
}

.tab-description {
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
    max-width: 130px;
}

/* Active Tab State */
.category-tab-card.active {
    background: #f7f5ff;
    border: 1.5px solid #7c5cfc;
}

.category-tab-card.active .tab-title {
    color: #5b36f5;
}

.category-tab-card.active::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #6f4df6;
    border-radius: 9999px;
}

/* --- MAIN CONTAINER CARD --- */
.main-resource-card {
    background: #ffffff;
    border: 1px solid #e8eaf2;
    border-radius: 20px;
    padding: 28px 28px 32px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.02);
}

/* Top Header Bar */
.resource-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.resource-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-category-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #ede9fe;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6f4df6;
    flex-shrink: 0;
}

.header-category-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.header-text-group h1 {
    font-size: 21px;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
    margin-bottom: 3px;
}

.header-text-group p {
    font-size: 13.5px;
    color: #64748b;
    margin: 0;
}

/* Download Button */
.download-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f3effe;
    color: #6f4df6;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.download-action-btn:hover {
    background-color: #eae3fe;
    transform: translateY(-1px);
}

.download-action-btn svg {
    width: 16px;
    height: 16px;
}

/* --- TWO COLUMN LAYOUT --- */
.resource-columns-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 26px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}

/* --- LEFT SIDEBAR --- */
.resource-sidebar-nav {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.topics-nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topic-nav-item,
.resource-list-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.topic-nav-item:hover,
.resource-list-item:hover {
    background-color: #f8fafc;
    color: #111827;
}

.topic-nav-item.active,
.resource-list-item.active {
    background-color: #f3effe;
    color: #6f4df6;
    font-weight: 700;
    border-left: 3.5px solid #6f4df6;
    border-radius: 0 8px 8px 0;
}

/* Quick Tip Card */
.sidebar-quick-tip-box {
    margin-top: 36px;
    background: #f5f2fe;
    border-radius: 14px;
    padding: 14px 14px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.quick-tip-bulb-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6f4df6;
    flex-shrink: 0;
}

.quick-tip-text h4 {
    font-size: 13px;
    font-weight: 700;
    color: #1e1b4b;
    margin-bottom: 4px;
}

.quick-tip-text p {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.45;
    margin: 0;
}

/* --- RIGHT CONTENT CARD --- */
.resource-content-card {
    min-width: 0;
    max-width: 100%;
    border: 1px solid #e8eaf2;
    border-radius: 16px;
    padding: 24px 26px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
}

.content-topic-heading {
    font-size: 19px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.content-topic-subtitle {
    font-size: 13.5px;
    color: #64748b;
    margin-bottom: 22px;
    line-height: 1.5;
}

/* --- DIAGRAM SHOWCASE CONTAINER --- */
.diagram-canvas-box {
    border: 1px solid #e9edf5;
    border-radius: 12px;
    background: #fafbff;
    padding: 30px 24px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.diagram-canvas-box img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* --- DBMS ARCHITECTURE DIAGRAM (HTML/SVG implementation) --- */
.dbms-architecture-diagram {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.diagram-users-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.diagram-user-box {
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    color: #1e293b;
}

.diagram-user-box strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.diagram-user-box span {
    display: block;
    font-size: 11px;
    color: #334155;
    margin-top: 1px;
}

/* Vertical double arrows */
.diagram-arrows-trio {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    height: 32px;
    align-items: center;
    justify-items: center;
}

.diagram-arrow-v {
    color: #334155;
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
}

/* DBMS Middle Box */
.diagram-middle-dbms-box {
    width: 100%;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
}

.diagram-middle-dbms-box strong {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.3px;
}

.diagram-middle-dbms-box span {
    display: block;
    font-size: 11.5px;
    color: #334155;
    margin-top: 2px;
}

/* Single center arrow */
.diagram-arrow-single {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 3D Database Cylinder */
.diagram-database-cylinder {
    position: relative;
    width: 180px;
    text-align: center;
}

.db-cylinder-top-oval {
    width: 180px;
    height: 38px;
    background: #a855f7;
    border-radius: 50%;
    border: 1px solid #9333ea;
}

.db-cylinder-body {
    width: 180px;
    height: 62px;
    margin-top: -19px;
    background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
    border-radius: 0 0 90px 90px / 0 0 24px 24px;
    border: 1px solid #6d28d9;
    border-top: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(109, 40, 217, 0.25);
}

.db-cylinder-body strong {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
}

.db-cylinder-body span {
    font-size: 10.5px;
    color: #e9d5ff;
    margin-top: 1px;
}

/* --- EXPLANATION SECTION --- */
.content-explanation-box {
    margin-bottom: 24px;
}

.explanation-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.explanation-doc-icon {
    width: 22px;
    height: 22px;
    background: #6f4df6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.explanation-doc-icon svg {
    width: 13px;
    height: 13px;
}

.explanation-header-title h3 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.explanation-bullets-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.explanation-bullets-list li {
    position: relative;
    padding-left: 18px;
    font-size: 13.5px;
    color: #334155;
    line-height: 1.6;
    margin-bottom: 8px;
}

.explanation-bullets-list li::before {
    content: "•";
    position: absolute;
    left: 2px;
    top: -1px;
    color: #4338ca;
    font-size: 18px;
    line-height: 1.2;
}

/* Markdown prose fallback slot styling */
.markdown-prose-content {
    margin-bottom: 24px;
    color: #334155;
    font-size: 14px;
    line-height: 1.7;
}

.markdown-prose-content h2,
.markdown-prose-content h3 {
    color: #0f172a;
    font-weight: 700;
    margin-top: 16px;
    margin-bottom: 8px;
}

.markdown-prose-content p {
    margin-bottom: 12px;
}

/* --- BOTTOM NAVIGATION BAR --- */
.content-bottom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 20px;
}

.nav-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.nav-pill-btn.prev-btn.disabled {
    background: #f1f3f8;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-pill-btn.prev-btn:not(.disabled) {
    background: #f1f3f8;
    color: #475569;
}

.nav-pill-btn.prev-btn:not(.disabled):hover {
    background: #e2e8f0;
}

.nav-counter-display {
    font-size: 13.5px;
    font-weight: 600;
    color: #475569;
}

.nav-pill-btn.next-btn {
    background: #ede9fe;
    color: #6f4df6;
}

.nav-pill-btn.next-btn:hover {
    background: #e2dcfe;
    transform: translateX(2px);
}

.nav-pill-btn.next-btn.disabled {
    background: #f1f3f8;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 1080px) {
    .category-tabs-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .resource-columns-layout {
        grid-template-columns: 200px 1fr;
    }
}

@media (max-width: 820px) {
    .resource-columns-layout {
        display: block;
    }

    .resource-sidebar-nav {
        margin-bottom: 24px;
    }

    .topics-nav-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .topic-nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .topic-nav-item.active {
        border-left: none;
        border-bottom: 3px solid #6f4df6;
        border-radius: 6px 6px 0 0;
    }

    .sidebar-quick-tip-box {
        margin-top: 16px;
    }
}

@media (max-width: 680px) {
    .category-tabs-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding-bottom: 0;
        overflow-x: visible;
    }

    .category-tab-card {
        flex: none;
        padding: 10px 6px 10px;
    }

    .category-tab-card .tab-icon-badge {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
    }

    .category-tab-card .tab-icon-badge img {
        width: 30px;
        height: 30px;
    }

    .category-tab-card .tab-title {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .category-tab-card .tab-description {
        font-size: 9px;
        line-height: 1.25;
        max-width: 100px;
    }

    .resource-top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .main-resource-card {
        padding: 20px 16px;
    }

    .resource-content-card {
        padding: 18px 16px;
    }

    .diagram-users-row {
        gap: 8px;
    }

    .diagram-user-box {
        padding: 8px 4px;
    }

    .diagram-user-box strong {
        font-size: 11px;
    }

    .diagram-user-box span {
        font-size: 9.5px;
    }

    .content-bottom-nav {
        flex-direction: column;
        gap: 12px;
    }

    .nav-pill-btn {
        width: 100%;
        justify-content: center;
    }
}


/* =========================================================
   BREADCRUMBS
   ========================================================= */
.breadcrumbs-nav {
    margin-bottom: 12px;
}

.breadcrumbs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    font-size: 12.5px;
    color: #64748b;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.breadcrumb-item a {
    color: #6f4df6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

.breadcrumb-item a:hover {
    color: #5b36f5;
    text-decoration: underline;
}

.breadcrumb-item span[aria-current="page"] {
    color: #334155;
    font-weight: 600;
}

.breadcrumb-sep {
    margin: 0 6px;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1;
    user-select: none;
}


/* =========================================================
   NOTES PROSE CONTENT  (rendered Markdown)
   ========================================================= */
.notes-prose-content {
    color: #1e293b;
    font-size: 16px;
    line-height: 1.82;
    margin-bottom: 28px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Headings ── */
.notes-prose-content h1 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 16px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.notes-prose-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e1b4b;
    margin: 32px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ede9fe;
    line-height: 1.35;
}

.notes-prose-content h3 {
    font-size: 17px;
    font-weight: 700;
    color: #312e81;
    margin: 24px 0 10px;
    line-height: 1.4;
}

.notes-prose-content h4 {
    font-size: 15.5px;
    font-weight: 600;
    color: #3730a3;
    margin: 20px 0 8px;
    line-height: 1.4;
}

/* ── Paragraphs ── */
.notes-prose-content p {
    margin: 0 0 14px;
}

/* ── Links ── */
.notes-prose-content a {
    color: #6f4df6;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.notes-prose-content a:hover {
    color: #5b36f5;
}

/* ── Lists ── */
.notes-prose-content ul,
.notes-prose-content ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.notes-prose-content li {
    margin-bottom: 6px;
    line-height: 1.7;
}

.notes-prose-content li > ul,
.notes-prose-content li > ol {
    margin-top: 6px;
    margin-bottom: 0;
}

/* ── Tables ── */
.notes-prose-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 13.5px;
    line-height: 1.55;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.notes-prose-content thead {
    background: #f3effe;
}

.notes-prose-content th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    color: #1e1b4b;
    border: 1px solid #e2e0f0;
    white-space: nowrap;
}

.notes-prose-content td {
    padding: 9px 14px;
    border: 1px solid #e8eaf2;
    color: #334155;
    vertical-align: top;
}

.notes-prose-content tbody tr:nth-child(even) {
    background: #fafaff;
}

.notes-prose-content tbody tr:hover {
    background: #f5f2fe;
}

/* ── Blockquotes ── */
.notes-prose-content blockquote {
    margin: 18px 0;
    padding: 14px 18px;
    border-left: 4px solid #7c5cfc;
    background: #f8f6ff;
    border-radius: 0 8px 8px 0;
    color: #334155;
    font-style: normal;
}

.notes-prose-content blockquote p {
    margin-bottom: 0;
}

/* ── Inline code ── */
.notes-prose-content code {
    background: #f1eff9;
    color: #5b21b6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13.5px;
    font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
}

.notes-prose-content h1 code,
.notes-prose-content h2 code,
.notes-prose-content h3 code,
.notes-prose-content h4 code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
}

/* ── Code blocks ── */
.notes-prose-content pre {
    background: #1e1b3a;
    color: #e2e8f0;
    padding: 18px 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 18px 0;
    font-size: 13px;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
}

.notes-prose-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* ── Images ── */
.notes-prose-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 16px 0;
    display: block;
}

/* ── Horizontal rules ── */
.notes-prose-content hr {
    border: none;
    border-top: 2px solid #ede9fe;
    margin: 28px 0;
}

/* ── Strong / Bold ── */
.notes-prose-content strong {
    font-weight: 700;
    color: #0f172a;
}

/* ── Definition-style emphasis ── */
.notes-prose-content em {
    font-style: italic;
    color: #475569;
}


/* =========================================================
   SYSTEMATIC VISUAL DIAGRAMS (Pure CSS)
   ========================================================= */
.visual-diagram {
    background: #fbfaff;
    border: 1.5px solid #e6e0f8;
    border-radius: 14px;
    padding: 22px 24px;
    margin: 24px 0;
    box-shadow: 0 3px 12px rgba(111, 77, 246, 0.05);
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.diagram-caption {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #6f4df6;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #ede9fe;
    padding-bottom: 10px;
}

.diagram-caption::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6f4df6;
    box-shadow: 0 0 0 3px rgba(111, 77, 246, 0.2);
}

/* 1. Grid of Nodes / Concepts / Pillars */
.diagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    width: 100%;
    align-items: stretch;
}

.diagram-pill {
    background: #ffffff;
    border: 1.5px solid #e4defa;
    border-top: 3.5px solid #6f4df6;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box;
}

.diagram-pill:hover {
    transform: translateY(-2px);
    border-color: #6f4df6;
    box-shadow: 0 4px 12px rgba(111, 77, 246, 0.1);
}

.diagram-pill .pill-title {
    font-weight: 700;
    font-size: 13.5px;
    color: #1e1b4b;
    margin-bottom: 6px;
    line-height: 1.35;
}

.diagram-pill .pill-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

/* 2. Sequential Process Flow & Flowcharts */
.diagram-flow {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.diagram-box,
.flow-step {
    background: #ffffff;
    border: 1.5px solid #d8d0f8;
    border-top: 3.5px solid #6f4df6;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(111, 77, 246, 0.04);
    min-width: 150px;
    max-width: 260px;
    flex: 1 1 170px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-sizing: border-box;
}

.diagram-box:hover,
.flow-step:hover {
    transform: translateY(-2px);
    border-color: #6f4df6;
    box-shadow: 0 4px 12px rgba(111, 77, 246, 0.1);
}

.box-label {
    display: inline-block;
    background: #ede9fe;
    color: #5b36f5;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.2;
}

.box-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e1b4b;
    line-height: 1.35;
}

.box-desc {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.4;
}

.flow-step {
    font-size: 13px;
    font-weight: 700;
    color: #1e1b4b;
}

.flow-step span {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.4;
}

.diagram-arrow,
.flow-arrow {
    color: #6f4df6;
    font-size: 20px;
    font-weight: 800;
    user-select: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 0 4px;
    line-height: 1;
}

/* 3. Layered Stack Architecture */
.diagram-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.stack-layer {
    background: #ffffff;
    border: 1.5px solid #e4defa;
    border-left: 5px solid #6f4df6;
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: transform 0.15s ease;
}

.stack-layer:hover {
    transform: translateX(3px);
}

.stack-layer .layer-left,
.stack-layer .stack-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stack-layer .layer-num {
    display: inline-block;
    background: #ede9fe;
    color: #5b36f5;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

.stack-layer .layer-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e1b4b;
}

.stack-layer .layer-detail {
    font-size: 12px;
    color: #64748b;
    text-align: right;
}

/* 4. Split Comparison Columns */
.diagram-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    width: 100%;
    align-items: stretch;
}

.split-col {
    background: #ffffff;
    border: 1.5px solid #e4defa;
    border-top: 3.5px solid #6f4df6;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.split-header {
    font-size: 14px;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ede9fe;
}

.split-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.split-list li,
.split-list div {
    font-size: 12.5px;
    color: #475569;
    padding: 3px 0;
    line-height: 1.5;
}

/* 5. Hierarchical Tree / Center Model */
.diagram-hierarchy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    position: relative;
}

.hierarchy-top {
    background: #6f4df6;
    color: #ffffff;
    padding: 11px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13.5px;
    text-align: center;
    box-shadow: 0 3px 8px rgba(111, 77, 246, 0.25);
    z-index: 1;
}

.hierarchy-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    width: 100%;
}

.hierarchy-node {
    background: #ffffff;
    border: 1.5px solid #d8d0f8;
    border-top: 3px solid #6f4df6;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #1e1b4b;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
}


/* =========================================================
   RESOURCE PAGE TOAST
   ========================================================= */
.resource-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e1b3a;
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: "Lexend", sans-serif;
    box-shadow: 0 8px 28px rgba(30, 27, 58, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    text-align: center;
    max-width: 90vw;
}

.resource-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}


/* =========================================================
   SIDEBAR EMPTY STATE
   ========================================================= */
.sidebar-empty-state {
    padding: 24px 14px;
    text-align: center;
}

.sidebar-empty-state p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
}


/* =========================================================
   RESPONSIVE – breadcrumbs & prose additions
   ========================================================= */
@media (max-width: 680px) {
    .breadcrumbs-list {
        font-size: 11px;
    }

    .breadcrumb-sep {
        margin: 0 4px;
    }

    .notes-prose-content {
        font-size: 14px;
        line-height: 1.75;
    }

    .notes-prose-content h1 {
        font-size: 20px;
    }

    .notes-prose-content h2 {
        font-size: 17.5px;
    }

    .notes-prose-content h3 {
        font-size: 15.5px;
    }

    .notes-prose-content table {
        font-size: 12.5px;
    }

    .notes-prose-content th,
    .notes-prose-content td {
        padding: 7px 10px;
    }

    .notes-prose-content pre {
        font-size: 12px;
        padding: 14px 14px;
    }

    .visual-diagram {
        padding: 16px 14px;
        margin: 18px 0;
    }

    .diagram-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .diagram-flow {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .diagram-box,
    .flow-step {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }

    .diagram-arrow,
    .flow-arrow {
        transform: rotate(90deg);
        margin: 2px auto;
        padding: 2px 0;
    }

    .stack-layer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .stack-layer .layer-detail {
        text-align: left;
    }

    .diagram-split {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .hierarchy-bottom {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}


/* =========================================================
   LARGE DESKTOP ENHANCEMENTS (>= 1400px)
   Eliminates excess empty margins on wide screens & optimizes readability
   ========================================================= */
@media (min-width: 1400px) {
    .resource-page-wrapper {
        max-width: 1520px;
        padding: 32px 32px 70px;
    }

    .resource-columns-layout {
        grid-template-columns: 280px minmax(0, 1fr);
        gap: 32px;
    }

    .main-resource-card {
        padding: 34px 40px 40px;
    }

    .notes-prose-content {
        font-size: 16.5px;
        line-height: 1.86;
    }

    .notes-prose-content h1 {
        font-size: 26px;
    }

    .notes-prose-content h2 {
        font-size: 21.5px;
    }

    .notes-prose-content h3 {
        font-size: 18.5px;
    }

    .notes-prose-content table {
        font-size: 14.5px;
    }

    .notes-prose-content pre {
        font-size: 13.5px;
    }
}
