.lib-device-card {
    background: #ffffff;
    border: 1px solid var(--db-border, #e2e8f0);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all .3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 8px 24px rgba(149, 157, 165, 0.15);
}

.lib-device-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(149, 157, 165, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
}

.lib-device-card-thumb {
    position: relative;
    width: calc(100% - 10px);
    margin: 5px 5px 0 5px;
    aspect-ratio: 1.6;
    overflow: hidden;
    background: #f8fafc;
    border-radius: 11px;
    border: none;
}

.lib-device-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all .2s;
}

.lib-device-card:hover .lib-device-card-thumb img {
    transform: scale(1.05);
}

.lib-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    z-index: 5;
    letter-spacing: 0.04em;
}

.badge-blue { background: #3b82f6; }
.badge-green { background: #10b981; }
.badge-orange { background: #f59e0b; }

.lib-card-fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    transition: all .2s;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.lib-card-fav-btn:hover {
    transform: scale(1.15);
    color: #ef4444;
}

.lib-card-fav-btn.active {
    color: #ef4444;
}

.lib-card-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all .3s ease;
    z-index: 3;
}

.lib-device-card:hover .lib-card-play-overlay {
    background: rgba(0, 0, 0, 0.25);
}

.lib-card-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 2.5px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #4f46e5;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(2px);
    transform: scale(0.9);
    transition: all .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lib-device-card:hover .lib-card-play-btn {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.lib-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.lib-card-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.lib-card-meta {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lib-card-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--db-border, #e2e8f0);
    padding-top: 12px;
    margin-top: auto;
    font-size: 13px;
    color: #64748b;
}

.lib-card-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* K12 Edu Template CSS */
:root {
    --primary: #0076c8;
    --primary-light: #e0f2fe;
    --primary-dark: #0369a1;
    --secondary: #f97316;
    --text-main: #334155;
    --text-muted: #64748b;
    --bg-main: #f1f5f9;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    /* Aliases for legacy k12 variables used in profile/dashboard views */
    --k12-primary: var(--primary);
    --k12-primary-light: var(--primary-light);
    --k12-text: var(--text-main);
    --k12-muted: var(--text-muted);
    --k12-border: var(--border-color);
    --k12-radius: var(--radius-md);
}

body.k12edu-body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden; /* layout handles scrolling */
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    color: #0f172a;
}

/* TOP HEADER */
.k12edu-top-header {
    height: 60px;
    background: var(--primary);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 70px; /* Adjusted for mini sidebar */
    width: calc(100% - 70px);
    z-index: 1000;
}

.k12edu-logo-area {
    width: 250px;
    flex-shrink: 0;
}

.k12edu-search-area {
    flex-grow: 1;
    padding: 0 40px;
}

.k12edu-user-area {
    width: 300px;
    flex-shrink: 0;
}

/* MINI SIDEBAR */
.k12edu-mini-sidebar {
    width: 70px;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1010;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

.k12edu-mini-sidebar .logo {
    width: 40px;
    height: 40px;
    margin-bottom: 20px;
    object-fit: contain;
}

.k12edu-mini-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
    text-decoration: none;
}

.k12edu-mini-link:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.k12edu-mini-link.active {
    background: var(--primary);
    color: white;
}

/* LAYOUT STRUCTURE */
.k12edu-layout {
    display: flex;
    margin-top: 60px;
    margin-left: 70px;
    height: calc(100vh - 60px);
    width: calc(100% - 70px);
}

/* SIDEBAR */
.k12edu-sidebar {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.k12edu-sidebar::-webkit-scrollbar {
    width: 4px;
}
.k12edu-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.k12edu-sidebar-home-btn {
    display: block;
    background: var(--primary);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    text-align: center;
    line-height: 44px;
    margin: 16px 16px 0;
    transition: all 0.2s;
}
.k12edu-sidebar-home-btn:hover {
    background: var(--primary-dark);
    color: white;
}

.k12edu-sidebar-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 0.5px;
}

.k12edu-grade-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.k12edu-grade-badge {
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    color: white;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}
.k12edu-grade-badge:hover {
    transform: scale(1.05);
    color: white;
}

.k12edu-subject-badge {
    display: inline-block;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    margin: 0 4px 8px 0;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}
.k12edu-subject-badge:hover {
    transform: scale(1.05);
    color: white;
}

.k12edu-type-list li a:hover {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
}

/* MAIN WRAPPER */
.k12edu-main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* SECONDARY NAV */
.k12edu-nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    transition: color 0.2s;
}
.k12edu-nav-link:hover {
    color: var(--primary);
}
.k12edu-nav-link.active {
    color: var(--primary);
}
.k12edu-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}

