/* Hide page content until auth is determined */
body.loading .card,
body.loading .detail-container {
  opacity: 0;
  visibility: hidden;
}

body.loading {
  background: #f6f7fb;
}

:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;          /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;       /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);       /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field { position: relative; margin-bottom: 14px; }

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover { color: var(--primary); }

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error { color: #d52731; }
.success { color: #269f53; }

/* ---------- Logout button ---------- */
/* Tiny logout icon (top-left of the page) */
.logout-icon {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
}
.logout-icon i {
  font-size: 14px;   /* slightly larger than before */
  line-height: 1;
}

.logout-icon:hover { background: var(--primary-dark); }
.logout-icon:active { transform: translateY(1px); }

/* ---------- App Container ---------- */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 20px;
  margin: 0 auto;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1f2937;
  text-align: center;
  margin-bottom: 32px;
}

/* ---------- Cards Grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* ---------- User Card - New Design ---------- */
/* ---------- User Card - New Design ---------- */
.user-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(16, 24, 40, 0.06);
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.user-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(16, 24, 40, 0.12);
}

/* Card Header */
.user-card .card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e5e7eb;
}

.user-card .avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}


.user-card .role-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Card Body */
.user-card .card-body {
  padding: 16px 20px;
  flex: 1;
}

.user-card .user-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
}

.user-card .user-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 12px;
}

.user-card .user-detail:last-child {
  margin-bottom: 0;
}

.user-card .user-detail i {
  width: 18px;
  text-align: center;
  color: #9ca3af;
}

.user-card .user-detail span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Footer */
.user-card .card-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid #f0f0f0;
}

.user-card .card-btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.user-card .view-btn {
  background: #f1f5f9;
  color: #475569;
}

.user-card .view-btn:hover {
  background: #e2e8f0;
}

/* Admin Card Colors */
.user-card.admin .avatar {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

.user-card.admin .role-badge {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
}

.user-card.admin .view-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

/* Teacher Card Colors */
.user-card.teacher .avatar {
  background: linear-gradient(135deg, #10b981, #14b8a6);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.user-card.teacher .role-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.user-card.teacher .view-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

/* Empty state */
.empty-state {
  color: #9ca3af;
  font-style: italic;
  padding: 24px;
  text-align: center;
  grid-column: 1 / -1;
}


/* ========== DETAIL PAGE STYLES ========== */

/* Body for detail page */
body.detail-page {
  display: block;
  background: #f6f7fb;
}

body.detail-page .card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  margin: 0;
  width: 90%;
  max-width: 420px;
  animation: none;
}
/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, #1e40af 0%, #3b82f6 100%);
  z-index: 2000;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
}

.sidebar-logo i {
  font-size: 1.5rem;
}

.sidebar-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.nav-section {
  margin-bottom: 16px;
}

.nav-section:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.nav-section-title {
  padding: 8px 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-left: 3px solid #fff;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-details {
  flex: 1;
}

.user-name-small {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-role-small {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}
/* ---------- Detail Container ---------- */
.detail-container {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

/* Top Bar */
.detail-topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 100;
  width: 100%;
}

.menu-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: #f1f5f9;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: #e2e8f0;
  color: #1e40af;
}

.topbar-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 1rem;
}

.topbar-logout {
  width: 40px;
  height: 40px;
  border: none;
  background: #fee2e2;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  font-size: 1rem;
  transition: all 0.2s;
}

.topbar-logout:hover {
  background: #fecaca;
}

.topbar-spacer {
  width: 44px;
  height: 44px;
}

/* Detail Content */
.detail-content {
  padding: 24px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.detail-header {
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 12px;
  transition: color 0.2s;
}

.back-link:hover {
  color: #1e40af;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

/* Info Cards Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.info-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.info-card.full-width {
  grid-column: 1 / -1;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
  font-weight: 600;
}

.info-card-header i {
  font-size: 1.1rem;
}

.info-card-body {
  padding: 20px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: #6b7280;
  font-size: 0.9rem;
}

.info-value {
  color: #1f2937;
  font-weight: 500;
  font-size: 0.9rem;
}

/* Empty Tasks */
.empty-tasks {
  text-align: center;
  padding: 30px;
  color: #9ca3af;
}

.empty-tasks i {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-tasks p {
  margin: 0;
  font-size: 0.9rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: #1e40af;
}

.stat-label {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 4px;
}

/* Mobile responsive for stats */
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .detail-content {
    padding: 16px;
  }
}


/* ========== IMPROVED SIDEBAR STYLES ========== */

/* Sidebar Search */
.sidebar-search {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 12px 8px;
  border-radius: 8px;
}

.sidebar-search i {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.sidebar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  width: 100%;
}

.sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Sidebar Logout Button */
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
}

.sidebar-logout-btn i {
  font-size: 1rem;
}

/* Improved Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.1);
}

/* Better Menu Toggle Icon */
.menu-toggle {
  width: 44px;
  height: 44px;
  border: none;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.menu-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.4);
}

