/* ==========================================================================
   المكتبة الأكاديمية البيطرية | التصميم الأساسي ونظام الألوان (RTL)
   ========================================================================== */

:root {
  /* Base Light Theme Palette */
  --bg-body: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.88);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Primary Academic Brand Colors */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: rgba(2, 132, 199, 0.1);
  --accent-teal: #0d9488;

  /* Level 4: The 4 Distinctive File Type Badge Colors */
  /* 1. المصدر (Source) - Blue */
  --badge-source: #2563eb;
  --badge-source-bg: rgba(37, 99, 235, 0.1);
  --badge-source-border: rgba(37, 99, 235, 0.28);

  /* 2. الشرح (Explanation) - Emerald Green */
  --badge-explanation: #059669;
  --badge-explanation-bg: rgba(5, 150, 105, 0.1);
  --badge-explanation-border: rgba(5, 150, 105, 0.28);

  /* 3. التلخيص (Summary) - Amber Gold */
  --badge-summary: #d97706;
  --badge-summary-bg: rgba(217, 119, 6, 0.11);
  --badge-summary-border: rgba(217, 119, 6, 0.3);

  /* 4. خريطة ذهنية (Mind Map) - Purple Violet */
  --badge-mindmap: #7c3aed;
  --badge-mindmap-bg: rgba(124, 58, 237, 0.1);
  --badge-mindmap-border: rgba(124, 58, 237, 0.28);

  /* Status Colors */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Shadows & Radius */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --header-height: 70px;
  --sidebar-width: 310px;
  --font-heading: 'Cairo', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}

[data-theme="dark"] {
  --bg-body: #0b1120;
  --bg-surface: #131c31;
  --bg-surface-alt: #18233c;
  --bg-surface-hover: #1e2d4a;
  --bg-glass: rgba(19, 28, 49, 0.9);

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: #1e293b;
  --border-strong: #334155;

  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-soft: rgba(56, 189, 248, 0.14);

  --badge-source: #60a5fa;
  --badge-source-bg: rgba(96, 165, 250, 0.14);
  --badge-source-border: rgba(96, 165, 250, 0.35);

  --badge-explanation: #34d399;
  --badge-explanation-bg: rgba(52, 211, 153, 0.14);
  --badge-explanation-border: rgba(52, 211, 153, 0.35);

  --badge-summary: #fbbf24;
  --badge-summary-bg: rgba(251, 191, 36, 0.14);
  --badge-summary-border: rgba(251, 191, 36, 0.35);

  --badge-mindmap: #a78bfa;
  --badge-mindmap-bg: rgba(167, 139, 250, 0.14);
  --badge-mindmap-border: rgba(167, 139, 250, 0.35);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
}

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

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.35;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Badge Color Dots & Utilities
   ========================================================================== */
.badge-dot, .chip-dot, .v-tab-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-all { background: var(--primary); }
.dot-source { background: var(--badge-source); box-shadow: 0 0 0 3px var(--badge-source-bg); }
.dot-explanation { background: var(--badge-explanation); box-shadow: 0 0 0 3px var(--badge-explanation-bg); }
.dot-summary { background: var(--badge-summary); box-shadow: 0 0 0 3px var(--badge-summary-bg); }
.dot-mindmap { background: var(--badge-mindmap); box-shadow: 0 0 0 3px var(--badge-mindmap-bg); }

/* File Type Pill Badges */
.file-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-heading);
  border: 1px solid transparent;
  white-space: nowrap;
}

.file-type-badge.badge-source {
  color: var(--badge-source);
  background: var(--badge-source-bg);
  border-color: var(--badge-source-border);
}

.file-type-badge.badge-explanation {
  color: var(--badge-explanation);
  background: var(--badge-explanation-bg);
  border-color: var(--badge-explanation-border);
}

.file-type-badge.badge-summary {
  color: var(--badge-summary);
  background: var(--badge-summary-bg);
  border-color: var(--badge-summary-border);
}

.file-type-badge.badge-mindmap {
  color: var(--badge-mindmap);
  background: var(--badge-mindmap-bg);
  border-color: var(--badge-mindmap-border);
}

/* ==========================================================================
   Top Navigation Header
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent-teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

/* Center Search & Filter Chips */
.header-center {
  flex: 1;
  max-width: 780px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 34px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  transition: all 0.18s ease;
}