/* CONTENT AREA */
.k12edu-content {
    overflow-y: auto;
}

.k12edu-content::-webkit-scrollbar {
    width: 8px;
}
.k12edu-content::-webkit-scrollbar-track {
    background: transparent;
}
.k12edu-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.k12edu-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* UTILITIES */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

.k12edu-material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.k12edu-card-title:hover { color: var(--primary) !important; }

.k12edu-section-title {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    position: relative;
    padding-left: 16px;
    display: flex;
    align-items: center;
    letter-spacing: -0.5px;
}

.k12edu-section-title::before {
    content: '';
    position: absolute;
    left: 0;
    width: 6px;
    height: 22px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 118, 200, 0.25);
}

/* ===== DEVICE LIBRARY & SEARCH PAGES STYLES (MAPPED TO K12EDU TOKENS) ===== */
.lib-page-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* Left Sidebar */
.lib-left-sidebar {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 88px;
    height: calc(100vh - 120px);
    overflow-y: auto;
}

.lib-sidebar-section {
    display: flex;
    flex-direction: column;
}

.lib-sidebar-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    padding-left: 8px;
}

.lib-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lib-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
    border-bottom: 1px solid #cbd5e1;
    text-decoration: none;
}

.lib-sidebar-item:last-child {
    border-bottom-color: transparent;
}

