/* E-Notes Redesigned - Subject Cards, Weeks Modal & Content Modal with 65/35 Layout */

/* ==================== SEARCH FILTER ==================== */

.enotes-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.enotes-search-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.search-icon {
    color: #9ca3af;
    font-size: 1.1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.enotes-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: transparent;
}

.enotes-search-input::placeholder {
    color: #9ca3af;
}

.enotes-search-clear {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 28px;
    height: 28px;
}

.enotes-search-clear:hover {
    background: #f3f4f6;
    color: #ef4444;
}

.enotes-search-stats {
    margin-top: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    min-height: 1.25rem;
}

/* Highlight matching text */
.search-highlight {
    background: #fef08a;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: var(--font-weight-semibold);
}

/* No results state */
.no-results-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.no-results-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

.no-results-state h4 {
    margin: 0 0 0.5rem 0;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.no-results-state p {
    margin: 0;
    font-size: var(--font-size-base);
}

/* ==================== SUBJECT CARDS GRID ==================== */

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    padding: 1rem 0;
}

@media (max-width: 768px) {
    .subjects-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== SUBJECT CARD ==================== */

.subject-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.subject-card:active {
    transform: translateY(-2px);
}

.status-graded {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #1e293b;
    font-size: 0.95rem;
}

.graded-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #16a34a;
    font-weight: 600;
}

.teacher-feedback {
    background: #f8fafc;
    border-left: 4px solid #16a34a;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.teacher-feedback strong {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.teacher-feedback p {
    margin: 0;
    color: #334155;
    font-style: italic;
}

.final-score-badge {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
}

.final-score-badge i {
    color: #d97706;
}

.submission-modal-footer .status-success {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #16a34a;
    font-weight: 500;
}

/* SUBJECT GRID - CLEAN & STRUCTURED */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem; /* Reduced by another 30%+ */
    padding: 1.5rem 0;
    max-width: 850px;
    margin: 0 auto;
}

.subject-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; /* Reduced by 60% */
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 0.5rem;
}

.subject-node:hover {
    transform: translateY(-5px);
}

