/* ================================================
   KHO HỌC LIỆU SỐ - TRƯỜNG TIỂU HỌC NÚI THÀNH
   Design System & Complete Styles
   ================================================ */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
    /* Typography */
    --font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.2);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.25);
    
    /* Layout */
    --header-height: 64px;
    --sidebar-width: 280px;
    --container-max: 1200px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4f46e5, #7c3aed);
    --gradient-secondary: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

/* Dark Theme (Default) */
[data-theme="dark"] {
    --bg-primary: #0a0e27;
    --bg-secondary: #111539;
    --bg-surface: #181d42;
    --bg-card: rgba(24, 29, 66, 0.8);
    --bg-hover: rgba(255,255,255,0.05);
    --bg-input: rgba(255,255,255,0.06);
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    --border-color: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    
    --glass-bg: rgba(255,255,255,0.04);
    --glass-border: rgba(255,255,255,0.08);
    
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-soft: rgba(99, 102, 241, 0.15);
    
    --accent: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-hover: rgba(0,0,0,0.04);
    --bg-input: rgba(0,0,0,0.04);
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;
    
    --border-color: rgba(0,0,0,0.08);
    --border-hover: rgba(0,0,0,0.15);
    
    --glass-bg: rgba(255,255,255,0.7);
    --glass-border: rgba(0,0,0,0.08);
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: rgba(79, 70, 229, 0.1);
    
    --accent: #0891b2;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); }

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

ul, ol { list-style: none; }

/* ---- Utilities ---- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm { max-width: 800px; }

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.required { color: var(--danger); }
.text-danger { color: var(--danger) !important; }
.mt-2 { margin-top: var(--space-xl); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

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

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}
.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ---- Card ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

/* ================================================
   HEADER
   ================================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 1000;
    transition: background var(--transition-base);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
}
.logo:hover { color: var(--text-primary); }

.logo-img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title {
    font-size: 0.95rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-center {
    flex: 1;
    max-width: 520px;
    margin: 0 var(--space-xl);
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0 var(--space-md);
    transition: all var(--transition-base);
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: var(--bg-surface);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    padding: 0.55rem 0.6rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
}
.search-bar input::placeholder { color: var(--text-muted); }

.search-shortcut {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.notification-btn { position: relative; }
.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Theme Toggle Icons */
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* User Area */
.btn-login {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
}

.user-menu { position: relative; }

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
.user-avatar-btn:hover { background: var(--bg-hover); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 1001;
}
.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 100%;
    text-align: left;
    transition: background var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-xs) 0;
}

/* Notification Dropdown */
.notification-dropdown {
    width: 360px;
    max-width: 90vw;
    padding: 0;
    right: 0;
    overflow: hidden;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.notification-header-title {
    font-weight: 700;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.btn-mark-all {
    font-size: 0.75rem;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    background: none;
    border: none;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.btn-mark-all:hover {
    background: var(--primary-soft);
}

.notification-list {
    max-height: 340px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-decoration: none;
    color: inherit;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background: var(--bg-hover);
}
.notification-item.unread {
    background: var(--primary-soft);
}

.notification-icon-box {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.notification-body {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 3px;
    word-break: break-word;
}
.notification-text strong {
    color: var(--primary);
}

.notification-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.notification-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notification-footer {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    text-align: center;
}

.notification-footer-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.notification-footer-link:hover {
    text-decoration: underline;
}

/* ================================================
   SIDEBAR
   ================================================ */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 900;
    transform: translateX(0);
    transition: transform var(--transition-base);
    overflow: hidden;
}

.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm) 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* Category Tree */
.tree-item > .tree-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.55rem var(--space-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border-left: 3px solid transparent;
}
.tree-item > .tree-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
}
.tree-item > .tree-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-left-color: var(--primary);
}

.tree-icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.tree-toggle {
    margin-left: auto;
    transition: transform var(--transition-fast);
    color: var(--text-muted);
    flex-shrink: 0;
}
.tree-item.open > .tree-link .tree-toggle { transform: rotate(90deg); }

.sub-tree {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}
.tree-item.open > .sub-tree {
    max-height: 500px;
}

.sub-tree .tree-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.4rem var(--space-lg);
    padding-left: calc(var(--space-lg) + 28px);
    color: var(--text-secondary);
    font-size: 0.82rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.sub-tree .tree-link:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.sub-tree .sub-tree .tree-link {
    padding-left: calc(var(--space-lg) + 50px);
    font-size: 0.78rem;
}

