/* article-nav.css - CodeByTushu */
.article-navbar {
    position: sticky;
    top: 70px; /* Accounts for main navbar */
    z-index: 990;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-family: 'Ubuntu', sans-serif;
    color: #fff;
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.article-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-nav-link {
    color: #aaaaaa;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.article-nav-link:hover {
    color: #ffc400;
}

.article-nav-separator {
    color: #444;
    font-size: 14px;
}

.article-nav-link.current-category {
    color: #ffc400;
    font-weight: 600;
}

.article-nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.article-nav-dropdown {
    position: relative;
}

.article-nav-btn {
    background: none;
    border: none;
    color: #dddddd;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.article-nav-btn:hover {
    background: rgba(255, 196, 0, 0.1);
    color: #ffc400;
}

.article-nav-btn .arrow {
    font-size: 11px;
    transition: transform 0.3s ease;
}

.article-nav-dropdown.active .article-nav-btn .arrow {
    transform: rotate(180deg);
}

.article-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-width: 240px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.article-dropdown-menu.right-align {
    left: auto;
    right: 0;
}

.article-nav-dropdown.active .article-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toc-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    padding: 8px 12px;
    font-weight: 600;
}

.toc-list {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.toc-list::-webkit-scrollbar {
    width: 4px;
}
.toc-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.toc-item {
    display: block;
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-item.level-h3 { padding-left: 24px; font-size: 12.5px; color: #aaa; }
.toc-item.level-h4 { padding-left: 36px; font-size: 12px; color: #888; }

.toc-item:hover, .toc-item.active {
    background: rgba(255, 196, 0, 0.1);
    color: #ffc400;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.dropdown-item:hover:not(.disabled) {
    background: rgba(255, 196, 0, 0.1);
    color: #ffc400;
}

.dropdown-item.disabled {
    color: #666;
    cursor: not-allowed;
}

.dropdown-item.disabled span {
    font-size: 10px;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.article-nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: #dddddd;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.article-nav-mobile-toggle:hover {
    background: rgba(255, 196, 0, 0.1);
    color: #ffc400;
}

.show-mobile { 
    display: none; 
}

/* Responsive */
@media (max-width: 768px) {
    .article-navbar {
        padding: 0 16px;
        overflow: visible; /* Prevent clipping of dropdown */
    }
    
    .hide-mobile { display: none; }
    .show-mobile { display: inline; }
    
    .article-nav-mobile-toggle {
        display: flex;
    }
    
    .article-nav-right {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(12px);
        flex-direction: column;
        align-items: stretch;
        padding: 10px 16px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        gap: 5px;
        display: none; /* Hidden by default */
        box-shadow: 0 15px 30px rgba(0,0,0,0.8);
    }
    
    .article-nav-right.mobile-open {
        display: flex; /* Show when toggled */
    }
    
    .article-nav-dropdown {
        width: 100%;
    }
    
    .article-nav-btn {
        width: 100%;
        justify-content: space-between;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.03);
        font-size: 14px;
        border-radius: 8px;
    }
    
    .article-dropdown-menu {
        position: static; /* Flow naturally within the flex container */
        width: 100%;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 5px 0 10px 15px;
        margin-top: 0;
        display: none; /* Hide by default */
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    
    .article-nav-dropdown.active .article-dropdown-menu {
        display: block; /* Show when parent dropdown is active */
    }
    
    .dropdown-item {
        padding: 12px;
    }
    
    .toc-list {
        max-height: 250px;
    }
}

/* ==========================================================================
   Interactive Modals (Quiz & Study Notes)
   ========================================================================== */
.cbt-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: cbtModalFadeIn 0.25s ease-out;
}

@keyframes cbtModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cbt-modal-card {
    background: #0d0d12;
    border: 1px solid rgba(255, 196, 0, 0.3);
    border-radius: 12px;
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(255, 196, 0, 0.12);
    color: #fff;
    overflow: hidden;
    animation: cbtModalSlideUp 0.25s ease-out;
}

.cbt-modal-card.cbt-notes-card {
    max-width: 820px;
}

@keyframes cbtModalSlideUp {
    from { transform: translateY(24px) scale(0.97); }
    to { transform: translateY(0) scale(1); }
}

.cbt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.cbt-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.cbt-quiz-badge {
    background: rgba(255, 196, 0, 0.15);
    color: #ffc400;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 196, 0, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cbt-modal-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 0 6px;
    transition: color 0.2s;
}

.cbt-modal-close:hover {
    color: #ffc400;
}

.cbt-modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #ccc;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 196, 0, 0.3) transparent;
}

.cbt-modal-body::-webkit-scrollbar {
    width: 6px;
}
.cbt-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 196, 0, 0.3);
    border-radius: 4px;
}

