/* onenote-nav.css - Premium OneNote-style 3-Column Navigation */

#onenote-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 820px;
    max-width: 100%;
    /* Expanded by 20% (680px -> ~820px) */
    height: 100vh;
    background: var(--bg-surface);
    backdrop-filter: blur(30px);
    /* Increased blur for premium feel */
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid var(--border-glass);
    z-index: var(--z-nav);
    /* Cascading nav on top of most UI */
    /* Layer 3: Navigation */
    /* High priority, below Landing but above Content */
    display: flex;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}

#onenote-nav.bookshelf-expanded {
    width: 1000px;
    max-width: 100%;
}

#onenote-nav:not(.show),
#onenote-nav.minimized {
    transform: translateX(-100%) scaleX(0.95);
    opacity: 0;
    pointer-events: none;
}

#onenote-nav.show:not(.minimized) {
    transform: translateX(0) scaleX(1);
    opacity: 1;
    pointer-events: auto;
}

/* Base Column Styles */
.nav-column {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease;
}

/* Col 1: Bookshelf (Icons only) */
.nav-column.bookshelf {
    width: 80px;
    background: rgba(15, 23, 42, 0.25);
    align-items: center;
    padding: 24px 0;
    border-right: 1px solid var(--border-glass);
    flex-shrink: 0;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

[data-theme="light"] .nav-column.bookshelf {
    background: rgba(210, 218, 240, 0.45);
}

.teacher-profile-mini {
    margin-bottom: 28px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 18px;
    background: transparent;
    position: relative;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
    padding: 0;
    /* No padding in collapsed mode to ensure centering */
}

.teacher-profile-mini .avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.teacher-profile-mini .avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.teacher-profile-mini:hover .avatar-circle {
    transform: translateY(-2px);
    border-color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.teacher-profile-mini:hover img {
    transform: scale(1.1);
}

.nav-book-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    align-items: center;
    overflow-y: auto;
    padding: 10px 0;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

/* Hide scrollbar for Bookshelf */
.nav-book-list::-webkit-scrollbar {
    display: none;
}

.nav-book-item {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-item);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
    overflow: hidden;
    margin: 0 auto;
    /* Center in column */
}

.nav-book-item span:first-child,
.nav-book-item > i {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    /* Better centering for single letters */
}

.nav-book-label {
    display: block;
    opacity: 0;
    width: 0;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 0;
    transition: opacity 0.3s ease, margin 0.3s ease, width 0.3s ease, flex 0.3s ease, padding 0.3s ease;
    text-align: left;
    padding-right: 0;
}

.nav-column.bookshelf.expanded .nav-book-label {
    opacity: 1;
    width: auto;
    flex: 1;
    margin-left: 2px;
    padding-right: 12px;
    /* Close to the icon */
    pointer-events: auto;
}

.nav-book-item:hover {
    background: var(--bg-item-hover);
    color: var(--text-main);
    transform: scale(1.05);
    border-color: var(--primary);
}

.nav-book-item.active {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    box-shadow: 0 8px 20px rgba(var(--p-h), 90%, 60%, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-book-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    /* Align to the inner edge of the item itself */
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: white;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px white;
}

#btn-manage-classes {
    margin-top: auto;
    background: transparent;
    border-color: transparent;
    font-size: 1.3rem;
}

#btn-manage-classes:hover {
    color: var(--primary);
}

/* EXPANDED BOOKSHELF STATE */
.nav-column.bookshelf.expanded {
    width: 260px;
    align-items: flex-start;
    padding-left: 16px;
    padding-right: 16px;
}

.nav-column.bookshelf.expanded .nav-book-item {
    width: 100%;
    justify-content: flex-start;
    padding: 0;
    height: 52px;
    border-radius: 12px;
}

.nav-column.bookshelf.expanded .nav-book-label {
    display: block;
}

.nav-column.bookshelf.expanded .teacher-profile-mini {
    justify-content: flex-start;
    padding: 8px 12px;
    gap: 12px;
    margin-bottom: 24px;
    background: rgba(var(--p-h), 90%, 60%, 0.08);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    width: calc(100% - 4px);
    margin-left: 2px;
}