.menu-toggle:active {
  transform: scale(0.98);
}

/* ========== PLACEHOLDER CONTENT STYLES ========== */
.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  padding: 40px 20px;
}

.placeholder-icon {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.placeholder-icon i {
  font-size: 3rem;
  color: #4f46e5;
}

.placeholder-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 12px 0;
}

.placeholder-text {
  font-size: 1rem;
  color: #6b7280;
  margin: 0;
  max-width: 400px;
}


/* ========== WORK RECORDS TABLE STYLES ========== */
.work-records-section {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
}

.section-header i {
  font-size: 1.2rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.work-table-container {
  overflow-x: auto;
}

.work-table {
  width: 100%;
  border-collapse: collapse;
}

.work-table th,
.work-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.work-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  font-size: 0.85rem;
}

.work-table td {
  color: #1f2937;
  font-size: 0.9rem;
}

.work-table tbody tr:hover {
  background: #f8fafc;
}

.work-table tbody tr:last-child td {
  border-bottom: none;
}

.loading-cell,
.empty-cell,
.error-cell {
  text-align: center;
  color: #9ca3af;
  padding: 40px 16px;
}

.error-cell {
  color: #dc2626;
}

/* ========== SIDEBAR WORK LIST STYLES ========== */
.sidebar-work-list {
  padding: 0 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Day Sections */
.sidebar-day-section {
  margin-bottom: 12px;
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-day-section.day-yesterday {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sidebar-day-section.day-before {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sidebar-day-section.day-two-before {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.sidebar-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.2s ease;
}

.sidebar-day-title:hover {
  background: rgba(255, 255, 255, 0.1);
}

.day-yesterday .sidebar-day-title {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
}

.day-before .sidebar-day-title {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.2);
}

.day-two-before .sidebar-day-title {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.2);
}

.sidebar-day-title i {
  font-size: 0.8rem;
}

.day-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  margin-left: auto;
}

.sidebar-day-empty {
  padding: 12px;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* Day section items container */
.sidebar-day-items {
  max-height: none;
  overflow: visible;
}

/* Collapsed state for day sections */
.sidebar-day-section.collapsed .sidebar-day-items {
  display: none;
}

.sidebar-day-section.collapsed .sidebar-day-title .collapse-icon {
  transform: rotate(-90deg);
}

.sidebar-day-title .collapse-icon {
  transition: transform 0.2s ease;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Work Time Badge */
.work-time {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
  font-weight: 500;
}

.sidebar-work-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: 0;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.sidebar-work-item:last-child {
  border-bottom: none;
}

.sidebar-work-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-work-item.day-yesterday:hover {
  background: rgba(16, 185, 129, 0.2);
}

.sidebar-work-item.day-before:hover {
  background: rgba(245, 158, 11, 0.2);
}

.sidebar-work-item.day-two-before:hover {
  background: rgba(139, 92, 246, 0.2);
}

.work-number {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.work-name {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  line-height: 1.3;
}

.sidebar-loading,
.sidebar-empty,
.sidebar-error {
  padding: 16px 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.sidebar-error {
  color: #fca5a5;
}

.main-content-area {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}



/* Mobile responsive for video modal */
@media (max-width: 768px) {
  .video-modal {
    padding-top: 20px;
  }
  
  .video-modal-content {
    width: 98%;
    border-radius: 12px;
  }
  
  .video-header {
    padding: 12px 16px;
  }
  
  .video-title {
    font-size: 0.9rem;
    max-width: 50%;
  }
  
  .video-skip-btn,
  .video-close-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}


/* ========== EMBEDDED VIDEO PLAYER STYLES ========== */
.video-player-section {
  margin-bottom: 24px;
}

.video-player-card {
  background: #1a1a2e;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.video-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
  gap: 12px;
}

.video-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

.video-icon {
  color: #a5b4fc;
  font-size: 1.5rem;
}

.video-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-skip-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.video-skip-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.video-skip-btn:active {
  transform: translateY(0);
}

.video-skip-btn i {
  font-size: 1rem;
}

.video-close-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.video-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.video-player-body {
  background: #000;
}

.video-player-body video {
  width: 100%;
  max-height: 500px;
  display: block;
}

/* Sidebar work item with video link */
.sidebar-work-item.has-video {
  cursor: pointer;
  position: relative;
}

.sidebar-work-item.has-video:hover {
  background: rgba(79, 70, 229, 0.3);
}

.sidebar-work-item.has-video .work-name {
  color: #a5b4fc;
}

.work-play-icon {
  color: #a5b4fc;
  font-size: 0.9rem;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-work-item.has-video:hover .work-play-icon {
  color: #fff;
}

/* Mobile responsive for embedded video */
@media (max-width: 768px) {
  .video-player-header {
    padding: 12px 16px;
  }
  
  .video-info {
    min-width: 150px;
  }
  
  .video-title {
    font-size: 0.9rem;
  }
  
  .video-skip-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  
  .video-skip-btn span {
    display: none;
  }
  
  .video-close-btn {
    width: 36px;
    height: 36px;
  }
  
  .video-player-body video {
    max-height: 300px;
  }
}


/* ========== MAIN PAGE TOPBAR ========== */
.main-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 0 4px;
}

.main-topbar .page-title {
  flex: 1;
  margin: 0;
  text-align: left;
  font-size: 1.5rem;
}

.main-topbar .topbar-spacer {
  width: 44px;
}

/* Fix body for main page with sidebar */
body:not(.detail-page) {
  display: block;
}

body:not(.detail-page) .card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

body:not(.detail-page) .app-container {
  padding-top: 20px;
}

/* ========== TIEU CHI DANH GIA PAGE ========== */

/* Add Criteria Section */
.add-criteria-section {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.add-criteria-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 16px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.add-criteria-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(16, 185, 129, 0.45);
}

.add-criteria-btn:active {
  transform: translateY(-1px);
}

.add-criteria-btn i {
  font-size: 1.2rem;
}

/* Empty Criteria State */
.empty-criteria {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.empty-criteria i {
  font-size: 4rem;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.empty-criteria p {
  margin: 0;
  color: #64748b;
  font-size: 1.1rem;
}

.empty-criteria .empty-hint {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #94a3b8;
}

/* ========== POPUP STYLES ========== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.popup-container {
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.popup-overlay.show .popup-container {
  transform: scale(1) translateY(0);
}

/* Popup Header */
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
}

.popup-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
  font-weight: 600;
}

.popup-title i {
  font-size: 1.4rem;
}

.popup-close {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Popup Body */
.popup-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.form-group {
  margin-bottom: 24px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 10px;
}

.form-label i {
  color: #3b82f6;
  font-size: 1rem;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  color: #1e293b;
  background: #f8fafc;
  transition: all 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-hint {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #64748b;
}

/* Rich Editor */
.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}

.toolbar-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #475569;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: #e2e8f0;
  color: #1e40af;
}

.toolbar-btn:active {
  background: #cbd5e1;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: #cbd5e1;
  margin: 0 8px;
}

.rich-editor {
  width: 100%;
  min-height: 200px;
  max-height: 300px;
  padding: 16px 18px;
  border: 2px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 12px 12px;
  font-size: 1rem;
  color: #1e293b;
  background: #fff;
  overflow-y: auto;
  outline: none;
  transition: all 0.2s;
}

.rich-editor:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.rich-editor:empty::before {
  content: attr(placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.rich-editor h3 {
  font-size: 1.1rem;
  color: #1e40af;
  margin: 0 0 8px 0;
}

.rich-editor ul,
.rich-editor ol {
  margin: 8px 0;
  padding-left: 24px;
}

.rich-editor li {
  margin-bottom: 4px;
}

/* Popup Footer */
.popup-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.popup-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-btn {
  background: #e2e8f0;
  color: #475569;
}

.cancel-btn:hover {
  background: #cbd5e1;
}

.save-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.save-btn:active {
  transform: translateY(0);
}

/* Mobile responsive for popup */
@media (max-width: 600px) {
  .popup-container {
    max-height: 95vh;
    border-radius: 20px;
  }
  
  .popup-header {
    padding: 16px 20px;
  }
  
  .popup-title {
    font-size: 1.1rem;
  }
  
  .popup-body {
    padding: 20px;
  }
  
  .rich-editor {
    min-height: 150px;
  }
  
  .popup-footer {
    flex-direction: column;
    gap: 10px;
  }
  
  .popup-btn {
    width: 100%;
    justify-content: center;
  }
  
  .add-criteria-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========== CRITERIA CARDS DISPLAY ========== */
.criteria-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #64748b;
}

.criteria-loading i {
  font-size: 2.5rem;
  color: #3b82f6;
  margin-bottom: 16px;
}

.criteria-loading p {
  margin: 0;
  font-size: 1rem;
}

.criteria-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}

.criteria-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.criteria-card:hover {
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15);
  transform: translateY(-4px);
  border-color: #93c5fd;
}

.criteria-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
}

.criteria-number {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.criteria-title-header {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  flex: 1;
}

.criteria-card-body {
  padding: 24px;
  flex: 1;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.criteria-detail-content-visible {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.8;
}

.criteria-detail-content-visible h3 {
  font-size: 1.05rem;
  color: #1e40af;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e7ff;
}

.criteria-detail-content-visible ul,
.criteria-detail-content-visible ol {
  margin: 12px 0;
  padding-left: 24px;
}

.criteria-detail-content-visible li {
  margin-bottom: 8px;
  position: relative;
}

.criteria-detail-content-visible ul li::marker {
  color: #3b82f6;
}

.criteria-detail-content-visible b,
.criteria-detail-content-visible strong {
  color: #1e293b;
  font-weight: 600;
}

.criteria-detail-content-visible p {
  margin: 0 0 12px 0;
}

.criteria-detail-content-visible p:last-child {
  margin-bottom: 0;
}

.no-detail-text {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.criteria-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.criteria-creator,
.criteria-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #64748b;
}

.criteria-creator i,
.criteria-date i {
  font-size: 0.9rem;
  color: #3b82f6;
}

.criteria-error {
  text-align: center;
  padding: 40px 20px;
  color: #dc2626;
  background: #fef2f2;
  border-radius: 16px;
}

.criteria-error i {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .criteria-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .criteria-card-header {
    padding: 16px 20px;
  }
  
  .criteria-number {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  
  .criteria-title-header {
    font-size: 1rem;
  }
  
  .criteria-card-body {
    padding: 20px;
  }
  
  .criteria-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 20px;
  }
}


/* ========== IMPROVED TOPBAR WITH ADD BUTTON ========== */
.topbar-add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.topbar-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.topbar-add-btn:active {
  transform: translateY(0);
}

.topbar-add-btn i {
  font-size: 1rem;
}

/* Mobile responsive for topbar add button */
@media (max-width: 500px) {
  .topbar-add-btn span {
    display: none;
  }
  
  .topbar-add-btn {
    padding: 10px 14px;
  }
}

/* Adjust detail content padding when no header */
.detail-content {
  padding-top: 20px;
}

/* Better spacing for criteria list */
.criteria-list {
  margin-top: 8px;
}


/* ========== CARD ACTION BUTTONS (EDIT/DELETE) ========== */
.criteria-card-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.3s ease;
}

.criteria-card:hover .criteria-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.criteria-card-header {
  position: relative;
}

.card-action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.card-action-btn.edit-btn {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.card-action-btn.edit-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.card-action-btn.delete-btn {
  background: rgba(239, 68, 68, 0.3);
  color: #fecaca;
}

.card-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.5);
  color: #fff;
  transform: scale(1.1);
}

/* Mobile: always show actions */
@media (max-width: 768px) {
  .criteria-card-actions {
    opacity: 1;
    transform: translateY(0);
  }
  
  .card-action-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
}

/* ========== CONTENT DROPDOWN WITH ADD BUTTON ========== */
.content-dropdown-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-dropdown-wrapper .form-input {
  flex: 1;
}

.add-content-btn {
  width: 48px;
  height: 48px;
  border: 2px dashed #3b82f6;
  background: #eff6ff;
  border-radius: 12px;
  color: #3b82f6;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.add-content-btn:hover {
  background: #3b82f6;
  color: #fff;
  border-style: solid;
}

/* ========== MINI POPUP FOR ADDING CONTENT ========== */
.mini-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.mini-popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.mini-popup-container {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.mini-popup-overlay.show .mini-popup-container {
  transform: scale(1) translateY(0);
}

.mini-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.mini-popup-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

.mini-popup-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mini-popup-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.mini-popup-body {
  padding: 20px;
}

.mini-popup-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}


/* ========== EDIT CONTENT BUTTON ========== */
.edit-content-btn {
  width: 48px;
  height: 48px;
  border: 2px solid #f59e0b;
  background: #fef3c7;
  border-radius: 12px;
  color: #d97706;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.edit-content-btn:hover {
  background: #f59e0b;
  color: #fff;
}

/* ========== MANAGE CONTENT POPUP ========== */
.manage-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.manage-popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.manage-popup-container {
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.manage-popup-overlay.show .manage-popup-container {
  transform: scale(1) translateY(0);
}

.manage-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  flex-shrink: 0;
}

.manage-popup-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

.manage-popup-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.manage-popup-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.manage-popup-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.manage-popup-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

/* Content List */
.content-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #64748b;
}

.content-empty {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
}

.content-empty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

/* Content Item */
.content-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.content-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.content-item-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

.content-item-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1e293b;
}

.content-item-actions {
  display: flex;
  gap: 8px;
}

.content-action-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.content-action-btn.edit {
  background: #dbeafe;
  color: #2563eb;
}

.content-action-btn.edit:hover {
  background: #2563eb;
  color: #fff;
}

.content-action-btn.delete {
  background: #fee2e2;
  color: #dc2626;
}

.content-action-btn.delete:hover {
  background: #dc2626;
  color: #fff;
}

/* Edit Content Item Mode */
.content-item.editing {
  background: #eff6ff;
  border-color: #3b82f6;
}

.content-item.editing .content-item-name {
  display: none;
}

.content-edit-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  background: #fff;
}

.content-action-btn.save {
  background: #dcfce7;
  color: #16a34a;
}

.content-action-btn.save:hover {
  background: #16a34a;
  color: #fff;
}

.content-action-btn.cancel-edit {
  background: #f1f5f9;
  color: #64748b;
}

.content-action-btn.cancel-edit:hover {
  background: #64748b;
  color: #fff;
}

/* ========== CRITERIA BADGES ========== */
.criteria-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px 0;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.criteria-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.criteria-badge i {
  font-size: 0.75rem;
}

.criteria-badge.type-badge {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.criteria-badge.content-badge {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border: 1px solid #86efac;
}

/* ========== WIDER CARDS ========== */
.criteria-cards {
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
}

/* Mobile responsive */
@media (max-width: 600px) {
  .criteria-cards {
    grid-template-columns: 1fr;
  }
  
  .criteria-badges {
    padding: 12px 20px 0;
  }
}

/* ========== COMPACT HEADER DESIGN V4 ========== */

/* Combined Header - Compact */
.combined-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  padding: 14px 24px;
  position: relative;
  overflow: hidden;
}

.combined-header::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

/* Single Row Layout */
.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

/* Menu Button */
.header-menu-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.header-menu-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Header Center - Avatar + Name */
.header-center {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.profile-info {
  min-width: 0;
}

.profile-subtitle {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.profile-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header Right - Badges + Back */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  white-space: nowrap;
}

.profile-badge i {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Back Button */
.header-back-btn {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.header-back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Detail Content */
.detail-content {
  padding: 24px;
}

/* Main Content Area */
.main-content-area {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  color: #94a3b8;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  border: 1px solid #f1f5f9;
}

.main-content-area p {
  margin: 0;
  font-size: 0.95rem;
}

/* Hide old topbar only on pages with combined header */
.has-combined-header .detail-topbar {
  display: none;
}

.has-combined-header .detail-container {
  padding-top: 0;
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .profile-badge span {
    display: none;
  }
  
  .profile-badge {
    padding: 6px 10px;
  }
}

@media (max-width: 600px) {
  .combined-header {
    padding: 12px 16px;
  }
  
  .header-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .header-center {
    order: 2;
    width: 100%;
    flex: none;
  }
  
  .header-right {
    order: 1;
    margin-left: auto;
  }
  
  .header-right .profile-badge {
    display: none;
  }
  
  .profile-avatar {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
  
  .profile-name {
    font-size: 1.1rem;
  }
  
  .detail-content {
    padding: 16px;
  }
  
  .main-content-area {
    padding: 30px 20px;
  }
}


/* ========== CRITERIA SELECTION POPUP ========== */
.criteria-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.criteria-popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.criteria-popup-container {
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.criteria-popup-overlay.show .criteria-popup-container {
  transform: scale(1) translateY(0);
}

.criteria-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #fff;
}

.criteria-popup-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.15rem;
  font-weight: 600;
}

.criteria-popup-close {
  width: 38px;
  height: 38px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.criteria-popup-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.criteria-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Content Selection */
.content-selection {
  text-align: center;
}

.selection-label {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 20px;
}

.content-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.content-select-btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.content-select-btn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  border-color: #7c3aed;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
}

.content-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #64748b;
}

/* Criteria Results */
.results-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f1f5f9;
}

.back-to-selection {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  color: #64748b;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.back-to-selection:hover {
  background: #e2e8f0;
  color: #475569;
}

.selected-content-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #7c3aed;
}

.criteria-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Individual Criteria Item */
.criteria-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s ease;
}