.cbt-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.4);
    flex-wrap: wrap;
}

.cbt-btn-modal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cbt-btn-modal:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.cbt-btn-modal.primary {
    background: #ffc400;
    color: #0b0b0d;
    border-color: #ffc400;
}

.cbt-btn-modal.primary:hover {
    background: #e6b000;
}

.cbt-btn-modal.github {
    background: #24292e;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.cbt-btn-modal.github:hover {
    background: #2f363d;
}

.cbt-quick-git-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cbt-quick-git-link:hover {
    background: rgba(255, 196, 0, 0.15);
    border-color: #ffc400;
    color: #ffc400;
    transform: translateY(-1px);
}

/* Quiz UI Components */
.quiz-question-header {
    margin-bottom: 16px;
}

.quiz-q-num {
    font-size: 0.82rem;
    color: #ffc400;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.quiz-q-title {
    font-size: 1.12rem;
    color: #fff;
    font-weight: 600;
    line-height: 1.45;
}

.quiz-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.93rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.quiz-option-btn:hover:not(:disabled) {
    background: rgba(255, 196, 0, 0.08);
    border-color: rgba(255, 196, 0, 0.4);
    color: #fff;
}

.quiz-option-btn.correct {
    background: rgba(46, 125, 50, 0.25) !important;
    border-color: #4caf50 !important;
    color: #a5d6a7 !important;
    font-weight: 600;
}

.quiz-option-btn.incorrect {
    background: rgba(198, 40, 40, 0.25) !important;
    border-color: #ef5350 !important;
    color: #ef9a9a !important;
}

.quiz-opt-letter {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.quiz-explanation {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.5;
    background: rgba(255, 196, 0, 0.08);
    border-left: 3px solid #ffc400;
    color: #e0e0e0;
}

.quiz-score-card {
    text-align: center;
    padding: 30px 20px;
}

.quiz-score-val {
    font-size: 3rem;
    font-weight: 800;
    color: #ffc400;
    margin-bottom: 10px;
}

/* Notes Cards UI */
.notes-card-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.notes-card-item h4 {
    color: #ffc400;
    font-size: 1.05rem;
    margin-top: 0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notes-card-item ul {
    margin: 0;
    padding-left: 20px;
}

.notes-card-item li {
    margin-bottom: 8px;
    color: #d1d1d6;
}

/* ==========================================================================
   Print / Save as PDF Stylesheet
   ========================================================================== */
@media print {
    body {
        background: #ffffff !important;
        color: #111111 !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
        font-size: 11pt !important;
        line-height: 1.6 !important;
    }
    #mainNavbar,
    #articleNavbar,
    .cbt-hero-bg,
    #cbt-reading-progress,
    .cbt-sidebar,
    .cbt-footer,
    .cbt-article-share,
    .cbt-scroll-to-top,
    .cbt-mobile-drawer,
    .cbt-mobile-overlay,
    .cbt-article-nav-buttons,
    .cbt-modal-overlay {
        display: none !important;
    }
    .cbt-blog-layout {
        display: block !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .cbt-article {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .cbt-article h1, .cbt-article h2, .cbt-article h3 {
        color: #111 !important;
        page-break-after: avoid;
    }
    pre, code {
        background: #f4f4f4 !important;
        color: #222 !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        font-family: Consolas, monospace !important;
    }
    table {
        border-collapse: collapse !important;
        width: 100% !important;
    }
    th, td {
        border: 1px solid #ccc !important;
        padding: 6px 10px !important;
        color: #111 !important;
    }
    th {
        background: #eaeaea !important;
    }
    a {
        color: #0b5394 !important;
        text-decoration: underline !important;
    }
}