.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
.btn-upload-sidebar { width: 100%; justify-content: center; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 899;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ================================================
   MAIN CONTENT
   ================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    transition: margin-left var(--transition-base);
    padding-bottom: var(--space-2xl);
}
.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content {
    margin-left: 0;
}

.footer {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
}
.sidebar.collapsed ~ .footer,
body.sidebar-collapsed .footer {
    margin-left: 0;
}

/* Pages */
.page {
    display: none;
    animation: fadeInUp 0.4s ease;
}
.page.active { display: block; }

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

.page-header {
    padding: var(--space-xl) 0;
}
.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: var(--space-xs);
}
.page-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ================================================
   HERO SECTION
   ================================================ */
.hero {
    position: relative;
    padding: var(--space-3xl) var(--space-xl);
    overflow: hidden;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
    z-index: 0;
}

.hero-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}
.hero-shape-1 {
    width: 300px;
    height: 300px;
    background: #4f46e5;
    top: -50px;
    right: 10%;
    animation: heroFloat 8s ease-in-out infinite;
}
.hero-shape-2 {
    width: 250px;
    height: 250px;
    background: #7c3aed;
    bottom: -30px;
    left: 15%;
    animation: heroFloat 10s ease-in-out infinite reverse;
}
.hero-shape-3 {
    width: 200px;
    height: 200px;
    background: #06b6d4;
    top: 30%;
    left: 50%;
    animation: heroFloat 12s ease-in-out infinite;
}

@keyframes heroFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: var(--space-lg);
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: white;
    line-height: 1.15;
    margin-bottom: var(--space-md);
}
.hero-title .gradient-text {
    background: linear-gradient(135deg, #22d3ee, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.7;
    margin-bottom: var(--space-xl);
}

.hero-search {
    max-width: 560px;
    margin: 0 auto var(--space-lg);
}

.hero-search-inner {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    backdrop-filter: blur(10px);
    transition: all var(--transition-base);
    gap: var(--space-sm);
}
.hero-search-inner:focus-within {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}
.hero-search-inner svg { color: rgba(255,255,255,0.5); flex-shrink: 0; }
.hero-search-inner input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 0.95rem;
    padding: 0.4rem 0;
}
.hero-search-inner input::placeholder { color: rgba(255,255,255,0.45); }
.hero-search-inner .btn {
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}
.hero-tag {
    padding: 0.3rem 0.8rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.hero-tag:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ================================================
   STATS SECTION
   ================================================ */
.stats-section {
    padding: var(--space-2xl) 0;
    margin-top: -40px;
    position: relative;
    z-index: 2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon-docs { background: var(--primary-soft); color: var(--primary); }
.stat-icon-teachers { background: rgba(34, 211, 238, 0.12); color: var(--accent); }
.stat-icon-downloads { background: rgba(52, 211, 153, 0.12); color: var(--success); }
.stat-icon-stars { background: rgba(251, 191, 36, 0.12); color: var(--warning); }

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    display: block;
    line-height: 1.1;
}
.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ================================================
   SECTIONS (Categories, Recent, Leaderboard)
   ================================================ */
.categories-section,
.recent-section,
.leaderboard-section {
    padding: var(--space-xl) 0;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.section-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    transition: all var(--transition-fast);
}
.section-link:hover {
    color: var(--primary-hover);
    transform: translateX(4px);
    display: inline-block;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}
.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.category-card:hover::before { opacity: 0.06; }

.category-icon {
    font-size: 2.2rem;
    line-height: 1;
    position: relative;
}

.category-name {
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
}

.category-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    position: relative;
}

/* Documents Grid */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    backdrop-filter: blur(8px);
    cursor: pointer;
}
.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.doc-card-header {
    padding: var(--space-md) var(--space-md) var(--space-sm);
    display: flex;
    align-items: start;
    gap: var(--space-sm);
}

.doc-type-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.doc-type-docx { background: rgba(59, 130, 246, 0.15); }
.doc-type-pptx { background: rgba(239, 68, 68, 0.15); }
.doc-type-pdf { background: rgba(220, 38, 38, 0.15); }
.doc-type-video { background: rgba(168, 85, 247, 0.15); }
.doc-type-other { background: rgba(107, 114, 128, 0.15); }

.doc-card-info { flex: 1; min-width: 0; }

.doc-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-sm);
    font-size: 0.78rem;
    color: var(--text-muted);
}
.doc-card-meta span { display: flex; align-items: center; gap: 3px; }

.doc-card-body {
    padding: 0 var(--space-md);
}
.doc-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.doc-card-footer {
    padding: var(--space-sm) var(--space-md) var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-sm);
    gap: 8px;
    flex-wrap: wrap;
}

