/* app-layout.css - Bố cục ứng dụng dashboard sáng sủa, khoa học, dựa trên thiết kế mẫu */

/* Chỉ ghi đè font, background — KHÔNG ghi đè height để tránh xung đột */
body, html {
  margin: 0;
  padding: 0;
  font-family: 'Nunito', 'Inter', sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


.app-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-top: 90px; /* Offset for fixed dash-header (62px) and dash-ticker (28px) */
  min-height: calc(100vh - 90px); /* Thay height cứng bằng min-height */
  overflow: visible; /* Bỏ overflow:hidden — cho phép nội dung cuộn */
}

/* --- Vùng số 1: TOP BAR (Tìm kiếm) --- */
.app-topbar {
  background-color: #0BB885; /* Xanh lá theo mẫu */
  color: white;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(11, 184, 133, 0.2);
  z-index: 50;
  position: relative;
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-brand {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-brand-ico {
  background: white;
  color: #0BB885;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Search Bar trên Topbar */
.app-search-wrap {
  position: relative;
  width: 480px;
  max-width: 100%;
}

.app-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 99px;
  padding: 10px 20px 10px 48px;
  color: white;
  font-size: 15px;
  font-family: 'Nunito', sans-serif;
  transition: all 0.3s;
}

.app-search-input::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

.app-search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.25);
  border-color: white;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.app-search-ico {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  display: flex;
}

.app-search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  background: rgba(255,255,255,0.2);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: .2s;
}

.app-search-input:valid ~ .app-search-clear {
  opacity: 1; visibility: visible;
}

/* --- Vùng 2 & 3: MAIN WORKSPACE --- */
.app-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  overflow: visible; /* Cho phép nội dung hiển thị đầy đủ */
  min-height: 0;
}