.filter-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.filter-chip.active[data-filter="all"] {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.filter-chip.active.chip-source {
  background: var(--badge-source-bg);
  color: var(--badge-source);
  border-color: var(--badge-source);
}

.filter-chip.active.chip-explanation {
  background: var(--badge-explanation-bg);
  color: var(--badge-explanation);
  border-color: var(--badge-explanation);
}

.filter-chip.active.chip-summary {
  background: var(--badge-summary-bg);
  color: var(--badge-summary);
  border-color: var(--badge-summary);
}

.filter-chip.active.chip-mindmap {
  background: var(--badge-mindmap-bg);
  color: var(--badge-mindmap);
  border-color: var(--badge-mindmap);
}

/* Header Left Actions */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cloud-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.cloud-indicator .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.cloud-indicator.connected {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.cloud-indicator.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  transition: all 0.18s ease;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.header-action-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  transition: all 0.18s ease;
}

.header-action-btn:hover,
.header-action-btn.active {
  color: var(--warning);
  border-color: var(--warning);
  background: var(--badge-summary-bg);
}

.count-pill {
  background: var(--border-color);
  color: var(--text-primary);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.btn-admin-toggle {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #0369a1);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
}

.btn-admin-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

/* ==========================================================================
   Main Layout & Right Collapsible Sidebar
   ========================================================================== */
.app-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 16px;
  gap: 16px;
  transition: margin-right 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s ease;
  flex-shrink: 0;
}

.app-sidebar.collapsed {
  margin-right: calc(-1 * var(--sidebar-width));
}

/* Progress Card inside Sidebar */
.sidebar-progress-card {
  background: linear-gradient(135deg, var(--primary-soft), rgba(13, 148, 136, 0.08));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
}

.progress-percent {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--primary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0 4px;
}

.text-btn {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--primary);
}

.text-btn:hover {
  text-decoration: underline;
}

/* Sidebar Tree Navigation */
.sidebar-tree {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-subject-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tree-subject-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: background 0.15s ease;
  text-align: right;
}

.tree-subject-btn:hover {
  background: var(--bg-surface-hover);
}

.tree-subject-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.tree-subject-label {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-subject-icon {
  font-size: 1.05rem;
}

.tree-chevron {
  transition: transform 0.2s ease;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.tree-subject-item.expanded .tree-chevron {
  transform: rotate(-90deg);
}

.tree-children {
  display: none;
  padding-right: 18px;
  margin-top: 2px;
  border-right: 2px solid var(--border-color);
  margin-right: 16px;
}

.tree-subject-item.expanded .tree-children {
  display: block;
}

.tree-cat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}

.tree-cat-btn:hover,
.tree-cat-btn.active {
  color: var(--primary);
  background: var(--bg-surface-alt);
}

.tree-units-list {
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px;
}

.tree-unit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  transition: all 0.15s ease;
}

.tree-unit-btn:hover,
.tree-unit-btn.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}

.tree-unit-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Sidebar Legend */
.sidebar-legend {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.legend-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-alt);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.legend-item strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.2;
}

/* ==========================================================================
   Main Explorer Content Area
   ========================================================================== */
.app-main {
  flex: 1;
  padding: 22px 28px 48px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Breadcrumbs & Toolbar */
.explorer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  background: var(--bg-surface);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.breadcrumb-item:hover:not(.current) {
  background: var(--bg-surface-hover);
  color: var(--primary);
}

.breadcrumb-item.current {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 700;
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
  user-select: none;
}

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

.toolbar-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.toolbar-back-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(2px);
}

/* زر الشاشة الرئيسية في شريط المسار */
.toolbar-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 55%, #0d9488 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 3px 0 #075985, 0 6px 12px rgba(2, 132, 199, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  white-space: nowrap;
}

.toolbar-home-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 5px 0 #075985, 0 10px 18px rgba(2, 132, 199, 0.38);
}

/* زر الشاشة الرئيسية في الشريط الجانبي */
.sidebar-home-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 4px 0 14px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 55%, #0d9488 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 0 #075985, 0 8px 16px rgba(2, 132, 199, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.sidebar-home-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 6px 0 #075985, 0 12px 20px rgba(2, 132, 199, 0.35);
}

.sidebar-home-icon {
  font-size: 1.05rem;
}

/* بطاقة المحاضرة / السكشن قابلة للنقر بالكامل */
.unit-card.unit-card-clickable {
  cursor: pointer;
}

.unit-card.unit-card-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* ==========================================================================
   3D Hero Banner: Seniors 2027 VET-KSU 33 Old List الفرقة الخامسة
   ========================================================================== */
.welcome-banner.banner-3d {
  background: linear-gradient(135deg, #060b18 0%, #0f172a 35%, #075985 75%, #0d9488 100%);
  color: #fff;
  border-radius: 22px;
  padding: 28px 34px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 20px 45px -12px rgba(2, 132, 199, 0.38),
    0 8px 0 #082f49,
    inset 0 1px 2px rgba(255, 255, 255, 0.35);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.welcome-banner.banner-3d:hover {
  transform: translateY(-2px);
  box-shadow:
    0 26px 55px -12px rgba(2, 132, 199, 0.48),
    0 10px 0 #082f49,
    inset 0 1px 2px rgba(255, 255, 255, 0.45);
}

/* 3D Perspective Grid & Ambient Glow Orbs */
.banner-3d-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  transform: perspective(400px) rotateX(55deg) scale(1.6);
  transform-origin: center bottom;
  opacity: 0.45;
  pointer-events: none;
}

.banner-3d-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(45px);
  pointer-events: none;
  z-index: 0;
}