.criteria-item:hover {
  border-color: #a855f7;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.1);
}

.criteria-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.criteria-item-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

.criteria-item-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.criteria-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.criteria-item-badge.type {
  background: #dbeafe;
  color: #1e40af;
}

.criteria-item-badge.penalty {
  background: #fee2e2;
  color: #dc2626;
}

.criteria-item-badge.content {
  background: #dcfce7;
  color: #166534;
}

.criteria-item-detail {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.7;
  padding: 12px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.criteria-item-detail h3 {
  color: #7c3aed;
  font-size: 1rem;
  margin: 0 0 8px 0;
}

.criteria-item-detail ul,
.criteria-item-detail ol {
  margin: 8px 0;
  padding-left: 20px;
}

.criteria-item-detail li {
  margin-bottom: 4px;
}

.no-criteria {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
}

.no-criteria i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

/* Popup Footer */
.criteria-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.video-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 0.9rem;
}

.video-info-bar i {
  color: #7c3aed;
}

.play-video-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.play-video-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .criteria-popup-container {
    max-height: 95vh;
  }
  
  .criteria-popup-body {
    padding: 16px;
  }
  
  .criteria-popup-footer {
    flex-direction: column;
    gap: 12px;
  }
  
  .play-video-btn {
    width: 100%;
    justify-content: center;
  }
  
  .content-select-btn {
    width: 100%;
  }
}