.teacher-name-label {
    display: none;
    /* Keep layout clean when collapsed */
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: opacity 0.3s ease, width 0.3s ease;
    text-align: left;
}

.nav-column.bookshelf.expanded .teacher-name-label {
    display: block;
    opacity: 1;
    width: auto;
    pointer-events: auto;
    flex: 1;
    /* Only grow when expanded */
    margin-left: 2px;
}

/* Expansion Toggle Button */
.bookshelf-toggle {
    margin-bottom: 24px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-item);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.8rem;
}

.bookshelf-toggle:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(var(--p-h), 90%, 60%, 0.3);
}

.nav-column.bookshelf.expanded .bookshelf-toggle {
    margin-left: auto;
    margin-right: -10px;
    /* Offset to feel balanced with expanded panel padding */
}

.nav-column.bookshelf.expanded .bookshelf-toggle i {
    transform: rotate(180deg);
}

/* Col 2: Chapters */
.nav-column.chapters {
    width: 280px;
    /* Expanded from 240px */
    background: rgba(0, 0, 0, 0.08);
    border-right: 1px solid var(--border-glass);
    flex-shrink: 0;
}

[data-theme="light"] .nav-column.chapters {
    background: rgba(200, 210, 235, 0.22);
}

/* Col 3: Lessons */
.nav-column.lessons {
    flex: 1;
    background: transparent;
}

.nav-column.chapters .col-header,
.nav-column.lessons .col-header {
    padding-top: 75px;
    /* Push down to avoid clock notch overlap */
}

/* Shared Header Styling */
.col-header {
    padding: 30px 24px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.col-header h3 {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    opacity: 0.8;
}

.icon-btn.small {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--bg-item);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn.small:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--p-h), 90%, 60%, 0.3);
    border-color: transparent;
}

/* Close button for library */
.nav-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-item);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-close-btn:hover {
    background: var(--bg-item-hover);
    color: var(--danger);
    transform: scale(1.1);
    border-color: var(--danger);
}

.col-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 140px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    min-height: 0;
}

/* Shared List Items (Chapters & Lessons) */
.nav-item {
    padding: 14px 18px;
    border-radius: 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    border: 1px solid transparent;
    background: transparent;
}

.nav-item:hover {
    background: var(--bg-item);
    transform: translateX(6px);
    border-color: var(--border-glass);
}

/* Custom Checkbox Appearance */
.item-selection input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    /* Use primary for visibility */
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-selection input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.item-selection input[type="checkbox"]:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 0.75rem;
}

.item-selection input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.nav-item.active .nav-item-icon {
    color: var(--primary);
}

.nav-item:hover .nav-item-icon {
    color: var(--text-main);
}

/* Subtitle (Chapter Context) */
.col-subtitle {
    padding: 0 24px 10px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* Sort Select Styling */
.nav-sort-select {
    background: var(--bg-item);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-sort-select:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

/* Bulk Bar - Floating Premium Look */
/* Bulk Bar - Floating Premium Look */
.nav-bulk-bar {
    position: fixed;
    bottom: 40px;
    left: 50%;
    /* Center relative to screen */
    transform: translateX(-50%) translateY(0) scale(1);
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: var(--z-bulk-bar);
    width: auto;
    max-width: 90vw;
}

.nav-bulk-bar.show {
    transform: translateX(-50%) translateY(0) scale(1);
}

.bulk-info {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    /* Force 1 line */
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
}

.bulk-info::before {
    content: '\f058';
    /* Check-circle icon */
    font-family: 'Font Awesome 6 Free';
    color: var(--primary);
    font-size: 1.1rem;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--bg-item);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.bulk-btn:hover {
    background: var(--bg-item-hover);
    color: var(--text-main);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bulk-btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--p-rgb), 0.3);
}

.bulk-btn.primary:hover {
    filter: brightness(1.1);
}

.bulk-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.bulk-btn.danger:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.bulk-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
    font-size: 1rem;
    padding: 0;
}

.bulk-close:hover {
    background: var(--bg-item-hover);
    color: var(--text-main);
    transform: rotate(90deg);
}

/* Scrollbar Customization */
.col-list::-webkit-scrollbar {
    width: 8px;
}

.col-list::-webkit-scrollbar-track {
    background: rgba(128, 128, 128, 0.06);
    border-radius: 4px;
}