.banner-3d-glow.glow-1 {
  width: 280px;
  height: 280px;
  top: -110px;
  right: 10%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45), transparent 70%);
  animation: pulseGlow 6s ease-in-out infinite alternate;
}

.banner-3d-glow.glow-2 {
  width: 240px;
  height: 240px;
  bottom: -100px;
  left: 15%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.35), transparent 70%);
  animation: pulseGlow 8s ease-in-out infinite alternate-reverse;
}

@keyframes pulseGlow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.7; }
  100% { transform: scale(1.2) translate(-15px, 10px); opacity: 1; }
}

/* 3D Floating Emblem Cube + Title Lockup */
.hero-3d-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 22px;
}

.hero-3d-emblem {
  position: relative;
  width: 74px;
  height: 74px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  animation: float3D 4.5s ease-in-out infinite;
}

.emblem-orbit {
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  border: 2px dashed rgba(56, 189, 248, 0.55);
  animation: spinOrbit 18s linear infinite;
}

.emblem-cube {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: linear-gradient(145deg, #38bdf8 0%, #0284c7 55%, #1e3a8a 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 8px 0 #0c4a6e,
    0 15px 28px rgba(0, 0, 0, 0.45),
    inset 0 2px 3px rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: rotateY(-12deg) rotateX(8deg);
}

.emblem-year {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #fde68a;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.emblem-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 3px 0 #075985, 0 5px 10px rgba(0, 0, 0, 0.4);
}

@keyframes float3D {
  0%, 100% { transform: translateY(0px) rotateZ(0deg); }
  50% { transform: translateY(-6px) rotateZ(1.5deg); }
}

@keyframes spinOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hero-3d-titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-3d-MainLine {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* 3D Metallic & Extruded English Title */
.title-en-3d {
  font-family: 'Outfit', 'Cairo', sans-serif;
  font-size: clamp(1.45rem, 2.5vw, 2.15rem);
  font-weight: 900;
  letter-spacing: 0.6px;
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 45%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 #0284c7)
          drop-shadow(0 2px 0 #0369a1)
          drop-shadow(0 3px 0 #075985)
          drop-shadow(0 4px 0 #0c4a6e)
          drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
  transition: transform 0.25s ease;
}

.welcome-banner.banner-3d:hover .title-en-3d {
  transform: scale(1.015) translateZ(10px);
}

/* 3D Royal Gold Badges Group ("الفرقة الخامسة" + "الترم الأول") */
.hero-3d-badges-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.title-ar-3d {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 1.8vw, 1.42rem);
  font-weight: 900;
  color: #0f172a;
  background: linear-gradient(135deg, #fef08a 0%, #fbbf24 50%, #f59e0b 100%);
  padding: 5px 18px 7px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow:
    0 5px 0 #b45309,
    0 10px 22px rgba(245, 158, 11, 0.4),
    inset 0 2px 2px rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: perspective(400px) rotateY(6deg);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  white-space: nowrap;
}

.title-ar-3d:hover {
  transform: perspective(400px) rotateY(0deg) translateY(-3px);
  box-shadow:
    0 8px 0 #b45309,
    0 14px 28px rgba(245, 158, 11, 0.55),
    inset 0 2px 2px rgba(255, 255, 255, 0.9);
}

/* 3D Stat Boxes */
.welcome-stats.stats-3d {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.stat-box.stat-box-3d {
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 11px 18px;
  border-radius: 14px;
  text-align: center;
  min-width: 92px;
  box-shadow:
    0 6px 0 rgba(7, 24, 48, 0.55),
    0 12px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.22s ease, box-shadow 0.22s ease;
}

.stat-box.stat-box-3d:hover {
  transform: perspective(500px) translateY(-5px) rotateX(8deg);
  background: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 10px 0 rgba(7, 24, 48, 0.65),
    0 18px 28px rgba(0, 0, 0, 0.38),
    inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.stat-box strong {
  display: block;
  font-family: 'Outfit', var(--font-heading);
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.stat-box span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
}

/* ==========================================================================
   Level 1: 8 Subject Folders Grid (3D Wide-Banner Style Cards & Living 3D Icons)
   ========================================================================== */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h3 {
  font-size: 1.18rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-heading span {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 22px;
}

.subject-card.subject-card-3d {
  background: linear-gradient(135deg, #060b18 0%, #0f172a 35%, #075985 75%, #0d9488 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 18px 40px -12px rgba(2, 132, 199, 0.36),
    0 8px 0 #082f49,
    inset 0 1px 2px rgba(255, 255, 255, 0.35);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.32s ease, border-color 0.25s ease;
}

.subject-card.subject-card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--subject-accent, #38bdf8), #fef08a, var(--subject-accent, #38bdf8), transparent);
  z-index: 3;
  opacity: 0.9;
}

.subject-card.subject-card-3d:hover {
  transform: perspective(900px) translateY(-7px) rotateX(2.5deg);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow:
    0 26px 52px -12px rgba(2, 132, 199, 0.52),
    0 11px 0 #082f49,
    inset 0 1px 3px rgba(255, 255, 255, 0.5);
}

/* 3D Perspective Grid & Ambient Glows inside each Subject Card */
.card-3d-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  transform: perspective(360px) rotateX(55deg) scale(1.65);
  transform-origin: center bottom;
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
}

.card-3d-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(36px);
  pointer-events: none;
  z-index: 0;
}

.card-3d-glow.glow-accent {
  width: 170px;
  height: 170px;
  top: -65px;
  right: -30px;
  background: radial-gradient(circle, var(--subject-accent, rgba(56, 189, 248, 0.55)), transparent 70%);
  opacity: 0.42;
  animation: pulseGlow 5s ease-in-out infinite alternate;
}

.card-3d-glow.glow-secondary {
  width: 150px;
  height: 150px;
  bottom: -60px;
  left: -25px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.35), transparent 70%);
  opacity: 0.38;
  animation: pulseGlow 7s ease-in-out infinite alternate-reverse;
}

.subject-card-top,
.subject-card-body,
.subject-subfolders,
.subject-card-footer {
  position: relative;
  z-index: 2;
}

.subject-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ==========================================================================
   3D Living Subject Icons Stage (نابضة بالحياة وثلاثية الأبعاد)
   ========================================================================== */
.subject-icon-3d-stage {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  animation: float3DIcon 4.2s ease-in-out infinite;
}

.icon-3d-aura {
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  background: radial-gradient(circle, var(--subject-accent, #38bdf8) 0%, transparent 72%);
  opacity: 0.5;
  filter: blur(8px);
  animation: auraBreath3D 2.8s ease-in-out infinite alternate;
}

.icon-3d-orbit {
  position: absolute;
  inset: -5px;
  border-radius: 20px;
  border: 1.8px dashed rgba(255, 255, 255, 0.48);
  animation: spinOrbit 16s linear infinite;
  pointer-events: none;
}

.icon-3d-cube {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.24) 0%, rgba(15, 23, 42, 0.72) 55%, rgba(6, 11, 24, 0.92) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 7px 0 #082f49,
    0 14px 24px rgba(0, 0, 0, 0.48),
    inset 0 2px 4px rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: perspective(360px) rotateY(-10deg) rotateX(8deg);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.32s ease;
  overflow: hidden;
}

/* Subject-specific 3D Cube Tint Gradients */
.icon-theme-internal_med .icon-3d-cube {
  background: linear-gradient(145deg, #38bdf8 0%, #0284c7 52%, #1e3a8a 100%);
  box-shadow: 0 7px 0 #0c4a6e, 0 14px 24px rgba(2, 132, 199, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-theriogenology .icon-3d-cube {
  background: linear-gradient(145deg, #c084fc 0%, #9333ea 52%, #4c1d95 100%);
  box-shadow: 0 7px 0 #3b0764, 0 14px 24px rgba(147, 51, 234, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-surgery .icon-3d-cube {
  background: linear-gradient(145deg, #34d399 0%, #059669 52%, #064e3b 100%);
  box-shadow: 0 7px 0 #022c22, 0 14px 24px rgba(16, 185, 129, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-poultry .icon-3d-cube {
  background: linear-gradient(145deg, #fbbf24 0%, #ea580c 55%, #7c2d12 100%);
  box-shadow: 0 7px 0 #431407, 0 14px 24px rgba(234, 88, 12, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-hygiene .icon-3d-cube {
  background: linear-gradient(145deg, #2dd4bf 0%, #0d9488 52%, #134e4a 100%);
  box-shadow: 0 7px 0 #042f2e, 0 14px 24px rgba(13, 148, 136, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-meat_inspection .icon-3d-cube {
  background: linear-gradient(145deg, #fb7185 0%, #e11d48 52%, #881337 100%);
  box-shadow: 0 7px 0 #4c0519, 0 14px 24px rgba(225, 29, 72, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-zoonoses .icon-3d-cube {
  background: linear-gradient(145deg, #60a5fa 0%, #2563eb 52%, #1e3a8a 100%);
  box-shadow: 0 7px 0 #172554, 0 14px 24px rgba(37, 99, 235, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}
.icon-theme-infectious .icon-3d-cube {
  background: linear-gradient(145deg, #22d3ee 0%, #0891b2 52%, #164e63 100%);
  box-shadow: 0 7px 0 #083344, 0 14px 24px rgba(6, 182, 212, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.65);
}

.icon-3d-gloss {
  position: absolute;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 90%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 100%);
  transform: rotate(-22deg);
  pointer-events: none;
}

.icon-3d-svg {
  width: 44px;
  height: 44px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}

.subject-card:hover .icon-3d-cube {
  transform: perspective(360px) rotateY(0deg) rotateX(0deg) scale(1.1);
}

/* Living Internal SVG Animations */
.svg-heartbeat-core {
  transform-origin: 32px 32px;
  animation: heartBeat3D 1.8s ease-in-out infinite;
}

.svg-ecg-pulse {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: ecgPulseLive 2.2s linear infinite;
}

.svg-dna-helix {
  transform-origin: 32px 32px;
  animation: dnaWave3D 3.2s ease-in-out infinite alternate;
}

.svg-scalpel-float {
  transform-origin: 32px 32px;
  animation: scalpelAction3D 2.6s ease-in-out infinite alternate;
}

.svg-avian-breathe {
  transform-origin: 32px 36px;
  animation: avianVitality3D 2.4s ease-in-out infinite alternate;
}

.svg-shield-pulse {
  transform-origin: 32px 32px;
  animation: shieldPulse3D 2.5s ease-in-out infinite alternate;
}

.svg-seal-scan {
  transform-origin: 43px 42px;
  animation: sealBounce3D 2.2s ease-in-out infinite alternate;
}

.svg-microbe-float {
  transform-origin: 32px 32px;
  animation: microbeSpinPulse 6s ease-in-out infinite alternate;
}

.svg-pulse-node {
  transform-origin: center;
  animation: nodeGlowPulse 1.6s ease-in-out infinite alternate;
}

@keyframes float3DIcon {
  0%, 100% { transform: translateY(0px) rotateZ(0deg); }
  50% { transform: translateY(-5px) rotateZ(2deg); }
}

@keyframes auraBreath3D {
  0% { transform: scale(0.88); opacity: 0.38; }
  100% { transform: scale(1.18); opacity: 0.78; }
}

@keyframes heartBeat3D {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.14); }
  30% { transform: scale(0.96); }
  45% { transform: scale(1.09); }
}

@keyframes ecgPulseLive {
  0% { stroke-dashoffset: 60; opacity: 0.4; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -60; opacity: 0.4; }
}

@keyframes dnaWave3D {
  0% { transform: scaleY(0.95) rotate(-4deg); }
  100% { transform: scaleY(1.06) rotate(4deg); }
}

@keyframes scalpelAction3D {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2px, -3px) rotate(-6deg) scale(1.06); }
}

@keyframes avianVitality3D {
  0% { transform: scale(0.96) rotate(-2deg); }
  100% { transform: scale(1.07) rotate(3deg); }
}

@keyframes shieldPulse3D {
  0% { transform: scale(0.96); filter: brightness(1); }
  100% { transform: scale(1.06); filter: brightness(1.18); }
}

@keyframes sealBounce3D {
  0% { transform: scale(0.92) rotate(-5deg); }
  100% { transform: scale(1.1) rotate(5deg); }
}

@keyframes microbeSpinPulse {
  0% { transform: rotate(-10deg) scale(0.95); }
  100% { transform: rotate(12deg) scale(1.07); }
}

@keyframes nodeGlowPulse {
  0% { opacity: 0.65; filter: brightness(0.95); }
  100% { opacity: 1; filter: brightness(1.35); }
}

.subject-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: var(--subject-soft, var(--primary-soft));
  color: var(--subject-accent, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  flex-shrink: 0;
  box-shadow:
    0 4px 0 rgba(15, 23, 42, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.subject-en-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

.subject-card.subject-card-3d .subject-en-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.73rem;
  font-weight: 700;
  color: #e0f2fe;
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.28);
}

.subject-card-body h4.subject-title-3d {
  font-size: 1.32rem;
  font-weight: 900;
  margin-bottom: 0;
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 65%, #bae6fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 #0369a1)
    drop-shadow(0 2px 0 #075985)
    drop-shadow(0 5px 10px rgba(0, 0, 0, 0.45));
}

/* 3 Equal Stat/Subfolder Boxes inside Subject Card (محاضرات | سكاشن | ملفات) */
.subject-subfolders {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.subject-card.subject-card-3d .subfolder-mini-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.26);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow:
    0 4px 0 rgba(7, 24, 48, 0.55),
    0 8px 14px rgba(0, 0, 0, 0.22),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.subject-card.subject-card-3d .subfolder-mini-btn:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.2);
  border-color: #fde047;
  color: #fef08a;
  box-shadow:
    0 7px 0 rgba(7, 24, 48, 0.65),
    0 12px 20px rgba(0, 0, 0, 0.32),
    inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.subject-card.subject-card-3d .subfolder-mini-btn small {
  font-family: 'Outfit', var(--font-heading);
  font-size: 0.85rem;
  color: #fde68a;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.subject-card.subject-card-3d .subject-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
}

.subject-card.subject-card-3d .subject-card-footer strong {
  color: #fde68a;
  font-family: 'Outfit', var(--font-heading);
}

.subject-card.subject-card-3d .subject-mini-progress {
  flex: 1;
  height: 6px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.subject-card.subject-card-3d .subject-mini-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #fde047);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.65);
}

/* ==========================================================================
   Level 2: Category Split (محاضرات Lectures vs سكاشن Lab Sections)
   ========================================================================== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}

.category-folder-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: var(--shadow-xs);
}

.category-folder-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.category-folder-icon {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.category-lectures .category-folder-icon {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.category-sections .category-folder-icon {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
}

.category-folder-info {
  flex: 1;
}

.category-folder-info h3 {
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.category-folder-info p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.category-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* ==========================================================================
   Level 3: Numbered Units Grid (1, 2, 3...)
   ========================================================================== */
.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.unit-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
  position: relative;
}

.unit-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.unit-card.completed-unit {
  border-right: 4px solid var(--success);
}

.unit-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.unit-number-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.unit-folder-number {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #0369a1);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.22);
}

.unit-title-box h4 {
  font-size: 1.02rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.unit-title-box span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.unit-quick-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.mini-icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.mini-icon-btn.completed {
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.mini-icon-btn.bookmarked {
  color: var(--warning);
  background: var(--badge-summary-bg);
  border-color: var(--badge-summary-border);
}

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

/* 4 File Type Quick-Launch Badges inside each Numbered Unit Card */
.unit-badges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.unit-badge-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  transition: all 0.16s ease;
}

.unit-badge-slot.available {
  cursor: pointer;
}

.unit-badge-slot.slot-source.available {
  background: var(--badge-source-bg);
  color: var(--badge-source);
  border-color: var(--badge-source-border);
}

.unit-badge-slot.slot-explanation.available {
  background: var(--badge-explanation-bg);
  color: var(--badge-explanation);
  border-color: var(--badge-explanation-border);
}

.unit-badge-slot.slot-summary.available {
  background: var(--badge-summary-bg);
  color: var(--badge-summary);
  border-color: var(--badge-summary-border);
}

.unit-badge-slot.slot-mindmap.available {
  background: var(--badge-mindmap-bg);
  color: var(--badge-mindmap);
  border-color: var(--badge-mindmap-border);
}

.unit-badge-slot.available:hover {
  transform: scale(1.02);
  filter: brightness(0.97);
}

.unit-badge-slot.empty {
  opacity: 0.48;
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  border-style: dashed;
  cursor: default;
}

.slot-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.btn-open-unit {
  width: 100%;
  padding: 8px 14px;
  border-radius: 9px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-size: 0.83rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.btn-open-unit:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   Level 4: Study Files Explorer View (Inside a Numbered Unit)
   ========================================================================== */
.unit-detail-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.unit-detail-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.unit-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 4 Columns / Sections for the 4 File Types */
.files-four-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
  gap: 18px;
}

.file-type-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.column-source .column-header { border-bottom-color: var(--badge-source); }
.column-explanation .column-header { border-bottom-color: var(--badge-explanation); }
.column-summary .column-header { border-bottom-color: var(--badge-summary); }
.column-mindmap .column-header { border-bottom-color: var(--badge-mindmap); }

.column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 800;
}

.column-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: -6px;
}

.study-file-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.18s ease;
  cursor: pointer;
}

.study-file-card:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.file-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.file-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.file-format-tag {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  white-space: nowrap;
}

.file-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.btn-view-file {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================================================
   Smart Study Viewer Modal (Full-Focus Multi-Tab Viewer)
   ========================================================================== */
.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.viewer-modal-container {
  width: 100%;
  max-width: 1380px;
  height: 92vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-header {
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.viewer-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.unit-number-badge {
  padding: 6px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #0369a1);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.86rem;
}

.viewer-title-group h2 {
  font-size: 1.05rem;
}

.viewer-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* 4 Color-Coded Switcher Tabs inside Viewer */
.viewer-type-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-alt);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.v-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.18s ease;
}

.v-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.v-tab.active.tab-source {
  background: var(--badge-source);
  color: #fff;
}

.v-tab.active.tab-explanation {
  background: var(--badge-explanation);
  color: #fff;
}

.v-tab.active.tab-summary {
  background: var(--badge-summary);
  color: #fff;
}

.v-tab.active.tab-mindmap {
  background: var(--badge-mindmap);
  color: #fff;
}

.v-tab.active .v-tab-dot {
  background: #fff;
  box-shadow: none;
}

.v-tab-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
}

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

.viewer-action-btn {
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  transition: all 0.18s ease;
}

.viewer-action-btn.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-color: var(--success);
}

.btn-close-viewer:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: var(--danger);
}

/* Viewer Sub-bar */
.viewer-subbar {
  padding: 8px 20px;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.viewer-subfiles-list {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.subfile-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.subfile-pill.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.viewer-unit-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.unit-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.unit-nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.unit-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Viewer Body Content Types */
.viewer-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: var(--bg-body);
}

/* 1. Embedded PDF / Google Drive Frame */
.viewer-iframe-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.viewer-iframe {
  width: 100%;
  flex: 1;
  border: none;
  background: #fff;
}

.drive-fallback-bar {
  padding: 10px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

/* 2. Formatted Academic Rich Text / Markdown Reader */
.academic-reader {
  max-width: 900px;
  margin: 28px auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 44px;
  box-shadow: var(--shadow-sm);
}

.academic-reader h1,
.academic-reader h2,
.academic-reader h3 {
  color: var(--text-primary);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.academic-reader h1:first-child,
.academic-reader h2:first-child {
  margin-top: 0;
}

.academic-reader p {
  margin-bottom: 14px;
  font-size: 1.02rem;
  line-height: 1.85;
}

.academic-reader ul,
.academic-reader ol {
  padding-right: 24px;
  margin-bottom: 16px;
}

.academic-reader li {
  margin-bottom: 8px;
  line-height: 1.75;
}

.academic-reader blockquote {
  background: var(--primary-soft);
  border-right: 4px solid var(--primary);
  padding: 12px 18px;
  border-radius: 8px;
  margin: 16px 0;
  font-weight: 500;
}

.academic-reader table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.92rem;
}

.academic-reader th,
.academic-reader td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  text-align: right;
}

.academic-reader th {
  background: var(--bg-surface-alt);
  font-weight: 700;
}

/* 3. Interactive Mind Map Canvas */
.mindmap-workspace {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 24px 24px;
  display: flex;
  flex-direction: column;
}

.mindmap-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  display: flex;
  gap: 6px;
  background: var(--bg-surface);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.mindmap-canvas {
  flex: 1;
  overflow: auto;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.mindmap-canvas:active {
  cursor: grabbing;
}

/* RTL CSS Tree Mind Map */
.mm-tree {
  display: inline-flex;
  align-items: center;
  direction: rtl;
  transform-origin: center center;
  transition: transform 0.2s ease;
}

.mm-node-group {
  display: flex;
  align-items: center;
}

.mm-node-card {
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 2px solid var(--badge-mindmap);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.mm-node-card:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
}

.mm-root-node > .mm-node-card {
  background: linear-gradient(135deg, var(--badge-mindmap), #4f46e5);
  color: #fff;
  font-size: 1.08rem;
  padding: 14px 24px;
  border: none;
}

.mm-level-1 > .mm-node-card {
  border-color: var(--primary);
  background: var(--bg-surface);
}

.mm-level-2 > .mm-node-card {
  border-color: var(--badge-explanation);
  font-weight: 600;
  font-size: 0.85rem;
}

.mm-children {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding-right: 32px;
  position: relative;
}

.mm-children::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--border-strong);
}

.mm-child-branch {
  display: flex;
  align-items: center;
  position: relative;
  padding-right: 16px;
}

.mm-child-branch::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--border-strong);
}

.mm-child-branch::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-strong);
}

.mm-child-branch:first-child::after {
  top: 50%;
}

.mm-child-branch:last-child::after {
  bottom: 50%;
}

.mm-child-branch:only-child::after {
  display: none;
}

/* ==========================================================================
   Admin Modal & Forms
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-badge-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.modal-title-wrap h2 {
  font-size: 1.15rem;
}

.modal-title-wrap p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-login-section {
  padding: 40px 24px;
  display: flex;
  justify-content: center;
}

.login-box {
  max-width: 400px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-icon {
  font-size: 2.5rem;
}

.login-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.login-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
}

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

.admin-workspace {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  padding: 0 20px;
  gap: 8px;
}

.admin-tab {
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
}

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-surface);
}

.admin-tab-panel {
  display: none;
  padding: 24px;
}

.admin-tab-panel.active {
  display: block;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 0.88rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
}

.unit-select-row {
  display: flex;
  gap: 6px;
}

.unit-select-row select {
  flex: 1;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badge Radio Selector in Admin */
.badge-radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
}