/* ========== CRITERIA DISPLAY ON MAIN PAGE ========== */
.criteria-display-section {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-top: 24px;
}

.criteria-display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #fff;
  flex-wrap: wrap;
  gap: 12px;
}

.criteria-display-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

.criteria-display-title i {
  font-size: 1.3rem;
}

.criteria-content-label {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.95rem;
}

.criteria-display-actions {
  display: flex;
  gap: 10px;
}

.change-content-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.change-content-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.criteria-display-body {
  padding: 24px;
}

/* Individual Criteria Item on Main Page */
.criteria-display-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.criteria-display-item:hover {
  border-color: #a855f7;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.1);
}

.criteria-display-item:last-child {
  margin-bottom: 0;
}

.criteria-item-number {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.criteria-item-content {
  flex: 1;
  min-width: 0;
}

.criteria-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.criteria-item-title-main {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 200px;
}

.criteria-item-badges-main {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-penalty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.criteria-item-detail-main {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.7;
  padding: 14px 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.criteria-item-detail-main h3 {
  color: #7c3aed;
  font-size: 1rem;
  margin: 0 0 8px 0;
}

.criteria-item-detail-main ul,
.criteria-item-detail-main ol {
  margin: 8px 0;
  padding-left: 20px;
}

.criteria-item-detail-main li {
  margin-bottom: 4px;
}

/* Checkbox for assessment */
.criteria-item-checkbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.criteria-checkbox {
  width: 28px;
  height: 28px;
  cursor: pointer;
  accent-color: #10b981;
}

.criteria-item-checkbox label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.no-criteria-main {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.no-criteria-main i {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

/* Cancel button in popup */
.cancel-popup-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #64748b;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-popup-btn:hover {
  background: #475569;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .criteria-display-item {
    flex-direction: column;
  }
  
  .criteria-item-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .criteria-item-actions-btns {
    flex-direction: row;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    width: 100%;
  }
  
  .criteria-item-top {
    flex-direction: column;
  }
  
  .criteria-display-header {
    padding: 16px 20px;
  }
  
  .criteria-display-body {
    padding: 16px;
  }
}

/* ========== ASSESSMENT BUTTONS ========== */
.criteria-item-actions-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  min-width: 140px;
  justify-content: center;
}

.assess-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.assess-btn i {
  font-size: 0.9rem;
}

.pass-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pass-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.retrain-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.retrain-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.assess-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Assessment Result Display */
.assessment-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 140px;
  margin: auto 0;
}

.assessment-result i {
  font-size: 1.1rem;
}

.result-pass {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border: 2px solid #86efac;
}

.result-retrain {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 2px solid #fcd34d;
}

/* Mobile responsive for assessment buttons */
@media (max-width: 500px) {
  .criteria-item-actions-btns {
    flex-direction: row;
    min-width: auto;
  }
  
  .assess-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  
  .assess-btn span {
    display: none;
  }
  
  .assessment-result {
    min-width: auto;
    padding: 10px 14px;
  }
  
  .assessment-result span {
    font-size: 0.75rem;
  }
}

/* ========== RETRAIN INPUT SECTION ========== */
.criteria-display-item.has-retrain-input {
  flex-wrap: wrap;
}

.retrain-input-section {
  width: 100%;
  margin-top: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  animation: slideDown 0.3s ease;
  order: 99;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.retrain-input-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: #92400e;
  font-weight: 600;
  font-size: 0.95rem;
}

.retrain-input-header i {
  font-size: 1.2rem;
  color: #d97706;
}

.retrain-textarea {
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  border: 2px solid #fbbf24;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: #1e293b;
  outline: none;
  transition: all 0.2s ease;
}

.retrain-textarea:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.retrain-textarea::placeholder {
  color: #94a3b8;
}

.retrain-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.retrain-cancel-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #e2e8f0;
  border: none;
  border-radius: 10px;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retrain-cancel-btn:hover {
  background: #cbd5e1;
}

.retrain-submit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.retrain-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.retrain-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.retrain-notes-saved {
  margin-top: 10px;
  padding: 10px 14px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 10px;
  font-size: 0.85rem;
  color: #854d0e;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.retrain-notes-saved i {
  margin-top: 2px;
  color: #ca8a04;
}


/* Notes displayed below content after saving */
.retrain-notes-saved-below {
  width: 100%;
  margin-top: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 2px solid #fcd34d;
  border-radius: 12px;
  font-size: 0.9rem;
  color: #854d0e;
  line-height: 1.6;
  order: 99;
}

.retrain-notes-saved-below i {
  color: #ca8a04;
  margin-right: 8px;
}

.retrain-notes-saved-below strong {
  color: #92400e;
}


/* Mobile responsive for retrain input */
@media (max-width: 500px) {
  .retrain-input-section {
    padding: 16px;
  }
  
  .retrain-input-actions {
    flex-direction: column;
  }
  
  .retrain-cancel-btn,
  .retrain-submit-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========== CARD ASSESSED SECTION ========== */
.card-assessed {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.assessed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 6px;
}

.assessed-label i {
  color: #94a3b8;
}

.assessed-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

/* Not assessed state */
.card-assessed.not-assessed {
  background: #fef3c7;
  border-top-color: #fcd34d;
}

.card-assessed.not-assessed .assessed-label {
  color: #92400e;
}

.card-assessed.not-assessed .assessed-label i {
  color: #d97706;
}

.card-assessed.not-assessed .assessed-value {
  color: #b45309;
}

/* Assessed state */
.card-assessed.assessed {
  background: #dcfce7;
  border-top-color: #86efac;
}

.card-assessed.assessed .assessed-label {
  color: #166534;
}

.card-assessed.assessed .assessed-label i {
  color: #22c55e;
}

.card-assessed.assessed .assessed-value {
  color: #15803d;
}

/* ========== CONTENT SECTIONS IN POPUP ========== */
.content-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.content-section {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  width: 100%;
}

.content-section.needs-assessment {
  background: #fffbeb;
  border-color: #f59e0b;
  border-left: 4px solid #f59e0b;
}

.content-section.recently-assessed {
  background: #f0fdf4;
  border-color: #22c55e;
  border-left: 4px solid #22c55e;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.content-section.needs-assessment .section-title {
  color: #b45309;
}

.content-section.needs-assessment .section-title i {
  color: #f59e0b;
}

.content-section.recently-assessed .section-title {
  color: #15803d;
}

.content-section.recently-assessed .section-title i {
  color: #22c55e;
}

.section-content-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  max-height: none;
  overflow-y: visible;
  padding-right: 4px;
}

.section-content-buttons::-webkit-scrollbar {
  width: 6px;
}

.section-content-buttons::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.section-content-buttons::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.section-content-buttons::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

.content-select-btn.needs-btn {
  background: #fff;
  border: 1px solid #fbbf24;
  color: #92400e;
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: left;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.content-select-btn.needs-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.content-select-btn.assessed-btn {
  background: #fff;
  border: 1px solid #86efac;
  color: #166534;
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: left;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.content-select-btn.assessed-btn:hover {
  background: #dcfce7;
  border-color: #22c55e;
  color: #14532d;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.content-select-btn .assessed-date {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.7;
  margin-top: 2px;
}

.content-select-btn i {
  font-size: 0.8rem;
  margin-right: 4px;
}

.section-empty {
  text-align: center;
  padding: 20px 16px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-style: italic;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

.content-section.needs-assessment .section-empty {
  color: #b45309;
  background: rgba(245, 158, 11, 0.05);
}

.content-section.recently-assessed .section-empty {
  color: #15803d;
  background: rgba(34, 197, 94, 0.05);
}

/* Mobile responsive for improved popup */
@media (max-width: 600px) {
  .section-content-buttons {
    grid-template-columns: 1fr;
    max-height: 150px;
  }
  
  .content-select-btn.needs-btn,
  .content-select-btn.assessed-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}


/* ========== MODERN USER CARDS ========== */
.user-card-modern {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.user-card-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  transition: all 0.3s ease;
}

.user-card-modern.assessed::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.user-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.card-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-modern {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.card-info {
  flex: 1;
  min-width: 0;
}

.user-name-modern {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-modern {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-modern i {
  color: #9ca3af;
  font-size: 0.8rem;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
}

.card-status.not-assessed {
  background: #fef3c7;
  color: #92400e;
}

.card-status.not-assessed i {
  color: #f59e0b;
}

.card-status.assessed {
  background: #dcfce7;
  color: #166534;
}

.card-status.assessed i {
  color: #22c55e;
}

.card-action-modern {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.card-action-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.card-action-modern:active {
  transform: translateY(0);
}

/* Mobile responsive for modern cards */
@media (max-width: 500px) {
  .user-card-modern {
    padding: 16px;
  }
  
  .avatar-modern {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }
  
  .user-name-modern {
    font-size: 1rem;
  }
  
  .card-status {
    padding: 10px 14px;
    font-size: 0.8rem;
  }
  
  .card-action-modern {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
}


/* ========== FILTER AND COMPACT MODE ========== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

.filter-select {
  padding: 8px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Compact Toggle */
.compact-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #f1f5f9;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.compact-toggle:hover {
  background: #e2e8f0;
}

.compact-toggle.active {
  background: #3b82f6;
  color: #fff;
}

.compact-toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.compact-toggle-switch {
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.compact-toggle.active .compact-toggle-switch {
  background: rgba(255, 255, 255, 0.3);
}

.compact-toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.compact-toggle.active .compact-toggle-switch::after {
  left: 23px;
}

/* ========== COMPACT CARDS ========== */
.criteria-cards.compact-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.criteria-card-compact {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.criteria-card-compact:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateX(4px);
}

.compact-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.compact-title {
  flex: 2;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.compact-detail {
  flex: 3;
  color: #64748b;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.compact-type {
  padding: 4px 12px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.compact-penalty {
  padding: 4px 12px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 80px;
  text-align: center;
}

.compact-arrow {
  color: #94a3b8;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ========== SINGLE CARD VIEW ========== */
.single-card-view {
  display: none;
}

.single-card-view.active {
  display: block;
}

.single-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #f1f5f9;
  border: none;
  border-radius: 10px;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.back-btn i {
  font-size: 0.85rem;
}

.single-card-title {
  font-size: 1.1rem;
  color: #1e293b;
  font-weight: 600;
}

/* Hide normal cards when in single view */
.criteria-list.single-view-active .criteria-cards {
  display: none;
}

.criteria-list.single-view-active .single-card-view {
  display: block;
}

/* Mobile responsive for compact */
@media (max-width: 900px) {
  .criteria-card-compact {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .compact-title {
    flex: 1 1 100%;
    order: 1;
  }
  
  .compact-number {
    order: 0;
  }
  
  .compact-detail {
    flex: 1 1 100%;
    order: 2;
  }
  
  .compact-type,
  .compact-penalty {
    order: 3;
  }
  
  .compact-arrow {
    display: none;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    justify-content: space-between;
  }
}

@media (max-width: 500px) {
  .detail-topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  
  .filter-bar {
    width: 100%;
    order: 3;
  }
}

/* ========== FILTER AND COMPACT MODE ========== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

.filter-select {
  padding: 8px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Compact Toggle */
.compact-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #f1f5f9;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.compact-toggle:hover {
  background: #e2e8f0;
}

.compact-toggle.active {
  background: #3b82f6;
  color: #fff;
}

.compact-toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.compact-toggle-switch {
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.compact-toggle.active .compact-toggle-switch {
  background: rgba(255, 255, 255, 0.3);
}

.compact-toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.compact-toggle.active .compact-toggle-switch::after {
  left: 23px;
}

/* ========== COMPACT CARDS ========== */
.criteria-cards.compact-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.criteria-card-compact {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.criteria-card-compact:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateX(4px);
}

.compact-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.compact-title {
  flex: 2;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.compact-detail {
  flex: 3;
  color: #64748b;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.compact-type {
  padding: 4px 12px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.compact-penalty {
  padding: 4px 12px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 80px;
  text-align: center;
}

.compact-arrow {
  color: #94a3b8;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ========== SINGLE CARD VIEW ========== */
.single-card-view {
  display: none;
}

.single-card-view.active {
  display: block;
}

.single-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #f1f5f9;
  border: none;
  border-radius: 10px;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.back-btn i {
  font-size: 0.85rem;
}

.single-card-title {
  font-size: 1.1rem;
  color: #1e293b;
  font-weight: 600;
}

/* Hide normal cards when in single view */
.criteria-list.single-view-active .criteria-cards {
  display: none;
}

.criteria-list.single-view-active .single-card-view {
  display: block;
}

/* Mobile responsive for compact */
@media (max-width: 900px) {
  .criteria-card-compact {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .compact-title {
    flex: 1 1 100%;
    order: 1;
  }
  
  .compact-number {
    order: 0;
  }
  
  .compact-detail {
    flex: 1 1 100%;
    order: 2;
  }
  
  .compact-type,
  .compact-penalty {
    order: 3;
  }
  
  .compact-arrow {
    display: none;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    justify-content: space-between;
  }
}

@media (max-width: 500px) {
  .detail-topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  
  .filter-bar {
    width: 100%;
    order: 3;
  }
}