/* ============================================
   Modern Analytics Dashboard
   ============================================ */

/* Hero */
.dash-hero {
  background: linear-gradient(135deg, #2E8B57 0%, #246B43 100%);
  color: #fff;
  border-radius: 16px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 24px rgba(46,139,87,0.25);
  position: relative;
  overflow: hidden;
}
.dash-hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(245,179,0,0.25), transparent 70%);
  border-radius: 50%;
}
.dash-hero-left { position: relative; z-index: 1; }
.dash-greeting { font-size: 0.9rem; opacity: 0.9; margin-bottom: 0.25rem; }
.dash-title { color: #fff !important; font-size: 1.65rem; font-weight: 700; margin: 0 0 0.4rem; }
.dash-date { font-size: 0.85rem; opacity: 0.85; display: inline-flex; align-items: center; gap: 0.4rem; }
.dash-hero-actions { display: flex; gap: 0.5rem; position: relative; z-index: 1; }
.dash-hero-actions .btn-light { color: var(--tu-red); font-weight: 600; }
.dash-hero-actions .btn-outline-light { color: #fff; border-color: rgba(255,255,255,0.5); }
.dash-hero-actions .btn-outline-light:hover { background: rgba(255,255,255,0.15); color: #fff; border-color: #fff; }

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.kpi-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.1rem 1.2rem 0.6rem;
  box-shadow: 0 2px 6px rgba(27,42,73,0.05);
  border: 1px solid #eef0f3;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27,42,73,0.08);
}
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.kpi-red::before    { background: #2E8B57; }
.kpi-yellow::before { background: #D4AF37; }
.kpi-green::before  { background: #16a34a; }
.kpi-blue::before   { background: #444CE7; }

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}
.kpi-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.kpi-red .kpi-icon    { background: rgba(46,139,87,0.1);  color: #2E8B57; }
.kpi-yellow .kpi-icon { background: rgba(245,179,0,0.18); color: #A8862B; }
.kpi-green .kpi-icon  { background: rgba(22,163,74,0.1);  color: #16a34a; }
.kpi-blue .kpi-icon   { background: rgba(68,76,231,0.1);  color: #444CE7; }

.kpi-delta {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.kpi-delta i { width: 0.85em; height: 0.85em; stroke-width: 2.5; }
.kpi-delta.up   { background: rgba(22,163,74,0.12);  color: #16a34a; }
.kpi-delta.down { background: rgba(220,53,69,0.12);  color: #dc3545; }
.kpi-delta.flat { background: #f2f4f7; color: #667085; }

.kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.kpi-label {
  font-size: 0.82rem;
  color: var(--muted-fg);
  margin-top: 0.1rem;
}
.kpi-extra { opacity: 0.7; font-size: 0.75rem; }
.kpi-spark {
  width: 100% !important;
  height: 38px !important;
  margin-top: 0.4rem;
}

/* Quick Action Cards */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.qa-card {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--foreground);
  transition: all 0.15s;
}
.qa-card:hover {
  border-color: var(--tu-red);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(27,42,73,0.08);
  color: var(--foreground);
}
.qa-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.qa-icon.red    { background: rgba(46,139,87,0.1);  color: #2E8B57; }
.qa-icon.yellow { background: rgba(245,179,0,0.2); color: #A8862B; }
.qa-icon.green  { background: rgba(22,163,74,0.1);  color: #16a34a; }
.qa-icon.blue   { background: rgba(68,76,231,0.1);  color: #444CE7; }
.qa-icon.purple { background: rgba(138,43,226,0.1); color: #8a2be2; }
.qa-icon.gray   { background: #f2f4f7; color: #475467; }
.qa-title { font-weight: 600; font-size: 0.9rem; }
.qa-card small { color: var(--muted-fg); font-size: 0.75rem; }

/* Dashboard rows & cards */
.dash-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-col-8 { grid-column: span 8; }
.dash-col-4 { grid-column: span 4; }
.dash-card {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 2px 6px rgba(27,42,73,0.04);
}
.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.dash-card-head h6 { font-weight: 700; }
.dash-legend { font-size: 0.78rem; color: var(--muted-fg); display: flex; align-items: center; }
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.35rem;
}
.dash-chart-wrap { height: 280px; position: relative; }

/* Top Courses */
.top-courses { display: flex; flex-direction: column; gap: 0.9rem; }
.top-course {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.top-rank {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #f2f4f7;
  color: #475467;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center; justify-content: center;
}
.top-course:nth-child(1) .top-rank { background: rgba(245,179,0,0.3); color: #A8862B; }
.top-course:nth-child(2) .top-rank { background: rgba(46,139,87,0.12); color: #2E8B57; }
.top-course:nth-child(3) .top-rank { background: rgba(22,163,74,0.12); color: #16a34a; }
.top-body { flex: 1; min-width: 0; }
.top-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--heading);
  margin-bottom: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-bar {
  height: 6px;
  background: #f2f4f7;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.top-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2E8B57, #D4AF37);
  border-radius: 999px;
}
.top-meta {
  display: flex; gap: 0.9rem;
  font-size: 0.75rem;
  color: var(--muted-fg);
}
.top-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }
.top-meta i { width: 0.85em; height: 0.85em; }

/* Dashboard table */
.dash-table { font-size: 0.9rem; }
.dash-table thead th {
  background: #fafbfc;
  border-bottom: 1px solid #eef0f3;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-fg);
  padding: 0.65rem 0.75rem;
}
.dash-table tbody td {
  padding: 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f5f6f8;
}
.dash-table tbody tr:last-child td { border-bottom: 0; }
.dash-table tbody tr:hover { background: #fafbfc; }

.course-cell {
  display: flex; align-items: center; gap: 0.6rem;
}
.course-cell .course-thumb {
  width: 42px; height: 42px;
  max-height: none;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.course-cell .course-thumb-ph {
  width: 42px; height: 42px;
  border-radius: 8px;
  background: var(--tu-red-lighter);
  color: var(--tu-red);
  display: inline-flex;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}

.prog-wrap { display: flex; flex-direction: column; gap: 0.2rem; }
.prog-bar { height: 6px; background: #f2f4f7; border-radius: 999px; overflow: hidden; }
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #2E8B57, #16a34a);
  border-radius: 999px;
  transition: width 0.4s;
}
.prog-wrap small { color: var(--muted-fg); font-size: 0.72rem; }

.badge-soft {
  background: #f2f4f7;
  color: #475467;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.activity-feed::-webkit-scrollbar { width: 4px; }
.activity-feed::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.activity-item {
  display: flex;
  gap: 0.7rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #f5f6f8;
}
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--tu-red);
  color: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.activity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.activity-body { flex: 1; min-width: 0; }
.activity-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}
.activity-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.activity-tag i { width: 0.8em; height: 0.8em; }
.tag-enroll   { background: rgba(68,76,231,0.1);  color: #444CE7; }
.tag-complete { background: rgba(22,163,74,0.1);  color: #16a34a; }
.tag-cert     { background: rgba(46,139,87,0.1); color: #2E8B57; }
.activity-course {
  font-size: 0.82rem;
  color: var(--heading);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-time {
  font-size: 0.72rem;
  color: var(--muted-fg);
  margin-top: 0.1rem;
}

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

/* Review mini cards */
.review-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}
.review-mini {
  background: #fafbfc;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  padding: 0.9rem;
}
.review-stars { color: #D4AF37; font-size: 0.9rem; margin-bottom: 0.35rem; }
.review-comment {
  font-size: 0.85rem;
  color: var(--foreground);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.review-meta { font-size: 0.8rem; }

/* Responsive */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(3, 1fr); }
  .dash-col-8, .dash-col-4 { grid-column: span 12; }
  .review-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-hero { flex-direction: column; align-items: flex-start; padding: 1.25rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .kpi-value { font-size: 1.5rem; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .dash-title { font-size: 1.3rem; }
}

/* === Discussion Panel === */
.discussion-panel { border-radius: var(--radius-xl); }
.discussion-list { display: flex; flex-direction: column; gap: 1rem; }
.discussion-post {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  position: relative;
}
.discussion-post.pinned {
  border-color: var(--kc-orange);
  background: var(--kc-orange-lighter);
}
.disc-pin-badge {
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--kc-orange);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.disc-pin-badge [data-lucide] { width: 12px; height: 12px; }
.disc-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.disc-avatar-fallback {
  background: var(--kc-navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.disc-author { color: var(--kc-navy); }
.disc-badge-instructor {
  background: var(--kc-orange);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
}
.disc-content {
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--foreground);
}
.disc-content a { color: var(--kc-orange); text-decoration: underline; }
.disc-actions { display: flex; align-items: center; flex-wrap: wrap; }
.disc-actions .btn-link {
  font-size: 0.8125rem;
  color: var(--muted-fg);
  text-decoration: none;
}
.disc-actions .btn-link:hover { color: var(--kc-navy); }
.disc-actions .btn-link [data-lucide] { width: 14px; height: 14px; }
.discussion-reply {
  padding: 0.75rem;
  border-left: 3px solid var(--border);
  background: var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 0.5rem;
}
.discussion-reply .disc-avatar-fallback { background: var(--muted-fg); }
.disc-reply-form input { font-size: 0.875rem; }
.min-width-0 { min-width: 0; }

/* === Discussion Phase 2 === */
.disc-vote-btn { color: var(--muted-fg); text-decoration: none; }
.disc-vote-btn:hover { color: var(--kc-orange); }
.disc-vote-btn.voted { color: var(--kc-orange); font-weight: 600; }
.disc-vote-btn.voted [data-lucide="heart"] { fill: var(--kc-orange); }
.disc-answer-btn { color: var(--muted-fg); text-decoration: none; }
.disc-answer-btn:hover { color: var(--success); }
.disc-badge-answered {
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.disc-badge-answered [data-lucide] { width: 12px; height: 12px; }
.discussion-post.answered {
  border-left: 4px solid var(--success);
}
.disc-mention {
  color: var(--kc-orange);
  background: var(--kc-orange-lighter);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9em;
}
.disc-mention-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 60px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  max-height: 220px;
  overflow-y: auto;
}
.disc-mention-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
}
.disc-mention-item:hover,
.disc-mention-item.active {
  background: var(--kc-navy-lighter);
}

/* === Notifications === */
.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--destructive);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notif-dropdown {
  width: 360px;
  max-width: 90vw;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-top: 0.5rem !important;
  overflow: hidden;
}
.notif-list {
  max-height: 420px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  background: var(--kc-orange-lighter);
}
.notif-item.is-read { background: transparent; }
.notif-item:hover { background: var(--muted); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--kc-navy-lighter);
  color: var(--kc-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-icon [data-lucide] { width: 18px; height: 18px; }
.notif-body { flex-grow: 1; min-width: 0; }
.notif-text { font-size: 0.875rem; color: var(--foreground); }
.notif-context { font-size: 0.75rem; margin-top: 2px; }
.notif-excerpt {
  background: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
}
.notif-unread-dot {
  width: 8px;
  height: 8px;
  background: var(--kc-orange);
  border-radius: 50%;
  position: absolute;
  top: 1rem;
  right: 0.75rem;
}

/* Bell in dark navbar — vertically centered, consistent height with avatar */
#mainNav #notifBell {
  color: rgba(255,255,255,0.85) !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  padding: 0 !important;
  margin: 0 4px;
  border-radius: var(--radius-sm);
}
#mainNav #notifBell [data-lucide] {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}
#mainNav #notifBell:hover { color: #fff !important; background: rgba(255,255,255,0.1); }
#mainNav #notifBellWrap { display: flex; align-items: center; }