/* Column structure */
.app-left-column {
  /* Region 2: Takes full height of workspace */
  display: flex;
  flex-direction: column;
}
.app-right-column {
  /* Right side containing Region 1 (Search) and Region 3 (Results) */
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.app-panel {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  border: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
}
.panel-body {
  padding: 16px; /* Reduced from 20px for a more compact look */
  flex: 1;
  overflow-y: auto;
}

/* Bold Professional Headers */
.panel-header {
  padding: 16px 20px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}
.header-icon {
  font-size: 1.2rem;
  background: rgba(0,0,0,0.2);
  width: 32px; height: 32px;
  display: inline-flex; justify-content: center; align-items: center;
  border-radius: 8px;
}
.vibrant-blue {
  background: #3B82F6; /* Màu xanh dương đậm chuẩn */
  border-bottom: 1px solid #2563EB;
}
.vibrant-blue .header-icon {
  color: white;
}
.vibrant-green {
  background: #0D9488; /* Changed to Teal to distinguish from Green news ticker */
  border-bottom: 1px solid #0F766E;
}
.vibrant-green .header-icon {
  color: white;
}
.vibrant-teal {
  background: #14B8A6;
  border-bottom: 1px solid #0D9488;
}

/* Region 1: Search Form */
.search-region {
  flex-shrink: 0;
  position: relative; /* Needed so dropdown positions correctly */
  overflow: visible;  /* Allow dropdown to overflow outside */
}
/* Override panel-body to allow dropdown overflow */
.search-region .panel-body {
  overflow: visible;
}
.search-input-group {
  display: flex;
  position: relative;
  width: 100%;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  /* REMOVED overflow: hidden - it was clipping the search dropdown */
}
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #10B981;
  z-index: 5;
}
.vibrant-input {
  flex: 1;
  padding: 12px 16px 12px 40px;
  border: 1px solid #D1D5DB;
  border-right: none;
  border-radius: 12px 0 0 12px;
  font-size: 15px;
  font-family: inherit;
  color: #1E293B;
  transition: all 0.2s;
  background: white;
}
.vibrant-input:focus {
  outline: none;
  border-color: #10B981;
  background: #F0FDF4;
}
.btn-submit-search {
  background: #0D9488;
  color: white;
  border: none;
  padding: 0 24px;
  border-radius: 0 12px 12px 0;
  font-weight: 700;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-submit-search:hover {
  background: #0F766E;
  filter: brightness(1.08);
}
.btn-clear-search {
  position: absolute;
  right: 180px; /* offset from submit button */
  top: 50%;
  transform: translateY(-50%);
  background: #E2E8F0;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #64748B;
  cursor: pointer;
}

/* Tra cứu Kết quả dropdown */
/* The dropdown is positioned relative to .vibrant-search-form */
.vibrant-search-form {
  position: relative;
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.15), 0 4px 10px -2px rgba(0, 0, 0, 0.08);
  margin-top: 0;
  display: none;
  z-index: 9999; /* Very high to appear above all panels */
  max-height: 380px;
  overflow-y: auto;
  animation: dropdownSlideIn 0.15s ease;
}
@keyframes dropdownSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-dropdown.hien {
  display: block;
}
.ket-qua-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #F3F4F6;
  transition: background 0.15s;
}
.ket-qua-item:hover,
.ket-qua-item.active {
  background: #EFF6FF;
  border-left: 3px solid #3B82F6;
}
/* Avatar ảnh pixel 3D (tròn, nền pastel) */
.ket-qua-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  padding: 3px;
  background: linear-gradient(135deg, #EEF2FF, #F0FDF4);
  border: 2px solid #C7D2FE;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,0.15);
}
/* Fallback emoji avatar */
.ket-qua-avatar {
  background: #EFF6FF;
  color: #3B82F6;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.ket-qua-info { flex: 1; min-width: 0; }
.ket-qua-ten { font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ket-qua-phu { font-size: 12.5px; color: #6B7280; margin-top: 1px; }
.dang-tim, .tim-khong-thay { padding: 16px; text-align: center; color: #6B7280; }


/* Region 3 */
.result-region {
  flex: 1;
  min-height: 0; /* allows flex shrink */
  overflow: visible; /* let content show fully */
}

/* Vibrant Left Panel Content */
.student-card {
  text-align: center;
  padding: 14px 0 10px;
  margin-bottom: 10px;
  background: white;
  border-radius: 14px;
  border: 1px solid #E5E7EB;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.st-avatar-vibrant {
  width: 54px; height: 54px;
  background: #EFF6FF;
  color: #2563EB;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 6px;
  border: 3px solid white;
  box-shadow: 0 3px 8px rgba(37,99,235,0.12);
}
.st-name { font-weight: 800; font-size: 1rem; color: #111827; }
.st-sbd { font-size: 0.78rem; font-weight: 600; color: #6B7280; margin-top: 2px; }

/* Student Info Box */
.st-avatar-pixel {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EEF2FF 0%, #F0FDF4 100%);
  border: 3px solid #C7D2FE;
  box-shadow: 0 4px 14px rgba(99,102,241,0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
  font-size: 28px; /* fallback emoji size */
}
.st-avatar-pixel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.st-info-box {
  background: white;
  border-radius: 12px;
  padding: 4px 14px;
  margin-bottom: 10px;
  border: 1px solid #E5E7EB;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.st-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
}
.st-info-row:last-child {
  border-bottom: none;
}
.st-info-label {
  color: #6B7280;
  font-weight: 600;
}
.st-info-val {
  color: #111827;
  font-weight: 800;
}

/* Bảng Điểm Chi Tiết (Score Card Styled) */
.score-card-wrapper {
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  border: 1px solid #F3F4F6;
}
.score-title { font-weight: 800; font-size: 14px; margin: 0 0 10px 0; display: flex; align-items: center; gap: 6px; color: #111827; }

/* Mini Score Bar */
.score-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mini-score-item {
  margin-bottom: 0;
  background: #FAFAFA;
  border-radius: 8px;
  padding: 6px 10px;
  border: 1px solid #F1F5F9;
  transition: box-shadow 0.2s;
}
.mini-score-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-color: #E2E8F0;
}
.ms-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 5px;
  color: #374151;
}
.ms-subject {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ms-right {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ms-point {
  font-weight: 900;
  font-size: 13px;
  min-width: 26px;
  text-align: right;
}
.ms-pct {
  font-size: 10px;
  color: #9CA3AF;
  font-weight: 600;
  text-align: right;
  margin-top: 2px;
}

/* Badge nhỏ xếp loại môn */
.ms-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-sm-tot    { background: #ECFDF5; color: #059669; }
.badge-sm-kha    { background: #EEF2FF; color: #4F46E5; }
.badge-sm-trungbinh { background: #FFFBEB; color: #D97706; }
.badge-sm-yeu    { background: #FEF2F2; color: #DC2626; }

/* Badge xếp loại tổng hợp trên student card */
.st-xep-loai-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-tot    { background: linear-gradient(135deg,#34D399,#10B981); color:white; box-shadow: 0 2px 8px rgba(16,185,129,0.35); }
.badge-kha    { background: linear-gradient(135deg,#818CF8,#6366F1); color:white; box-shadow: 0 2px 8px rgba(99,102,241,0.35); }
.badge-trungbinh { background: linear-gradient(135deg,#FCD34D,#F59E0B); color:white; box-shadow: 0 2px 8px rgba(245,158,11,0.35); }
.badge-yeu    { background: linear-gradient(135deg,#FCA5A5,#EF4444); color:white; box-shadow: 0 2px 8px rgba(239,68,68,0.35); }

/* Colors */
.tot-text    { color: #10B981; }
.kha-text    { color: #6366F1; }
.trungbinh-text { color: #F59E0B; }
.yeu-text    { color: #EF4444; }

.ms-track {
  height: 8px;
  background: #F1F5F9;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 2px;
}
.ms-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}
.ms-fill.gradient-tot      { background: linear-gradient(90deg, #34D399, #10B981); }
.ms-fill.gradient-kha      { background: linear-gradient(90deg, #818CF8, #6366F1); }
.ms-fill.gradient-trungbinh { background: linear-gradient(90deg, #FCD34D, #F59E0B); }
.ms-fill.gradient-yeu      { background: linear-gradient(90deg, #FCA5A5, #EF4444); }

/* ══════════════════════════════════════
   NỘI DUNG PANEL 3 (RIGHT)
   ══════════════════════════════════════ */
.vibrant-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  padding: 24px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  background: white;
  border: 1px solid #F3F4F6;
  color: #111827;
}
.stat-blue { box-shadow: 0 4px 12px rgba(59, 130, 246, 0.05); border-left: 4px solid #3B82F6; }
.stat-green { box-shadow: 0 4px 12px rgba(16, 185, 129, 0.05); border-left: 4px solid #10B981; }
.stat-orange { box-shadow: 0 4px 12px rgba(245, 158, 11, 0.05); border-left: 4px solid #F59E0B; }

.sc-icon { font-size: 32px; margin-bottom: 16px; }
.sc-num { font-size: 2.2rem; font-weight: 900; line-height: 1; margin-bottom: 6px; color: #1F2937; }
.sc-lbl { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6B7280; }

/* Dashboard IMages */
.vibrant-image-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.image-box { border-radius: 12px; overflow: hidden; background: white; border: 1px solid #E2E8F0; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.img-header { padding: 14px 16px; font-weight: 800; text-align: center; font-size: 14px; text-transform: uppercase; border-bottom: 1px solid #E2E8F0; }
.bg-gradient-purple { color: #6D28D9; background: #F5F3FF; }
.bg-gradient-pink { color: #BE185D; background: #FDF2F8; }
.img-content { padding: 8px; }
.img-content img { width: 100%; height: 180px; object-fit: cover; border-radius: 6px; }

/* Dashboard Hero */
.dashboard-hero {
  padding: 24px;
  background: white;
  border-radius: 16px;
  border: 1px solid #F3F4F6;
  margin-bottom: 24px;
}
.dashboard-hero h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 8px 0;
}
.dashboard-hero p {
  color: #6B7280;
  margin: 0;
  font-size: 0.95rem;
}

/* Guide / Info boxes */
.default-guide-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.guide-title { font-weight: 800; color: #D97706; font-size: 15px; margin-bottom: 4px; }
.guide-desc { color: #B45309; font-size: 14px; line-height: 1.5; }

/* Headers cho panel AI tư vấn */
.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 50%, #FDE68A 100%);
  border-bottom: 2px solid #D97706;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-panel-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-panel-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-panel-title {
  color: #111827;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-student-ctx {
  font-size: 12px;
  color: #78350F;
  font-weight: 500;
  background: rgba(255,255,255,0.45);
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.btn-ai-refresh {
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  color: #78350F;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-ai-refresh:hover {
  background: rgba(255,255,255,0.85);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.badge-ai-powered {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(99,102,241,0.4);
  white-space: nowrap;
}

/* ══════════════════════════════════════
   AI LOADING STATE
   ══════════════════════════════════════ */
.vibrant-ai-container {
  padding: 16px;
}
.ai-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  gap: 16px;
}

/* SVG Spinner */
.ai-spinner-ring {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-spinner-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  animation: spinnerRotate 1.8s linear infinite;
}
.ai-spinner-track {
  stroke: #E5E7EB;
}
.ai-spinner-arc {
  stroke: url(#aiGrad);
  stroke: #6366F1;
  stroke-linecap: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 45;
  animation: spinnerDash 1.8s ease-in-out infinite;
}
@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}
@keyframes spinnerDash {
  0%   { stroke-dashoffset: 80; }
  50%  { stroke-dashoffset: 20; }
  100% { stroke-dashoffset: 80; }
}

/* Dots inside ring */
.ai-spinner-dot {
  position: absolute;
  width: 8px; height: 8px;
  background: #6366F1;
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.ai-spinner-dot:nth-child(1) { animation-delay: 0s; transform: translateY(-20px); }
.ai-spinner-dot:nth-child(2) { animation-delay: 0.2s; transform: translate(17px, 10px); }
.ai-spinner-dot:nth-child(3) { animation-delay: 0.4s; transform: translate(-17px, 10px); }
@keyframes dotPulse {
  0%, 100% { opacity: 0.3; transform-origin: center; scale: 0.8; }
  50%       { opacity: 1; scale: 1.2; }
}

.loading-title {
  font-size: 16px;
  font-weight: 800;
  color: #1F2937;
  letter-spacing: -0.01em;
}
.loading-desc {
  font-size: 13px;
  color: #6B7280;
  line-height: 1.6;
  max-width: 380px;
}

/* Loading steps */
.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  margin-top: 4px;
}
.lstep {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
  background: #F9FAFB;
  border: 1px solid #F3F4F6;
  transition: all 0.4s ease;
  opacity: 0.5;
}
.lstep.active {
  color: #4F46E5;
  background: #EEF2FF;
  border-color: #C7D2FE;
  opacity: 1;
  transform: translateX(4px);
}

/* ══════════════════════════════════════
   AI RESULT CONTENT - RICH STYLES
   ══════════════════════════════════════ */
.ai-result-content {
  line-height: 1.75;
  color: #374151;
  font-size: 14.5px;
  padding: 4px 0;
}
/* Chào đầu */
.ai-result-content > p:first-child {
  background: linear-gradient(135deg, #EEF2FF 0%, #F0FDF4 100%);
  border-left: 4px solid #6366F1;
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #1F2937;
  font-weight: 500;
}
.ai-result-content p {
  margin-bottom: 0.9em;
  color: #4B5563;
}
/* Section headings - card style */
.ai-result-content h1 {
  font-size: 1.1rem;
  font-weight: 900;
  color: #111827;
  margin: 24px 0 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #1e1b4b 0%, #3730a3 100%);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-result-content h2 {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
  margin: 20px 0 10px;
  padding: 9px 14px;
  background: linear-gradient(90deg, #EEF2FF, #F5F3FF);
  border-left: 4px solid #6366F1;
  border-radius: 0 10px 10px 0;
}
.ai-result-content h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #4F46E5;
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-result-content h3::before {
  content: '▸';
  font-size: 0.85em;
}
/* Lists */
.ai-result-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1em 0;
}
.ai-result-content li {
  position: relative;
  padding: 6px 8px 6px 22px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  transition: background 0.2s;
}
.ai-result-content li:hover {
  background: #F9FAFB;
}
.ai-result-content li::before {
  content: "▸";
  position: absolute;
  left: 6px;
  color: #6366F1;
  font-weight: 800;
  font-size: 0.9em;
  top: 7px;
}
/* Bold */
.ai-result-content strong {
  color: #111827;
  font-weight: 700;
  background: rgba(99,102,241,0.06);
  padding: 0 3px;
  border-radius: 3px;
}
/* Blockquote */
.ai-result-content blockquote {
  background: #FFFBEB;
  border-left: 4px solid #F59E0B;
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin: 12px 0;
  color: #92400E;
  font-style: italic;
  font-size: 14px;
}
/* Code */
.ai-result-content code {
  background: #EEF2FF;
  color: #4F46E5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: monospace;
}
/* HR */
.ai-result-content hr {
  border: none;
  border-top: 2px solid #F3F4F6;
  margin: 20px 0;
}



/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 900px) {
  /* Convert grid → flex so we can use display:contents + order for section reordering */
  .app-workspace {
    display: flex;
    flex-direction: column;
  }

  /* Flatten right-column into workspace so its children can be reordered */
  .app-right-column { display: contents; }

  /* Mobile reading order: 1️⃣ Search → 2️⃣ Student info → 3️⃣ AI advice */
  .search-region   { order: 1; }
  .app-left-column { order: 2; }
  .result-region   { order: 3; }

  /* Remove artificial min-height — was causing 400px empty blank spaces on mobile */
  .app-panel { min-height: auto !important; height: auto; overflow: visible; }

  /* Hide AI context in header (too long on mobile) */
  .ai-student-ctx { display: none; }
}

/* ══════════════════════════════════════
   ANIMATIONS & MICRO-INTERACTIONS
   ══════════════════════════════════════ */

/* Fade + slide up */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fadeInUp 0.45s ease forwards;
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* Zoom in */
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.zoom-in {
  animation: zoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Stagger score items */
.mini-score-item:nth-child(1) { animation: fadeInUp 0.4s 0.05s both; }
.mini-score-item:nth-child(2) { animation: fadeInUp 0.4s 0.12s both; }
.mini-score-item:nth-child(3) { animation: fadeInUp 0.4s 0.19s both; }
.mini-score-item:nth-child(4) { animation: fadeInUp 0.4s 0.26s both; }
.mini-score-item:nth-child(5) { animation: fadeInUp 0.4s 0.33s both; }
.mini-score-item:nth-child(6) { animation: fadeInUp 0.4s 0.40s both; }
.mini-score-item:nth-child(7) { animation: fadeInUp 0.4s 0.47s both; }
.mini-score-item:nth-child(8) { animation: fadeInUp 0.4s 0.54s both; }

/* Error alert in left panel */
.vibrant-alert-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid #EF4444;
  border-radius: 10px;
  padding: 14px 16px;
  color: #991B1B;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 12px;
}

/* Pipeline wrap (default left panel state) */
.pipeline-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}
.pipeline-wrap img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* mt-2 utility */
.mt-2 { margin-top: 8px; }


/* ══════════════════════════════════════
   📱 MOBILE RESPONSIVE — app-layout.css
   Breakpoints: 768px (tablet), 480px (phone)
   ══════════════════════════════════════ */

/* Tablet (768px) */
@media (max-width: 768px) {
  /* Un-fix height so page scrolls naturally on mobile */
  .app-container {
    height: auto;
    overflow: visible;
    margin-top: 78px;
  }

  /* Workspace padding & gap */
  .app-workspace { padding: 10px; gap: 10px; }

  /* Panels: allow natural height + scrollable body */
  .app-left-column .panel-body,
  .result-region .panel-body { overflow: visible; }
  .result-region { overflow: visible; }

  /* Stats grid: 3-col compact row on mobile (all 3 fit in one line) */
  .vibrant-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  /* Stat card: much smaller */
  .stat-card { padding: 10px 8px; border-radius: 12px; }
  .sc-icon { font-size: 16px; margin-bottom: 4px; }
  .sc-num { font-size: 1.2rem; margin-bottom: 2px; }
  .sc-lbl { font-size: 0.58rem; letter-spacing: 0; }

  /* Dashboard hero: compact title */
  .dashboard-hero { padding: 10px 12px; margin-bottom: 8px; }
  .dashboard-hero h2 { font-size: 0.95rem; margin-bottom: 4px; }
  .dashboard-hero p { font-size: 0.78rem; }

  /* Image grid stays 2-col */
  .vibrant-image-grid { grid-template-columns: 1fr 1fr; }

  /* Search form: stacked (input above button) */
  .search-input-group { flex-wrap: wrap; border-radius: 12px; overflow: hidden; }
  .vibrant-input { border-radius: 12px 12px 0 0; border-right: 1px solid #D1D5DB; border-bottom: none; font-size: 14px; }
  .btn-submit-search { width: 100%; border-radius: 0 0 12px 12px; padding: 12px; font-size: 15px; }
  .btn-clear-search { right: 12px; top: 14px; transform: none; }

  /* Fix avatar icon floating on mobile */
  .search-input-group .input-icon { top: 14px; transform: none; }

  /* AI panel header: stack */
  .ai-panel-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .ai-student-ctx { max-width: 100%; display: block; }

  /* Score mini-items: 2-col grid */
  .score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Panel headers smaller */
  .panel-header { padding: 12px 16px; font-size: 13px; }

  /* Make pipeline infographic fit nicely */
  .pipeline-wrap img { border-radius: 8px; }
}

/* Phone (480px) */
@media (max-width: 480px) {
  .app-container { margin-top: 74px; }
  .app-workspace { padding: 8px; gap: 8px; }

  /* Stats: 2-col small → 1-col */
  .vibrant-stats-grid { grid-template-columns: 1fr; }
  .vibrant-image-grid { grid-template-columns: 1fr; }

  /* Score grid: 1-col on small phones */
  .score-grid { grid-template-columns: 1fr; }

  /* Dashboard hero compact */
  .dashboard-hero { padding: 14px; }
  .dashboard-hero h2 { font-size: 1rem; }
  .dashboard-hero p { font-size: 0.85rem; }

  /* Panel headers compact */
  .panel-header { padding: 10px 12px; font-size: 12px; }

  /* Student card compact */
  .st-avatar-pixel { width: 56px; height: 56px; }
  .st-name { font-size: 0.88rem; }
  .st-sbd { font-size: 0.72rem; }

  /* Info rows smaller text */
  .st-info-row { font-size: 12px; padding: 6px 0; }

  /* Search region: hide label on phone */
  .search-region .panel-header span:not(.header-icon) { display: none; }
}