.node-circle {
    width: 55px; /* Compact icon size */
    height: 55px;
    border-radius: 16px;
    background: var(--bg, #1e293b); /* Dynamic subject color */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #ffffff !important; /* Force white icons */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.subject-node:hover .node-circle {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.node-label {
    font-size: 1rem;
    font-weight: 600;
    color: #10b981; /* Subject name in Green */
    text-align: center;
    transition: color 0.3s ease;
}

.subject-node:hover .node-label {
    color: #34d399;
}

@media (min-width: 1024px) {
    .subject-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* ==================== TERMS MODAL ==================== */
.terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.terms-modal-content {
    background: #ffffff;
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(20px);
    opacity: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.terms-modal-overlay.active .terms-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.terms-modal-header {
    padding: 2rem;
    background: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.terms-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.terms-modal-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.terms-modal-body {
    padding: 2rem;
    overflow-y: auto;
    background: #f8fafc;
}

.terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

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

.terms-modal-content {
    background: white;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.terms-modal-overlay.active .terms-modal-content {
    transform: scale(1) translateY(0);
}

.terms-modal-header {
    padding: 1.5rem;
    color: white;
    position: relative;
}

.terms-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terms-modal-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: var(--font-size-base);
    opacity: 0.9;
}

.terms-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Terms List */
.terms-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.term-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.term-item:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.term-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.term-item-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.term-item-info {
    flex: 1;
}

.term-item-info h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.term-details {
    margin: 0.25rem 0 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.term-item-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.term-item:hover .term-item-arrow {
    background: var(--primary-color);
    color: white;
}

/* ==================== WEEKS MODAL ==================== */
.weeks-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.weeks-modal-content {
    background: #ffffff;
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(20px);
    opacity: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.weeks-modal-overlay.active .weeks-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.weeks-modal-header {
    padding: 2rem;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.weeks-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.weeks-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weeks-modal-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: var(--font-size-base);
    opacity: 0.9;
}

.weeks-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Weeks List */
.weeks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.week-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.week-item:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.week-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.week-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.week-item-info {
    flex: 1;
}

.week-item-info h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.week-topic {
    margin: 0.25rem 0 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.week-item-indicators {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.week-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
}

.week-badge.assignment {
    background: #FEF3C7;
    color: #92400E;
}

.week-badge.content {
    background: #DBEAFE;
    color: #1E40AF;
}

/* ==================== CONTENT MODAL (65/35 Layout) ==================== */

.content-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.content-modal-content {
    background: white;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-modal-overlay.active .content-modal-content {
    transform: scale(1);
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .content-modal-content {
        width: 90vw;
        height: 90vh;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .content-modal-content {
        width: 85vw;
        height: 85vh;
        max-width: 1200px;
    }
}

/* Mobile: Better viewport handling */
@media (max-width: 767px) {
    .content-modal-content {
        width: 100vw;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        max-width: 100vw;
        border-radius: 0;
    }
}

.content-modal-header {
    padding: 1.25rem 1.5rem;
    color: white;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    flex: 1;
}

.content-modal-subtitle {
    margin: 0;
    font-size: var(--font-size-base);
    opacity: 0.9;
}

.btn-close-modal,
.btn-back-modal {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.btn-close-modal:hover,
.btn-back-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.content-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0f172a; /* Dark sleek background */
    position: relative;
}

/* WEEK DASHBOARD UI */
.week-dashboard {
    padding: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    animation: dashboardFade 0.5s ease-out;
}

@keyframes dashboardFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-header {
    margin-bottom: 3rem;
    text-align: center;
}

.dashboard-header h2 {
    font-size: 2.25rem;
    color: white;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-section h3 {
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-section h3 i {
    font-size: 1rem;
}

/* Content Cards */
.content-item-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.content-item-card:hover {
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.item-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.note-item .item-icon-box { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.assignment-item .item-icon-box { background: linear-gradient(135deg, #10b981, #059669); }

.item-main-info {
    flex: 1;
}

.item-title {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.item-status-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-weight: 600;
}

.status-tag-pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-tag-submitted { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.status-tag-graded { background: rgba(99, 102, 241, 0.1); color: #818cf8; }

.item-action-arrow {
    color: rgba(255, 255, 255, 0.2);
    font-size: 1.25rem;
    transition: transform 0.3s;
}

.content-item-card:hover .item-action-arrow {
    color: white;
    transform: translateX(5px);
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Full-Screen Note Reader */
.note-reader-overlay {
    position: fixed; /* Super high to cover everything */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9000;
    display: none; /* Controlled by JS flex */
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.note-reader-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.note-reader-content {
    background: #ffffff;
    width: 100%;
    max-width: 1000px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ACADEMIC TREE TRANSFORMATION */
.academic-tree-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    z-index: 2000;
    display: none;
    flex-direction: column; /* Vertical stack: Header then Tree */
    overflow: hidden; /* Parent does not scroll */
    opacity: 0;
    transition: opacity 0.5s ease;
}

.academic-tree-overlay.active {
    opacity: 1;
}

.tree-header {
    flex-shrink: 0;
    height: 70px; /* Slimmer header */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
}

.tree-header h2 {
    font-size: 1.4rem; /* Smaller title */
    color: white;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
}

.btn-exit-tree {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-exit-tree:hover {
    background: white;
    color: #0f172a;
    transform: rotate(90deg);
}

.tree-container {
    display: flex;
    align-items: center;
    gap: 4rem;
    padding: 2rem 5rem;
    min-width: max-content;
}

/* Base Node Style - Minimalist Floating */
.branch-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    padding: 1.5rem;
    background: transparent;
    border: none;
    min-width: 140px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    opacity: 0.6;
    filter: grayscale(0.4);
}

.branch-node.active {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.1);
}

.branch-node:hover {
    transform: translateY(-8px) scale(1.15);
    opacity: 1;
    filter: grayscale(0);
}

.node-icon-box {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: all 0.4s ease;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.branch-node.active .node-icon-box {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 25px var(--node-color);
}

.node-info {
    text-align: center;
}

.node-title {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.node-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Colors */
.node-session { --node-color: #10b981; } /* Green */
.node-term { --node-color: #f59e0b; }    /* Amber */
.node-week { --node-color: #ec4899; }    /* Pink */

.branch-node .node-icon-box {
    background: var(--node-color);
}

/* Branch Groups */
.tree-level {
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    position: relative;
    padding: 3rem 1rem 3rem 5rem; /* Vertical padding inside the scrollable lane */
    justify-content: flex-start; /* Start from top to ensure all nodes are reachable */
    max-height: 75vh; /* Independent vertical lane height */
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbars for cleaner look */
    transition: all 0.5s ease;
    flex-shrink: 0; /* CRITICAL: Prevents overlapping on mobile */
    scroll-snap-align: center; /* Snap level to center of screen */
    min-width: 300px; /* Base width for desktop */
}

.tree-level::-webkit-scrollbar {
    display: none;
}

/* The Vertical Trunk */
.tree-level:not(.level-0)::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 2rem;
    bottom: 2rem;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sprout-animation {
    animation: sprout 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Horizontal Curved Connectors */
.branch-node::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 50%;
    width: 2.5rem;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%);
}

.branch-node::after {
    content: '';
    position: absolute;
    right: -3.5rem;
    top: 50%;
    width: 3.5rem;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%);
}

/* Remove connectors for end/start nodes */
.level-0 .branch-node::before,
.level-content .branch-node::after {
    display: none;
}

/* Active Path Glowing */
.branch-node.active::before,
.branch-node.active::after {
    background: var(--node-color, #6366f1);
    box-shadow: 0 0 10px var(--node-color, #6366f1);
    opacity: 0.8;
}

@keyframes sprout {
    from { opacity: 0; transform: translateX(-30px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.tree-container {
    flex: 1; /* Take all remaining vertical space */
    display: flex;
    align-items: center; /* Vertical alignment of the lanes */
    gap: 8rem; /* Increased gap for cleaner connectors */
    padding: 0 10vw;
    min-width: 100%;
    overflow-x: auto; /* Horizontal panning */
    overflow-y: hidden; /* Canvas itself doesn't scroll vertically anymore */
    scroll-behavior: smooth;
    position: relative;
    scrollbar-width: none;
    scroll-snap-type: x mandatory; /* Enable app-like snapping */
}

/* Custom Scrollbar for better visibility on dark background */
.tree-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.tree-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.tree-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.note-reader-header {
    padding: 1.5rem 3rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.note-reader-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #0f172a;
    font-weight: 800;
}

.btn-return-journey {
    padding: 0.6rem 1.2rem;
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-return-journey:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.note-reader-body {
    flex: 1;
    overflow-y: auto;
    padding: 4rem 6rem;
    background: #fff;
    font-family: 'Georgia', serif; /* Classic reading font */
}

@media (max-width: 768px) {
    .note-reader-body {
        padding: 2rem;
    }
    .note-reader-header {
        padding: 1rem 1.5rem;
    }
}


/* Workspace Internal Layouts */
.workspace-meta-badges {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.workspace-instructions-box {
    background: #f8fafc;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 2.5rem;
}

.workspace-instructions-box h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.workspace-actions {
    display: flex;
    justify-content: center;
}

.btn-launch-editor {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-launch-editor:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 25px -5px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.note-viewer {
    background: white;
    max-width: 800px;
    margin: 0 auto;
}

.note-viewer .ql-editor {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1.15rem;
    line-height: 1.8;
    color: #334155;
}

.obtained-score-badge {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.teacher-feedback-alert {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #1d4ed8;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.feedback-body {
    color: #1e40af;
    line-height: 1.6;
    font-style: italic;
    font-size: 1rem;
}



/* Notes Section (65%) */
.content-notes-section {
    flex: 0 0 65%;
    overflow-y: auto;
    padding: 2rem;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

.content-section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.content-section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notes-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.note-item {
    background: #ffffff;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.note-item h4 {
    margin: 0 0 1.25rem 0;
    font-size: 1.15rem;
    color: #1e293b;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.note-item h4::before {
    content: '';
    width: 4px;
    height: 1.25rem;
    background: #6366f1;
    border-radius: 99px;
}

/* Assignment Section (35%) */
.content-assignment-section {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #f8fafc;
    box-shadow: inset 10px 0 20px -10px rgba(0, 0, 0, 0.05);
}

.content-assignment-section .content-section-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
}

.assignment-scrollable-content {
    flex: 1;
    padding: 1.5rem 2rem;
}

.assignment-item {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.assignment-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.assignment-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.assignment-header-row h4 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 700;
    line-height: 1.4;
}

.assignment-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.assignment-status-badge.status-pending {
    background: #fffbeb;
    color: #b45309;
}

.assignment-status-badge.status-submitted {
    background: #f0fdf4;
    color: #15803d;
}

.assignment-status-badge.status-overdue {
    background: #fef2f2;
    color: #991b1b;
}

.assignment-status-badge.status-available {
    background: #eff6ff;
    color: #1d4ed8;
}

.assignment-status-badge.status-graded {
    background: #faf5ff;
    color: #7e22ce;
}

.assignment-deadline,
.assignment-max-score {
    margin: 0.5rem 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assignment-instructions {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    max-height: 200px;
    overflow-y: auto;
}

.assignment-instructions h4 {
    margin: 0 0 0.5rem 0;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    position: sticky;
    top: 0;
    background: #f9fafb;
    padding-bottom: 0.5rem;
}

.btn-submit-assignment {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    margin-top: 1rem;
}

.btn-submit-assignment:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.btn-submit-assignment:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit-assignment:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== CONTENT RENDERING ==================== */

/* Quill.js Read-Only Content */
.quill-rendered-content .ql-editor,
.assignment-instructions-content .ql-editor {
    font-size: var(--font-size-base);
    line-height: 1.8;
    color: var(--text-secondary);
}

.quill-rendered-content .ql-editor h1,
.assignment-instructions-content .ql-editor h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin: 1.5rem 0 1rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor h2,
.assignment-instructions-content .ql-editor h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin: 1.25rem 0 0.75rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor h3,
.assignment-instructions-content .ql-editor h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor h4,
.assignment-instructions-content .ql-editor h4 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    margin: 0.75rem 0 0.5rem 0;
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor p,
.assignment-instructions-content .ql-editor p {
    margin: 0.5rem 0;
}

.quill-rendered-content .ql-editor strong,
.assignment-instructions-content .ql-editor strong {
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.quill-rendered-content .ql-editor img,
.assignment-instructions-content .ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.quill-rendered-content .ql-editor ul,
.assignment-instructions-content .ql-editor ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.quill-rendered-content .ql-editor ul ul,
.assignment-instructions-content .ql-editor ul ul {
    padding-left: 2rem;
    list-style-type: circle;
}

.quill-rendered-content .ql-editor li,
.assignment-instructions-content .ql-editor li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.empty-content {
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.6;
    padding: 3rem 1rem;
    font-style: italic;
}

.empty-content p {
    margin: 0.5rem 0 0 0;
    font-size: var(--font-size-base);
}

.quill-image {
    margin: 1.5rem 0;
    text-align: center;
}

.quill-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .quill-image {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }

    .quill-image img {
        width: 100%;
        height: 250px;
        object-fit: cover;
    }
}

.quill-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.quill-list li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.6;
}

.quill-list.indent-1 {
    padding-left: 3rem;
    list-style-type: circle;
}

.quill-list.indent-2 {
    padding-left: 4.5rem;
    list-style-type: square;
}

/* ==================== SUBMISSION MODAL ==================== */

.submission-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.submission-modal-content {
    background: #ffffff;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(20px);
    opacity: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.submission-modal-overlay.active .submission-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Tablet & Desktop sizes */
@media (min-width: 768px) and (max-width: 1024px) {
    .submission-modal-content {
        width: 90vw;
        height: 90vh;
    }
}

@media (min-width: 1024px) {
    .submission-modal-content {
        width: 85vw;
        height: 85vh;
        max-width: 1200px;
    }
}

/* Mobile: Full screen with dynamic viewport height */
@media (max-width: 767px) {
    .submission-modal-content {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        border-radius: 0;
    }

    .submission-modal-header {
        padding: 1rem 1.25rem;
    }

    .submission-modal-header h2 {
        font-size: 1.15rem;
    }

    .submission-instructions-section {
        padding: 1rem 1.25rem;
        max-height: 35vh;
    }

    .submission-instructions-content {
        max-height: 200px;
    }

    .submission-editor-section {
        padding: 1rem 1.25rem;
    }

    .submission-modal-footer {
        padding: 0.875rem 1.25rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-save-submission {
        width: 100%;
        min-width: auto;
    }

    #submission-status-message {
        width: 100%;
        text-align: center;
    }
}

.submission-modal-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-bottom: 2px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.submission-modal-header h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #15803d;
}

.submission-modal-header h2 i {
    color: #16a34a;
    font-size: 1.4rem;
}

.btn-close-modal {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

.submission-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    background: #f8fafc;
}

/* Instructions Section */
.submission-instructions-section {
    background: white;
    border-bottom: 2px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
    max-height: 40vh;
    overflow-y: auto;
}

.submission-instructions-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.submission-instructions-section h3 i {
    color: #3b82f6;
}

.submission-deadline,
.submission-max-score {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-right: 0.5rem;
}

.submission-deadline {
    background: #fef3c7;
    color: #92400e;
}

.submission-deadline i {
    color: #f59e0b;
}

.submission-max-score {
    background: #dbeafe;
    color: #1e40af;
}

.submission-max-score i {
    color: #3b82f6;
}

.submission-instructions-content {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
}

.submission-instructions-content .ql-editor {
    padding: 0;
}

.tooltip-container {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    overflow: visible;
}

.tooltip-popover {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    width: max-content;
    max-width: 400px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.tooltip-container:hover .tooltip-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-popover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #3b82f6, #2563eb);
}

.submission-instructions-content {
    padding: 1.25rem;
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
}

.submission-instructions-content .ql-editor {
    padding: 0;
}

.submission-meta-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.instructions-badge {
    background: #f1f5f9;
    color: #2e7d32;
    border: none;
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
    cursor: default;
    transition: all 0.2s ease;
}

.instructions-badge:hover {
    background: #e2e8f0;
    color: #1b5e20;
}

.deadline-badge {
    background: #fffbeb;
    color: #b45309;
}

.deadline-badge i {
    color: #f59e0b;
}

.score-badge {
    background: #f0fdf4;
    color: #15803d;
}

.score-badge i {
    color: #22c55e;
}

/* Editor Section */
.submission-editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    padding: 1.25rem 1.5rem;
    min-height: 0;
    overflow: hidden;
}

.editor-header-badges {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

#submission-quill-editor {
    flex: 1;
    background: white;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.submission-editor-section h3 i {
    color: #16a34a;
}

#submission-quill-editor .ql-toolbar {
    border: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    background: #f8fafc;
    padding: 0.65rem 1rem !important;
}

#submission-quill-editor .ql-container {
    border: none !important;
    font-size: 1rem;
    font-family: inherit;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#submission-quill-editor .ql-editor {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    color: #334155;
    line-height: 1.7;
}

#submission-quill-editor .ql-editor.ql-blank::before {
    color: #94a3b8;
    font-style: normal;
    left: 1.25rem;
}

/* Image scaling in editor */
#submission-quill-editor .ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Quill Tooltip Fixes */
.ql-snow .ql-tooltip {
    z-index: 3000 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
    padding: 8px 12px !important;
}

.ql-snow .ql-tooltip input[type=text] {
    border-radius: 4px !important;
    border: 1px solid #cbd5e1 !important;
    padding: 4px 8px !important;
}

/* Adjust tooltip when near right edge */
.ql-snow .ql-tooltip.ql-flip {
    transform: translateX(-90%) !important;
}

/* Tiny Inline Editor Spinner */
.inline-editor-spinner {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.submission-modal-footer {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
}

#submission-status-message {
    flex: 1;
}

.btn-save-submission {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    min-width: 180px;
}

.btn-save-submission:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.btn-save-submission:active:not(:disabled) {
    transform: translateY(0);
}

.btn-save-submission:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-save-submission.btn-submitted {
    background: #94a3b8 !important;
    color: #f8fafc !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.8;
}

/* Status Messages */
.status-success,
.status-graded {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-graded {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.status-submitted {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ==================== LOADING & EMPTY STATES ==================== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.spinner-small {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.content-modal-header {
    padding: 1.25rem 2.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-text h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.header-subtitle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.header-subtitle .separator {
    color: #cbd5e1;
}

.header-subtitle i {
    color: #6366f1;
}

.btn-back-modal {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f1f5f9;
    border: none;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateX(-3px);
}

.empty-icon-wrapper {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    font-size: 2.5rem;
    color: #cbd5e1;
}

.empty-content {
    text-align: center;
    padding: 4rem 2rem;
    color: #94a3b8;
}

.empty-content p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

/* Quill Disabled State */
.ql-container.ql-disabled {
    background-color: #f8fafc;
    border-color: #e2e8f0 !important;
}

.ql-container.ql-disabled .ql-editor {
    color: #64748b;
    cursor: not-allowed;
}

.submission-editor-wrapper.locked {
    position: relative;
}

.submission-editor-wrapper.locked::after {
    content: 'Read Only';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #64748b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10;
    pointer-events: none;
}

.grading-badges-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto; /* Push to the right */
}

/* Compact Grading UI */
.obtained-score-badge {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0.5rem 0.875rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid #bfdbfe;
    box-shadow: 0 2px 4px rgba(29, 78, 216, 0.1);
}

.comment-pulsing-btn {
    background: #fdf2f8;
    color: #db2777;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #fbcfe8;
    position: relative;
    transition: all 0.2s ease;
}

.comment-pulsing-btn:hover {
    background: #fbcfe8;
    transform: scale(1.1);
}

.comment-pulsing-btn.pulse {
    animation: commentPulse 2s infinite;
}

@keyframes commentPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(219, 39, 119, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(219, 39, 119, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(219, 39, 119, 0);
    }
}

/* Tooltip Styling */
.comment-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #1e293b;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    width: 250px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
    line-height: 1.5;
    font-style: italic;
}

.comment-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 10px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #1e293b transparent;
}

.comment-pulsing-btn:hover .comment-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.comment-tooltip h5 {
    margin: 0 0 4px 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-style: normal;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */

@media (max-width: 768px) {
    .weeks-modal-content {
        max-height: 90vh;
        border-radius: 12px;
    }

    .content-modal-content {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .content-notes-section {
        flex: 0 0 auto;
        padding: 1rem;
        min-height: 50vh;
    }

    .content-assignment-section {
        flex: 0 0 auto;
        padding: 1rem;
        min-height: 40vh;
    }

    .content-modal-header h2 {
        font-size: var(--font-size-lg);
    }
}

@media (max-width: 480px) {
    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .subject-card-name {
        font-size: var(--font-size-base);
    }

    .weeks-modal-header h2 {
        font-size: var(--font-size-xl);
    }

    /* Assignment items more compact on mobile */
    .assignment-item {
        padding: 1rem;
    }

    .assignment-instructions {
        max-height: 150px;
    }

    .btn-submit-assignment {
        padding: 0.75rem 1rem;
        font-size: var(--font-size-sm);
    }
}

@media (min-width: 1024px) {
    .content-modal-body {
        flex-direction: row;
    }

    .content-notes-section {
        flex: 0 0 65%;
        border-bottom: none;
        border-right: 2px solid #e5e7eb;
    }

    .content-assignment-section {
        flex: 0 0 35%;
        border-top: none;
    }
}
/* Mobile Optimization for Tree Journey */
@media (max-width: 768px) {
    .tree-level {
        min-width: 85vw;
        padding-left: 3rem;
    }
    
    .tree-container {
        gap: 12rem;
        padding: 0 7.5vw;
    }
    
    .branch-node {
        font-size: 0.9rem;
    }

    .tree-header h2 {
        font-size: 1.1rem;
    }
}

.submission-editor-wrapper.locked[data-lock-reason=" Overdue\]::after {
 content: \Overdue\;
 background: #ef4444;
 color: white;
 padding: 4px 10px;
 border-radius: 6px;
 font-size: 11px;
 font-weight: 700;
 text-transform: uppercase;
 z-index: 10;
 pointer-events: none;
 box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
