/* ==========================================================================
   AUTOGRADING — UNIFIED LEARNER & PARENT JOURNEY HUB + SHARING GOVERNANCE
   Responsive Mobile-First: 320px -> 390px -> 768px Foldable -> 1024px -> 1440px+
   ========================================================================== */

#view-parent-portal .parent-portal-container.lj-wide-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1rem 5.5rem 1rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

.lj-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lj-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.lj-quota-pill,
.lj-user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.lj-user-chip {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

/* Segmented 4-Tab Bar (Sticky Bottom on Mobile, Top Pill Bar on Tablet/Desktop) */
.lj-hub-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.lj-tab-btn {
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  transition: background 0.16s ease, color 0.16s ease;
}

.lj-tab-btn.active {
  background: linear-gradient(135deg, #4f46e5, #0891b2);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.24);
}

/* Cards, Controls & Touch Targets (>= 44px) */
.lj-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.lj-chart-card {
  background: #f8fafc;
}

.lj-section-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.35rem 0;
}

.lj-section-desc {
  font-size: 0.84rem;
  color: #64748b;
  margin: 0 0 0.9rem 0;
  line-height: 1.5;
}

.lj-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.lj-input,
.lj-select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
}

.lj-btn {
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.lj-btn-sm {
  min-height: 44px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.lj-btn-primary {
  background: #4f46e5;
  color: #ffffff;
}

.lj-btn-outline {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

.lj-btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* KPI Grid & Dual-Line SVG Chart */
.lj-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lj-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lj-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
}

.lj-kpi-value {
  font-size: 1.55rem;
  font-weight: 850;
  color: #0f172a;
}

.lj-kpi-meta {
  font-size: 0.78rem;
  color: #64748b;
}

.lj-text-indigo { color: #4f46e5; }
.lj-text-cyan { color: #0891b2; }
.lj-text-emerald { color: #059669; }

.lj-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
}

.lj-dot-official,
.lj-dot-practice {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.35rem;
}

.lj-dot-official { background: #4f46e5; }
.lj-dot-practice { background: #0891b2; }

.lj-svg-scroll {
  width: 100%;
  overflow-x: auto;
}

.lj-trajectory-svg {
  width: 100%;
  min-width: 300px;
  height: auto;
  display: block;
}

/* Competency Rows & Timeline Cards */
.lj-two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1rem;
}

.lj-competency-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.lj-competency-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.lj-competency-sub {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
}

.lj-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.lj-progress-fill {
  height: 100%;
  border-radius: 999px;
}

.lj-progress-fill.lj-pill-mastered { background: #10b981; }
.lj-progress-fill.lj-pill-practicing { background: #0ea5e9; }
.lj-progress-fill.lj-pill-review { background: #f59e0b; }

.lj-status-pill,
.lj-source-badge,
.lj-scope-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.lj-pill-mastered { background: #dcfce7; color: #166534; }
.lj-pill-practicing { background: #e0f2fe; color: #075985; }
.lj-pill-review { background: #fef3c7; color: #92400e; }
.lj-badge-official { background: #e0e7ff; color: #3730a3; }
.lj-badge-practice { background: #cffafe; color: #155e75; }
.lj-badge-guide { background: #f3e8ff; color: #6b21a8; }
.lj-badge-remediation { background: #ffedd5; color: #9a3412; }

.lj-timeline-item,
.lj-link-card,
.lj-consent-row,
.lj-candidate-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 0.65rem;
  background: #f8fafc;
  flex-wrap: wrap;
}

.lj-timeline-title {
  margin: 0.35rem 0 0.2rem 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.lj-timeline-meta,
.lj-link-meta {
  display: block;
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}

.lj-event-score {
  font-size: 1.25rem;
  font-weight: 850;
  color: #4f46e5;
}

/* Socratic Hints & Mastery Toolbar in Shared Quick Workspace */
.lj-pedagogical-guide-ext {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed #cbd5e1;
}

.lj-mastery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.lj-mastery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.lj-mastery-btn,
.lj-bookmark-btn,
.lj-hint-trigger {
  min-height: 44px;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.lj-mastery-btn.active,
.lj-bookmark-btn.active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.18);
}

.lj-hint-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.lj-hint-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lj-hint-body {
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border-left: 3px solid #0891b2;
  border-radius: 8px;
  margin-bottom: 0.55rem;
  font-size: 0.88rem;
}

.lj-inline-alert {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.lj-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.lj-alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.lj-empty-state { padding: 1.1rem; text-align: center; color: #64748b; font-size: 0.86rem; background: #f8fafc; border-radius: 12px; border: 1px dashed #cbd5e1; }

/* Dark Mode Surfaces */
[data-theme="dark"] .lj-card,
[data-theme="dark"] .lj-hub-tabs {
  background: #0f172a;
  border-color: #1e293b;
}

[data-theme="dark"] .lj-chart-card {
  background: #0f172a !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .lj-tab-btn:not(.active) {
  color: #cbd5e1;
}

[data-theme="dark"] .lj-kpi-card,
[data-theme="dark"] .lj-timeline-item,
[data-theme="dark"] .lj-link-card,
[data-theme="dark"] .lj-consent-row,
[data-theme="dark"] .lj-empty-state {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .lj-section-heading,
[data-theme="dark"] .lj-kpi-value,
[data-theme="dark"] .lj-timeline-title {
  color: #f8fafc;
}

[data-theme="dark"] .lj-section-desc,
[data-theme="dark"] .lj-kpi-label,
[data-theme="dark"] .lj-kpi-meta,
[data-theme="dark"] .lj-chart-legend,
[data-theme="dark"] .lj-competency-sub,
[data-theme="dark"] .lj-timeline-meta,
[data-theme="dark"] .lj-link-meta {
  color: #cbd5e1;
}

[data-theme="dark"] .lj-input,
[data-theme="dark"] .lj-select,
[data-theme="dark"] .lj-btn-outline {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

/* Responsive Breakpoints (320px / 640px Mobile -> 768px Foldable -> 1024px+ Desktop) */
#learner-quota-badge,
#view-parent-portal .parent-badge-role,
#learner-hub-lookup-desc,
#view-parent-portal .lj-section-desc,
#view-parent-portal .learner-task-pill-desc,
#modal-teacher-subscription .sub-modal-subtitle {
  display: none !important;
}

@media (max-width: 900px) {
  .lj-two-col-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .lj-topbar {
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .lj-topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
  #select-learner-active-profile {
    max-width: 100%;
    flex: 1 1 100%;
    text-overflow: ellipsis;
  }
  .lj-hub-tabs {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    margin-bottom: 0;
    z-index: 950;
  }
  .lj-tab-btn {
    font-size: 0.76rem;
    padding: 0.35rem 0.25rem;
  }
}