.lib-sidebar-item:hover {
    background: #f8fafc;
    color: var(--primary);
    transform: translateX(4px);
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.lib-sidebar-item.active {
    background: linear-gradient(135deg, rgba(0, 118, 200, 0.08) 0%, rgba(0, 118, 200, 0.02) 100%);
    color: var(--primary);
    font-weight: 700;
    border-color: rgba(0, 118, 200, 0.15);
    box-shadow: 0 4px 12px rgba(0, 118, 200, 0.05);
}

.lib-sidebar-item > span.me-2\.5,
.lib-sidebar-item > i.me-2\.5 {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px !important;
}

.lib-sidebar-item:hover > span.me-2\.5,
.lib-sidebar-item:hover > i.me-2\.5 {
    transform: scale(1.08) rotate(-2deg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.lib-sidebar-item.active > span.me-2\.5,
.lib-sidebar-item.active > i.me-2\.5 {
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 118, 200, 0.15);
}

.rotate-180 {
    transform: rotate(180deg) !important;
}

.lib-collection-card {
    background: #f3e8ff;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all .2s;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.lib-collection-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15);
}

.lib-collection-info {
    display: flex;
    flex-direction: column;
}

.lib-collection-title {
    font-size: 14px;
    font-weight: 700;
    color: #7c3aed;
}

.lib-collection-subtitle {
    font-size: 12px;
    color: #a855f7;
    margin-top: 2px;
}

/* Main Content Area */
.lib-main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.lib-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.lib-title {
    font-size: 25px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.lib-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.lib-total-count {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Filter Bar */
.lib-filter-bar {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.lib-filter-input-wrapper {
    position: relative;
    width: 100%;
}

.lib-filter-input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all .18s;
}

.lib-filter-input-wrapper input:focus {
    border-color: var(--primary);
}

.lib-filter-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.lib-filter-select {
    width: 100%;
    padding: 10px 24px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 8px center;
    background-size: 14px;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all .18s;
}

.lib-filter-select:focus {
    border-color: var(--primary);
}

.lib-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s;
    height: 38px;
    white-space: nowrap;
}

.lib-filter-btn:hover {
    background: var(--primary-light);
}

/* Quick Filter Buttons */
.lib-quick-filters-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.lib-quick-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.lib-quick-tab {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    transition: all .18s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lib-quick-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.lib-quick-tab.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.lib-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lib-view-toggle {
    display: flex;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.lib-view-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .18s;
}

.lib-view-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}

.lib-sort-select {
    padding: 8px 24px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    font-weight: 600;
    color: var(--text-main);
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 8px center;
    background-size: 14px;
    -webkit-appearance: none;
    cursor: pointer;
    width: 160px;
}

/* Lưới card học liệu */
.lib-device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Lưới dạng danh sách (List View) */
.lib-device-grid.list-view {
    grid-template-columns: 1fr;
    gap: 16px;
}

.lib-device-grid.list-view .lib-device-card {
    flex-direction: row !important;
    align-items: center;
    height: 140px;
}

.lib-device-grid.list-view .lib-device-card-thumb {
    width: 210px;
    height: calc(100% - 10px);
    margin: 5px 0 5px 5px !important;
    aspect-ratio: auto;
    border: none !important;
    border-radius: 11px;
}

.lib-device-grid.list-view .lib-card-body {
    padding: 16px 24px;
}

/* Phân trang (Pagination) */
.lib-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 12px;
}

.lib-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lib-pagination-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s;
}

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

.lib-pagination-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.lib-pagination-ellipsis {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 700;
}

/* Library Responsive adjustments */
@media (max-width: 1024px) {
    .lib-page-layout {
        grid-template-columns: 1fr;
    }
    .lib-left-sidebar {
        height: auto;
        position: relative;
        top: 0;
    }
}

@media (max-width: 800px) {
    .lib-filter-bar {
        grid-template-columns: 1fr 1fr;
    }
    .lib-filter-btn {
        grid-column: span 2;
    }
}

@media (max-width: 580px) {
    .lib-quick-filters-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .lib-controls {
        width: 100%;
        justify-content: space-between;
    }
    .lib-device-grid.list-view .lib-device-card {
        flex-direction: column !important;
        height: auto;
    }
    .lib-device-grid.list-view .lib-device-card-thumb {
        width: 100%;
        aspect-ratio: 1.6;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

/* ===== PERSONAL COLLECTIONS PAGE STYLING (MAPPED TO K12EDU TOKENS) ===== */
.collections-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 260px;
    flex-shrink: 0;
}

.collections-main-content {
    min-width: 0;
    flex-grow: 1;
}

.teacher-profile-card {
    padding: 10px 0 20px 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.teacher-avatar-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    margin-bottom: 12px;
    transition: transform 0.3s ease;
}

.teacher-profile-card:hover .teacher-avatar-circle {
    transform: scale(1.05);
}

.teacher-name {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.teacher-title {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.teacher-view-profile-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.teacher-view-profile-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Sidebar navigation */
.teacher-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 0 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.teacher-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.teacher-nav-item i {
    font-size: 17px;
    transition: transform 0.2s;
}

.teacher-nav-item:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.teacher-nav-item:hover i {
    transform: translateX(2px);
}

.teacher-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

/* Recent collections widget */
.recent-collections-widget {
    padding: 0;
}

.recent-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.recent-widget-title {
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-main);
}

.recent-widget-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.recent-widget-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-widget-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.recent-widget-item:hover {
    opacity: 0.85;
}

.recent-widget-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.recent-widget-icon.blue { background: #eff6ff; color: #3b82f6; }
.recent-widget-icon.red { background: #fef2f2; color: #ef4444; }
.recent-widget-icon.green { background: #ecfdf5; color: #10b981; }

.recent-widget-info {
    flex: 1;
    min-width: 0;
}

.recent-widget-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-widget-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.create-col-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    border: 1.5px dashed var(--primary);
    color: var(--primary);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.create-col-btn:hover {
    background: var(--primary-light);
    border-style: solid;
}

/* Stats Cards Grid */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
}

.stat-card-icon-wrapper.blue { background: #eef2ff; color: #3b82f6; }
.stat-card-icon-wrapper.green { background: #f0fdf4; color: #22c55e; }
.stat-card-icon-wrapper.purple { background: #faf5ff; color: #a855f7; }
.stat-card-icon-wrapper.red { background: #fff5f5; color: #ef4444; }

.stat-card-info {
    flex: 1;
}

.stat-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-card-value {
    font-family: 'Inter', sans-serif;
    font-size: 23px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Tab filter line & controls */
.collections-tabs-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    padding-bottom: 1px;
    flex-wrap: wrap;
    gap: 16px;
}

.collections-tabs {
    display: flex;
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.collections-tab-link {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 4px;
    position: relative;
    display: inline-block;
    transition: color 0.2s;
}

.collections-tab-link:hover {
    color: var(--primary);
}

.collections-tab-link.active {
    color: var(--primary);
    font-weight: 700;
}

.collections-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.collections-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.col-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 220px;
}

.col-search-input {
    width: 100%;
    padding: 6px 12px 6px 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: #fff;
    transition: all 0.2s;
}

.col-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 118, 200, .08);
}

.col-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.col-sort-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-main);
    background: #fff;
    outline: none;
    cursor: pointer;
}

.view-toggle-btns {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}

.view-toggle-btn {
    border: none;
    background: none;
    padding: 6px 10px;
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.view-toggle-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Collection Grid & Cards */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.collection-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    height: 100%;
}

.collection-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.collection-image-wrapper {
    width: 100%;
    aspect-ratio: 1.6;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
}

.collection-status-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    z-index: 2;
}

.collection-status-tag i {
    font-size: 13px;
}

.collection-status-tag.public i { color: #3b82f6; }
.collection-status-tag.private i { color: #6b7280; }

.collection-options-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    z-index: 2;
}

.collection-options-btn:hover {
    color: var(--primary);
    background: #fff;
    transform: scale(1.05);
}

.collection-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.collection-card-title {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.3;
}

.collection-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.collection-card-title a:hover {
    color: var(--primary);
}

.collection-card-desc {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
}

.collection-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    margin-top: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.collection-stat-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.collection-stat-indicator i {
    font-size: 14px;
}

/* Vector Illustration Graphics in CSS */
.vector-illustration {
    width: 100%;
    height: 100%;
    max-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.collection-card:hover .vector-illustration {
    transform: scale(1.06);
}

/* List view styling */
.collections-grid.list-view {
    grid-template-columns: 1fr;
    gap: 16px;
}

.collections-grid.list-view .collection-card {
    flex-direction: row;
    height: auto;
    align-items: center;
}

.collections-grid.list-view .collection-image-wrapper {
    width: 200px;
    aspect-ratio: 1.5;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    padding: 16px;
}

.collections-grid.list-view .collection-body {
    padding: 16px 24px;
    flex-grow: 1;
}

.collections-grid.list-view .collection-card-desc {
    margin-bottom: 8px;
    height: auto;
    -webkit-line-clamp: 1;
}

.collections-grid.list-view .collection-footer {
    border-top: none;
    padding-top: 0;
    margin-top: 4px;
    justify-content: flex-start;
    gap: 24px;
}

/* Collection Details Page Breadcrumb Override */
.collections-breadcrumb {
    margin-bottom: 16px;
}

/* Responsive adjustment for collections */
@media (max-width: 768px) {
    .stats-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .collections-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .collections-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .collections-grid {
        grid-template-columns: 1fr;
    }
    .collections-tabs-row {
        flex-direction: column;
        align-items: stretch;
    }
    .collections-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .col-search-wrapper {
        width: 100%;
    }
    .collections-grid.list-view .collection-card {
        flex-direction: column;
    }
    .collections-grid.list-view .collection-image-wrapper {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}


/* ===== MIGRATED PROFILE & DASHBOARD OVERVIEW CLASSES ===== */
.activity-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.activity-icon-wrapper.blue { background: #eff6ff; color: #3b82f6; }
.activity-icon-wrapper.green { background: #ecfdf5; color: #10b981; }
.activity-icon-wrapper.purple { background: #faf5ff; color: #a855f7; }
.activity-icon-wrapper.orange { background: #fff7ed; color: #f97316; }
.activity-info {
    flex-grow: 1;
    font-size: 13px;
    line-height: 1.4;
}
.activity-text {
    color: var(--k12-text);
    margin-bottom: 2px;
}
.activity-text strong {
    font-weight: 700;
    color: var(--k12-primary);
}
.activity-time {
    font-size: 11px;
    color: var(--k12-muted);
}
.chart-card-box {
    background: #fff;
    border: 1px solid var(--k12-border);
    border-radius: var(--k12-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.chart-card-title {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--k12-text);
    margin: 0;
}
.chart-select-sm {
    padding: 4px 8px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid var(--k12-border);
    border-radius: 6px;
    background: #fff;
    outline: none;
    cursor: pointer;
}
.charts-analysis-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}
@media (max-width: 1200px) {
    .charts-analysis-grid {
        grid-template-columns: 1fr;
    }
}
.donut-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.donut-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.donut-legend-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--k12-text);
}
.donut-legend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    font-size: 12.5px;
}
.donut-legend-val {
    font-weight: 700;
    color: var(--k12-muted);
}
.k12-breadcrumb { font-size: 13px; }
.k12-breadcrumb a { color: var(--k12-muted); text-decoration: none; }
.k12-breadcrumb a:hover { color: var(--k12-primary); }
.k12-breadcrumb span { color: var(--k12-primary); font-weight: 700; }
.metric-trend-item {
    display: flex;
    flex-direction: column;
}
.metric-trend-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--k12-muted);
    margin-bottom: 2px;
}
.metric-trend-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--k12-text);
}
.metrics-trend-header {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}
.orange { background: #fff7ed; color: #f97316; }
.progress-grade-bar-fill {
    height: 100%;
    background: var(--k12-primary);
    border-radius: 4px;
    transition: width 0.6s ease;
}
.progress-grade-bar-wrapper {
    flex-grow: 1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}
.progress-grade-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
}
.progress-grade-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    justify-content: space-between;
}
.progress-grade-name {
    width: 48px;
    font-weight: 600;
    color: var(--k12-text);
}
.progress-grade-val {
    width: 44px;
    text-align: right;
    font-weight: 700;
    color: var(--k12-muted);
}
.recent-activity-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.recent-activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.teacher-detail-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--k12-primary-light);
    flex-shrink: 0;
}
.teacher-detail-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.teacher-detail-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--k12-muted);
}
.teacher-detail-info-item i {
    font-size: 15px;
    color: var(--k12-primary);
}
.teacher-profile-detail-card {
    background: #fff;
    border: 1px solid var(--k12-border);
    border-radius: var(--k12-radius);
    padding: 24px;
    display: flex;
    gap: 24px;
    align-items: center;
}