.doc-card-actions-quick {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-quick-preview {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.4);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all var(--transition-fast);
}
.btn-quick-preview:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    transform: translateY(-1px);
}

.btn-quick-download {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.4);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all var(--transition-fast);
}
.btn-quick-download:hover {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    transform: translateY(-1px);
}

.doc-card-author {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.doc-card-author .mini-avatar {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--gradient-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
}

.doc-card-stats {
    display: flex;
    gap: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.doc-card-stats span { display: flex; align-items: center; gap: 3px; }

/* Stars */
.stars {
    display: flex;
    gap: 1px;
    color: var(--warning);
    font-size: 0.8rem;
}
.star-empty { color: var(--text-muted); opacity: 0.3; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-muted);
    grid-column: 1 / -1;
}
.empty-state svg { margin: 0 auto var(--space-md); }
.empty-state p { font-size: 0.95rem; }

/* Leaderboard */
.leaderboard {
    max-width: 700px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: all var(--transition-base);
    backdrop-filter: blur(8px);
}
.leaderboard-item:hover {
    transform: translateX(4px);
    border-color: var(--border-hover);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #451a03; }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #cbd5e1); color: #1e293b; }
.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); color: white; }
.rank-other { background: var(--bg-hover); color: var(--text-secondary); }

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.leaderboard-info { flex: 1; min-width: 0; }
.leaderboard-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.leaderboard-dept {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.leaderboard-score {
    text-align: right;
    flex-shrink: 0;
}
.leaderboard-score-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}
.leaderboard-score-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ================================================
   BROWSE TOOLBAR
   ================================================ */
.browse-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.select-filter {
    padding: 0.5rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}
.select-filter:focus { border-color: var(--primary); }

.view-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}
.view-btn.active {
    background: var(--primary);
    color: white;
}
.view-btn:hover:not(.active) { color: var(--text-primary); }

/* ================================================
   FORMS
   ================================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-input::placeholder { color: var(--text-muted); }

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-icon svg {
    position: absolute;
    left: 0.9rem;
    color: var(--text-muted);
    pointer-events: none;
}
.input-with-icon .form-input {
    padding-left: 2.6rem;
}
.toggle-password {
    position: absolute;
    right: 0.6rem;
    padding: 0.3rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}
.toggle-password:hover { color: var(--text-primary); }

.form-actions {
    margin-top: var(--space-xl);
    display: flex;
    justify-content: flex-end;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-muted);
}
.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}
.upload-dropzone svg { margin: 0 auto var(--space-sm); }

.dropzone-text {
    font-size: 0.95rem;
    margin-bottom: var(--space-xs);
}
.dropzone-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}
.dropzone-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.upload-file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
}
.file-preview-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--primary);
}
.file-preview-name { font-weight: 600; font-size: 0.875rem; }
.file-preview-size { font-size: 0.78rem; color: var(--text-muted); }
.file-preview-remove {
    color: var(--danger);
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
}

/* ================================================
   PROFILE
   ================================================ */
.profile-header-card {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.profile-info { flex: 1; min-width: 200px; }
.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}
.profile-role {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}
.profile-dept {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.profile-stats {
    display: flex;
    gap: var(--space-xl);
}
.profile-stat { text-align: center; }
.profile-stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
}
.profile-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ================================================
   ADMIN
   ================================================ */
.admin-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-xs);
    overflow-x: auto;
}

.admin-tab {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.admin-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-soft);
}

/* ================================================
   MODALS
   ================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 39, 0.78);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-xl);
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    color: var(--text-muted);
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}
.modal-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    margin: 0 auto var(--space-md);
}
.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}
.modal-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-footer {
    margin-top: var(--space-lg);
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ================================================
   FOOTER
   ================================================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}
.footer-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
}
.footer-brand h3 {
    font-size: 0.95rem;
    font-weight: 700;
}
.footer-brand p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.footer-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ================================================
   TOAST NOTIFICATIONS
   ================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 0.8rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 280px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--primary);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 56px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 950;
    }
    .sidebar.open { transform: translateX(0); }
    
    .main-content, .footer {
        margin-left: 0 !important;
    }
    
    .header-center { display: none; }
    
    .logo-text { display: none; }
    
    .user-name { display: none; }
    
    .search-shortcut { display: none; }
    
    .hero {
        padding: var(--space-2xl) var(--space-md);
        min-height: 320px;
    }
    .hero-title { font-size: 1.8rem; }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    .stat-card { padding: var(--space-md); }
    .stat-number { font-size: 1.3rem; }
    
    .docs-grid {
        grid-template-columns: 1fr;
    }
    
    .browse-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .profile-header-card {
        flex-direction: column;
        text-align: center;
    }
    .profile-stats { justify-content: center; }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .hero-search-inner {
        flex-direction: column;
        border-radius: var(--radius-lg);
        padding: var(--space-sm);
    }
    .hero-search-inner input { width: 100%; text-align: center; }
    .hero-search-inner .btn { width: 100%; }
    .hero-search-inner svg { display: none; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .category-card {
        padding: var(--space-md);
    }
    
    .hero-tags { display: none; }
}

/* ================================================
   SCROLLBAR
   ================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================================
   SELECTION
   ================================================ */