.col-list::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
    min-height: 40px;
}

.col-list::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Animations for Entry */
/* Navigation Context Menu */
#nav-context-menu {
    position: fixed;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 6px;
    min-width: 180px;
    z-index: var(--z-context-menu);
    display: none;
    backdrop-filter: blur(12px);
    animation: menuFadeIn 0.2s ease-out;
}

#nav-context-menu.show {
    display: block;
}

.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.ctx-menu-item:hover {
    background: var(--bg-item-hover);
    color: var(--primary);
}

.ctx-menu-item.delete {
    color: #ef4444;
}

.ctx-menu-item.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.ctx-menu-separator {
    height: 1px;
    background: var(--border-glass);
    margin: 4px 0;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }

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

/* Fix Bulk Bar Exit */
.nav-bulk-bar:not(.show) {
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(150%) scale(0.9);
}

.nav-item {
    animation: colFadeIn 0.4s ease backwards;
}

/* Staggered animation for items */
.nav-item:nth-child(1) {
    animation-delay: 0.05s;
}

.nav-item:nth-child(2) {
    animation-delay: 0.1s;
}

.nav-item:nth-child(3) {
    animation-delay: 0.15s;
}

.nav-item:nth-child(4) {
    animation-delay: 0.2s;
}

.nav-item:nth-child(5) {
    animation-delay: 0.25s;
}

/* Active Glow */
.nav-item.active {
    background: var(--bg-surface-solid);
    color: var(--primary);
    font-weight: 700;
    border-color: rgba(var(--p-h), 90%, 60%, 0.3);
    box-shadow: 0 10px 25px -5px rgba(var(--p-h), 90%, 60%, 0.15);
    transform: translateX(8px);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 12px var(--primary);
}

/* --- Archived Items & Folders --- */
.nav-archived-folder {
    margin-top: 20px;
    border-top: 1px solid var(--border-glass);
    padding-top: 5px;
    width: 100%;
    animation: colFadeIn 0.4s ease;
}

.archived-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
    background: rgba(0, 0, 0, 0.1);
}

.archived-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}


/* ─── OneNote nav responsive layout → responsive-scale.css §11 ───
   Breakpoints at 900px and 480px are handled centrally there. */

.archived-header i {
    opacity: 0.7;
    font-size: 0.9em;
}

.archived-header .arrow {
    margin-left: auto;
    font-size: 0.75rem;
}

.archived-content {
    margin-left: 12px;
    padding-left: 8px;
    border-left: 2px solid var(--border-glass);
    margin-top: 5px;
}

.is-archived-item {
    opacity: 0.6;
    filter: grayscale(0.8);
}

.is-archived-item:hover {
    opacity: 0.9;
    filter: grayscale(0.4);
}

/* Missing Loading Spinner & Animations */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--primary);
    font-size: 1.5rem;
}

@keyframes colFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* --- JS Generated Classes Support --- */
.nav-archive-group {
    width: 100%;
    margin-top: 10px;
    border-top: 1px solid var(--border-glass);
    padding-top: 10px;
}

.nav-archive-header {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    gap: 2px;
    opacity: 0.7;
    transition: all 0.2s;
}

.nav-archive-header:hover {
    opacity: 1;
    color: var(--text-main);
}

.nav-archive-header span {
    display: none;
    /* Hide text in collapsed mode */
}

.nav-archive-header .arrow {
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.nav-column.bookshelf.expanded .nav-archive-header {
    width: auto;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 16px;
    font-size: 0.9rem;
    gap: 10px;
}

.nav-column.bookshelf.expanded .nav-archive-header span {
    display: inline;
}

.nav-archive-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    padding-top: 10px;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    margin-top: 8px;
    padding-bottom: 10px;
}

.nav-book-item.archived {
    opacity: 0.7;
    filter: grayscale(0.8);
}

.nav-book-item.archived:hover {
    opacity: 1;
    filter: grayscale(0);
}

/* Hidden Items (Chapters/Lessons) */
.nav-item.hidden-item .nav-item-icon {
    color: var(--text-muted);
}

.nav-item.hidden-item .nav-item-title {
    color: var(--text-muted);
    font-style: italic;
}