/* ===== MIGRATED & OPTIMIZED DEVICE CARD MOCKUP STYLES ===== */
.lib-card-body {
    padding: 12px 16px 16px 16px !important;
}

.lib-card-title {
    font-size: 15.5px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin-bottom: 8px !important;
}

.lib-card-meta {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
}

.lib-meta-grade-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.lib-meta-subject {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}

.lib-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    margin-top: auto;
}

.lib-card-topic-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.lib-card-topic-pill.topic-blue { background: #eff6ff; color: #1d4ed8; }
.lib-card-topic-pill.topic-cyan { background: #ecfeff; color: #0891b2; }
.lib-card-topic-pill.topic-orange { background: #fff7ed; color: #ea580c; }
.lib-card-topic-pill.topic-green { background: #f0fdf4; color: #16a34a; }
.lib-card-topic-pill.topic-purple { background: #faf5ff; color: #9333ea; }
.lib-card-topic-pill.topic-red { background: #fef2f2; color: #dc2626; }
.lib-card-topic-pill.topic-teal { background: #f0fdfa; color: #0d9488; }

.lib-card-metrics-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
}

.lib-card-metric-item {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 4px;
}

.lib-card-metric-item i {
    font-size: 13px;
}

.lib-card-badge.badge-orange { background: #b45309 !important; }
.lib-card-badge.badge-green { background: #22c55e !important; }

/* Grade & Subject overlay on card thumbnail */
.lib-device-card-thumb .lib-card-meta {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 5;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 0 !important;
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lib-device-card:hover .lib-device-card-thumb .lib-card-meta {
    opacity: 1;
}

.lib-device-card-thumb .lib-meta-grade-badge,
.lib-device-card-thumb .lib-meta-subject {
    background: rgba(255, 255, 255, 0.85) !important;
    color: #1e293b !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 3px 8px !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Pricing Badges */
.lib-card-price-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lib-card-price-badge.price-free {
    background: #e6f4ea !important;
    color: #137333 !important;
}

.lib-card-price-badge.price-paid {
    background: #fce8e6 !important;
    color: #c5221f !important;
}

.lib-card-price-badge.price-purchased {
    background: #e6f4ea !important;
    color: #137333 !important;
}

.lib-card-price-badge.price-pending {
    background: #fef7e0 !important;
    color: #b06000 !important;
}