::selection {
    background: var(--primary);
    color: white;
}

/* ================================================
   LOADING SKELETON
   ================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-input) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================================
   MODAL SIZES & PREVIEW MODAL
   ================================================ */
.modal.modal-lg { max-width: 650px !important; width: 90% !important; }
#preview-modal .modal.modal-xl { 
    max-width: 98vw !important; 
    width: 98vw !important; 
    max-height: 98vh !important; 
    height: 98vh !important;
    padding: 0 !important;
    margin: 1vh auto !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
    background: #525659 !important;
}
#preview-modal .modal-header {
    display: none !important;
}
#preview-modal-close {
    position: absolute !important;
    top: 14px !important;
    right: 18px !important;
    z-index: 99999 !important;
    background: rgba(15, 23, 42, 0.75) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
    transition: all 0.2s ease !important;
}
#preview-modal-close:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    transform: scale(1.1) !important;
}
#preview-modal .preview-modal-body {
    padding: 0 !important;
    flex: 1;
    overflow-y: auto;
    height: 100% !important;
    width: 100% !important;
    background: #525659;
}

.office-viewer-canvas {
    padding: 30px 16px 50px;
    display: flex;
    justify-content: center;
    background: #525659;
    min-height: 100%;
}

.docx-clean-document {
    background: #ffffff;
    color: #1e293b;
    font-family: 'Calibri', 'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11pt;
    line-height: 1.65;
    padding: 50px 65px;
    width: 100%;
    max-width: 860px;
    min-height: 900px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}
@media (max-width: 768px) {
    .docx-clean-document {
        padding: 24px 18px;
    }
}
.docx-clean-document p {
    margin-bottom: 0.85em;
    line-height: 1.65;
}
.docx-clean-document h1, 
.docx-clean-document h2, 
.docx-clean-document h3, 
.docx-clean-document h4 {
    color: #0f172a;
    font-weight: 700;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}
.docx-clean-document table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.95rem;
}
.docx-clean-document th, 
.docx-clean-document td {
    border: 1px solid #94a3b8;
    padding: 8px 12px;
    vertical-align: top;
}
.docx-clean-document th {
    background: #f8fafc;
    font-weight: 700;
}
.docx-clean-document ul, 
.docx-clean-document ol {
    margin: 0.6em 0 0.8em 1.6em;
}
.docx-clean-document li {
    margin-bottom: 0.35em;
}

.office-info-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Authentic Document / KHBD Styling */
.doc-sheet {
    color: #1e293b;
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.65;
}
.doc-official-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 12px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.45;
}
.doc-title-banner {
    text-align: center;
    margin: 16px 0 20px;
}
.doc-sub-tag {
    display: inline-block;
    padding: 3px 12px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.doc-meta-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 18px;
    font-size: 0.88rem;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.doc-section {
    margin-bottom: 20px;
}
.doc-section-h3 {
    color: #1e3a8a;
    font-size: 1.12rem;
    font-weight: 700;
    margin: 18px 0 8px;
    border-bottom: 2px solid #bfdbfe;
    padding-bottom: 4px;
}
.doc-content-block {
    font-size: 0.94rem;
    color: #1e293b;
}
.doc-content-block ul {
    margin: 6px 0 10px 22px;
}
.doc-content-block li {
    margin-bottom: 4px;
}
.doc-activity-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
    background: #ffffff;
}
.doc-activity-header {
    background: #f1f5f9;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
    font-size: 0.92rem;
}
.badge-act {
    background: #2563eb;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.doc-activity-body {
    padding: 14px;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #334155;
}
.doc-activity-body ul {
    margin: 6px 0 10px 20px;
}
.doc-activity-body li {
    margin-bottom: 5px;
}
.doc-summary-box {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    margin: 10px 0;
    color: #1e3a8a;
    font-size: 0.9rem;
    line-height: 1.6;
}
.doc-lesson-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.88rem;
}
.doc-lesson-table th {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    text-align: left;
    font-weight: 700;
    color: #0f172a;
}
.doc-lesson-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    vertical-align: top;
    color: #334155;
}
.doc-footer-sign {
    display: flex;
    justify-content: space-around;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #cbd5e1;
    color: #334155;
}
.docx-rendered-wrapper {
    color: #1e293b;
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.7;
}
.docx-body {
    margin-top: 15px;
    font-size: 0.95rem;
}
.docx-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
.docx-body th, .docx-body td {
    border: 1px solid #cbd5e1;
    padding: 6px 10px;
}
.preview-simulated-slide {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: white;
    border-radius: var(--radius-md);
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--space-2xl);
    position: relative;
    box-shadow: var(--shadow-lg);
}
.slide-controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    justify-content: center;
    margin-top: var(--space-md);
}