.badge-radio input {
  display: none;
}

.badge-radio .radio-box {
  display: flex;
   flex-direction: column;
  gap: 3px;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg-surface-alt);
  cursor: pointer;
  transition: all 0.16s ease;
}

.badge-radio input:checked + .radio-box {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.radio-source input:checked + .radio-box {
  border-color: var(--badge-source);
  background: var(--badge-source-bg);
}

.radio-explanation input:checked + .radio-box {
  border-color: var(--badge-explanation);
  background: var(--badge-explanation-bg);
}

.radio-summary input:checked + .radio-box {
  border-color: var(--badge-summary);
  background: var(--badge-summary-bg);
}

.radio-mindmap input:checked + .radio-box {
  border-color: var(--badge-mindmap);
  background: var(--badge-mindmap-bg);
}

.content-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Buttons */
.btn-primary {
  padding: 10px 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #0369a1);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.18s ease;
}

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

.btn-secondary {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.86rem;
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger-outline {
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  font-weight: 600;
  font-size: 0.86rem;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Cloud & Backup Grid */
.cloud-sync-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.cloud-box {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cloud-box h3 {
  font-size: 1rem;
}

.cloud-box p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-upload-label {
  cursor: pointer;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 6px 0;
}

/* Admin Units Table */
.admin-existing-units {
  margin-top: 24px;
}

.admin-table-container {
  margin-top: 10px;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: right;
}

.admin-table th {
  background: var(--bg-surface-alt);
  font-weight: 700;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.6rem;
  margin-bottom: 10px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.25s ease;
}

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

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .header-center {
    flex-direction: column;
    align-items: stretch;
  }
  .app-header {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .app-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 190;
  }
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Admin Protected Controls (تظهر فقط للمشرف عند تسجيل الدخول)
   ========================================================================== */
body:not(.is-admin-active) .admin-only,
body:not(.is-admin-active) [data-add-badge-file],
body:not(.is-admin-active) [data-empty-add],
body:not(.is-admin-active) [data-edit-file],
body:not(.is-admin-active) [data-delete-file],
body:not(.is-admin-active) #addNewUnitHereBtn,
body:not(.is-admin-active) #emptyAddUnitBtn,
body:not(.is-admin-active) #toolbarQuickAddBtn,
body:not(.is-admin-active) #viewerAddMissingFileBtn,
body:not(.is-admin-active) [data-delete-notif] {
  display: none !important;
}

/* ==========================================================================
   Notifications Header Button & Center (قسم الإشعارات وإشعارات الهاتف)
   ========================================================================== */
.notifications-header-btn {
  position: relative;
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.notifications-header-btn:hover,
.notifications-header-btn.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.notifications-header-btn.has-unread {
  border-color: rgba(14, 165, 233, 0.45);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(2, 132, 199, 0.05));
  color: var(--text-primary);
}

.notif-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notifications-header-btn.has-unread .notif-bell-icon {
  color: #38bdf8;
  animation: bellRingAnim 2.6s ease-in-out infinite;
  transform-origin: top center;
}

@keyframes bellRingAnim {
  0%, 70%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20%, 40% { transform: rotate(-14deg); }
  50% { transform: rotate(6deg); }
  60% { transform: rotate(-6deg); }
}

.notif-unread-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 8px #ef4444;
  animation: notifPulseDot 1.6s infinite;
}

@keyframes notifPulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.75; }
}

.notifications-header-btn.has-unread .notif-count-pill {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Notifications Modal */
.notifications-modal-container {
  max-width: 760px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.notif-header-icon {
  font-size: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(13, 148, 136, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.notif-header-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.notifications-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Phone Background Push Activation Box */
.phone-push-card {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.1), rgba(13, 148, 136, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-push-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.phone-push-icon {
  font-size: 1.25rem;
}

.phone-push-title-row h4 {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.push-state-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.push-state-badge.enabled {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

.push-state-badge.blocked {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

.phone-push-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.phone-push-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Admin Notification Broadcast Composer */
.admin-notif-composer {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
}

.composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.composer-header h4 {
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.composer-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 720px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Notifications Filter Tabs & Feed */
.notifications-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.notif-filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-filter-tab {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  transition: all 0.18s ease;
}

.notif-filter-tab.active,
.notif-filter-tab:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.notif-total-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.notifications-list-mount {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
}

.notif-card {
  position: relative;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.notif-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.notif-card.unread {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.09), rgba(2, 132, 199, 0.03));
  border-color: rgba(56, 189, 248, 0.42);
}

.notif-card-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}

.notif-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.notif-card-content {
  flex: 1;
  min-width: 0;
}

.notif-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.notif-type-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.notif-badge-file {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
}

.notif-badge-unit {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.notif-badge-urgent {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.notif-badge-exam {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.notif-badge-general {
  background: rgba(139, 92, 246, 0.16);
  color: #a78bfa;
}

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

.notif-unread-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
}

.notif-card-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.notif-card-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.notif-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.notif-goto-btn {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--primary-soft);
  white-space: nowrap;
}

/* ==========================================================================
   Google Drive Auto-Bridge & Upload Progress Styles
   ========================================================================== */
.drive-upload-progress {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-surface-alt);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.drive-upload-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.drive-upload-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border-color);
  overflow: hidden;
}

.drive-upload-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7, #10b981);
  transition: width 0.28s ease;
}

.gdrive-setup-helper {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.1), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.gdrive-helper-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.gdrive-helper-top strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.gdrive-helper-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gdrive-steps-list {
  margin: 0;
  padding-right: 18px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.gdrive-steps-list li {
  margin-bottom: 4px;
}

@media print {
  .app-header,
  .app-sidebar,
  .explorer-toolbar,
  .viewer-header,
  .viewer-subbar {
    display: none !important;
  }
  .viewer-modal {
    position: static;
    background: none;
    padding: 0;
  }
  .viewer-modal-container {
    height: auto;
    border: none;
    box-shadow: none;
  }
  .academic-reader {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-width: 100%;
  }
}