/* ================================================
   PAGE DETAIL STYLING
   ================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-xl);
    margin-top: var(--space-md);
}
@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
}
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    backdrop-filter: blur(10px);
    margin-bottom: var(--space-lg);
}
.doc-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary);
}
.detail-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin: var(--space-sm) 0 var(--space-md);
    line-height: 1.3;
}
.detail-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-lg);
}
.detail-meta-bar span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.preview-hero-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    margin-bottom: var(--space-xl);
    position: relative;
    overflow: hidden;
}
.preview-hero-box .preview-watermark {
    font-size: 3.5rem;
    margin-bottom: var(--space-sm);
    display: block;
}
.detail-actions-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}
.btn-download-main {
    flex: 1;
    min-width: 180px;
    justify-content: center;
}

/* Author Honor Badge Card */
.author-honor-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}
.author-honor-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.badge-honor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: 4px;
}

/* Interactive Star Rating */
.interactive-rating-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.8rem;
    cursor: pointer;
    margin: var(--space-md) 0;
}
.star-btn {
    transition: transform var(--transition-fast), color var(--transition-fast);
    color: var(--text-muted);
}
.star-btn.active, .star-btn:hover {
    color: #fbbf24;
    transform: scale(1.15);
}

/* Comment Thread */
.comment-form {
    margin-top: var(--space-md);
    margin-bottom: var(--space-xl);
}
.comment-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-secondary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.comment-date { font-size: 0.75rem; color: var(--text-muted); font-weight: normal; }
.comment-text {
    font-size: 0.88rem;
    margin-top: 4px;
    color: var(--text-secondary);
}

/* ================================================
   REVIEW PAGE (TỔ TRƯỞNG CHUYÊN MÔN)
   ================================================ */
.review-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    max-width: 1000px;
    margin: var(--space-md) auto 0;
}

.review-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    backdrop-filter: blur(8px);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.review-item-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.review-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.badge-status-pending {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid rgba(245, 158, 11, 0.3);
    flex-shrink: 0;
}

.review-card-desc {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: var(--space-md) 0;
}

.review-file-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.review-actions-bar {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    justify-content: flex-end;
    flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-md);
    width: 100%;
}

.review-actions-bar .btn {
    flex: 1 1 auto;
    min-width: 140px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    padding: 0.65rem 1.1rem;
    font-size: 0.86rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

/* Nút 1: Xem trước nội dung (Xanh Dương) */
.btn-preview {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}
.btn-preview:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.45);
}

/* Nút 2: Tải file về (Xanh Lơ / Cyan) */
.btn-download-action {
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
}
.btn-download-action:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(2, 132, 199, 0.45);
}

/* Nút 3: Từ chối / Yêu cầu sửa (Đỏ Crimson) */
.btn-reject {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.3);
}
.btn-reject:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.45);
}

/* Nút 4: Phê duyệt & Công khai (Xanh Lá Emerald) */
.btn-approve {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}
.btn-approve:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.45);
}

@media (max-width: 820px) {
    .review-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .review-actions-bar .btn {
        width: 100%;
        min-width: unset;
    }
}

/* ================================================
   DASHBOARD & THỐNG KÊ (BAN GIÁM HIỆU)
   ================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}
.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}
.chart-box-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bar-row {
    margin-bottom: var(--space-sm);
}
.bar-label-group {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 3px;
}
.bar-track {
    height: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    transition: width 1s ease-in-out;
}
.bar-fill-dept { background: var(--gradient-secondary); }
.bar-fill-grade { background: var(--gradient-warning); }

/* Admin Table */
.admin-table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-top: var(--space-md);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}
.admin-table th {
    background: var(--bg-surface);
    padding: 0.85rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.admin-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
}
.admin-table tr:hover td {
    background: var(--bg-hover);
}
.badge-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}
.role-admin { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.role-leader { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.role-teacher { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

