/**
 * Workspace UX — clear hierarchy, professional density, closed-loop copy.
 * Loaded after playful-bootstrap.css; complements existing tokens.
 */

:root {
  /* Align with playful-bootstrap prod tokens — reads as one surface */
  --ux-border: var(--prod-border, #e8edf2);
  --ux-surface: var(--prod-white, #fffefe);
  --ux-surface-subtle: var(--prod-section, #f0f4f9);
  --ux-text: var(--prod-text, #2f281e);
  --ux-text-muted: var(--prod-text-muted, #544837);
  --ux-accent: #1d4ed8;
  --ux-radius: 0.5rem;
  /* Soft inset feel inside playful-main-wrap (merged, not “floating”) */
  --ux-merge-shadow: 0 1px 0 rgba(47, 40, 30, 0.04);
  --ux-merge-shadow-hover: 0 3px 14px rgba(47, 40, 30, 0.06);
  /* Vertical rhythm between blocks inside the main panel */
  --ux-stack-gap: 1.5rem;
  --ux-stack-gap-sm: 1rem;
  --ux-inset-pad-x: 1.5rem;
  --ux-inset-pad-y: 1.35rem;
}

/*
 * Inner content lives inside .playful-main-wrap (warm white panel).
 * Cards use the same palette + hairline borders so they merge with the panel.
 */
.playful-main-wrap .card.ux-card {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border) !important;
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.playful-main-wrap .card.ux-card:hover {
  box-shadow: var(--ux-merge-shadow-hover);
}

.playful-main-wrap .card.ux-card:has(.table-responsive):hover,
.playful-main-wrap .card.ux-card:has(table):hover {
  box-shadow: var(--ux-merge-shadow);
}

.playful-main-wrap .card.ux-card.shadow-sm {
  box-shadow: var(--ux-merge-shadow);
}

.card.ux-card--accent {
  border-left: 4px solid var(--prod-purple, #747def) !important;
}

.ux-card-block {
  margin-bottom: var(--ux-stack-gap);
}

.playful-main-wrap .ux-card-block {
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
}

.ux-card-block__body {
  padding: var(--ux-inset-pad-y) var(--ux-inset-pad-x);
}

.ux-card-block__body--lg {
  padding: 1.5rem 1.65rem;
}

.playful-main-wrap .ux-table-card {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
  overflow: hidden;
}

.ux-table-card .table {
  margin-bottom: 0;
}

.ux-table-card .table-responsive {
  border-radius: inherit;
}

.playful-main-wrap .ux-page-title-card {
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
  padding: 1.25rem var(--ux-inset-pad-x);
  margin-bottom: var(--ux-stack-gap);
}

.ux-page-title-card h1,
.ux-page-title-card .page-title {
  margin-bottom: 0.25rem;
}

.playful-main-wrap .empty-state-card,
.playful-main-wrap .student-focus-panel {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
  margin-bottom: var(--ux-stack-gap);
}

.playful-main-wrap .student-focus-progress {
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
  padding: 1.15rem var(--ux-inset-pad-x);
  margin-bottom: var(--ux-stack-gap);
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* Focus page: hero, progress, and task cards span full .playful-main-wrap width (same as other inner pages) */
.playful-main-wrap .student-focus-page {
  display: block;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  box-sizing: border-box;
}

.playful-main-wrap .student-focus-page > .ux-card-block,
.playful-main-wrap .student-focus-page > .student-focus-progress,
.playful-main-wrap .student-focus-page > .student-focus-panel,
.playful-main-wrap .student-focus-page > .student-focus-deck {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.playful-main-wrap .stat-card {
  box-shadow: var(--ux-merge-shadow);
  border-color: var(--ux-border);
  background: var(--ux-surface);
}

/* ——— Stack spacing inside main panel (avoid touching blocks) ——— */
.playful-main-wrap .card.ux-card {
  margin-bottom: var(--ux-stack-gap);
}

.playful-main-wrap .ux-table-card {
  margin-bottom: var(--ux-stack-gap);
}

.playful-main-wrap .accordion.ux-accordion {
  margin-bottom: var(--ux-stack-gap);
}

.playful-main-wrap details.dash-daily-spotlight.card.ux-card,
.playful-main-wrap .dash-daily-spotlight.card.ux-card {
  margin-bottom: var(--ux-stack-gap);
}

.playful-main-wrap .app-nav-back.d-inline-flex {
  margin-bottom: var(--ux-stack-gap-sm);
}

.playful-main-wrap > .alert {
  margin-bottom: var(--ux-stack-gap);
}

.ux-card-block--center {
  text-align: center;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

/* ——— Dashboard name strip (student / teacher / admin) ——— */
.dash-student-head,
.dash-teacher-head,
.dash-admin-head {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--ux-border);
}

.dash-student-head.ux-card-block,
.dash-teacher-head.ux-card-block,
.dash-admin-head.ux-card-block {
  padding-bottom: 0;
  border-bottom: none;
}

.playful-main-wrap .qa-feed--page > .qa-feed-page-head {
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: 0.75rem;
  box-shadow: var(--ux-merge-shadow);
  padding: 1.15rem var(--ux-inset-pad-x);
  margin-bottom: var(--ux-stack-gap);
}

/* Student home: primary “Today” panel + progressive daily spotlight */
.ux-panel--student-primary {
  border: 1px solid rgba(98, 55, 255, 0.14);
  box-shadow: var(--ux-merge-shadow);
}

.dash-daily-spotlight summary,
.dash-daily-spotlight__summary {
  list-style: none;
  cursor: pointer;
}

.dash-daily-spotlight summary::-webkit-details-marker {
  display: none;
}

.dash-daily-spotlight__chev {
  transition: transform 0.2s ease;
}

.dash-daily-spotlight[open] .dash-daily-spotlight__chev {
  transform: rotate(180deg);
}

.dash-onboarding-hint {
  border-color: var(--ux-border) !important;
}

/* Today’s inspiration: ~80% of original vertical footprint (tighter padding / rhythm) */
.playful-main-wrap .dash-today-inspiration .ux-card-block__body {
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

.playful-main-wrap .dash-today-inspiration .daily-quote-card__inner {
  padding: 1rem 1.08rem;
  gap: 0.8rem;
}

.playful-main-wrap .dash-today-inspiration .daily-quote-card__icon {
  width: 2rem;
  height: 2rem;
  font-size: 0.92rem;
}

.playful-main-wrap .dash-today-inspiration .daily-quote-card__label {
  margin-bottom: 0.4rem !important;
}

.playful-main-wrap .dash-today-inspiration .daily-quote-card__text {
  line-height: 1.24;
  font-size: 0.95rem;
  margin-bottom: 0.4rem !important;
}

.dash-daily-spotlight.card.ux-card > div:not(summary) {
  padding: 1.35rem var(--ux-inset-pad-x) 1.5rem;
}

@media (min-width: 768px) {
  .dash-daily-spotlight.card.ux-card > div:not(summary) {
    padding-top: 1.5rem;
    padding-bottom: 1.75rem;
  }
}

.letter-spacing-tight {
  letter-spacing: 0.04em;
}

/* ——— Sticky workspace strip (below main nav) ——— */
.ux-workspace-bar {
  background: var(--ux-surface-subtle);
  border-color: var(--ux-border) !important;
}

.ux-workspace-bar .ux-workspace-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  min-height: 2.5rem;
}

.ux-workspace-nav__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ux-text-muted);
  margin-right: 0.25rem;
}

.ux-workspace-nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
}

.ux-workspace-nav__link:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ux-text);
}

.ux-workspace-nav__link--primary {
  color: var(--ux-accent);
  font-weight: 600;
}

/* ——— Page hero (dashboards, focus) ——— */
.ux-page-hero {
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: calc(var(--ux-radius) + 0.15rem);
  box-shadow: var(--ux-merge-shadow);
  padding: var(--ux-inset-pad-y) var(--ux-inset-pad-x);
  margin-bottom: var(--ux-stack-gap);
}

@media (min-width: 768px) {
  .ux-page-hero {
    padding: 1.5rem 1.75rem;
  }
}

.ux-page-hero__eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ux-text-muted);
  margin-bottom: 0.35rem;
}

.ux-page-hero__title {
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ux-text);
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

.ux-page-hero__lead {
  font-size: 0.95rem;
  color: var(--ux-text-muted);
  max-width: 42rem;
  margin: 0 0 1rem;
  line-height: 1.5;
}

/* Numbered “how it works” — always completes the loop */
.ux-flow-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: uxstep;
}

.ux-flow-steps li {
  counter-increment: uxstep;
  position: relative;
  padding: 0.55rem 0 0.55rem 2.35rem;
  border-top: 1px solid var(--ux-border);
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.45;
}

.ux-flow-steps li:first-child {
  border-top: none;
  padding-top: 0.25rem;
}

.ux-flow-steps li::before {
  content: counter(uxstep);
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 1.65rem;
  height: 1.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.65rem;
  text-align: center;
  border-radius: 50%;
  background: #e0e7ff;
  color: #3730a3;
}

.ux-flow-steps li:first-child::before {
  top: 0.2rem;
}

.ux-flow-steps strong {
  color: var(--ux-text);
  font-weight: 600;
}

/* ——— Primary content panel ——— */
.ux-panel {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: calc(var(--ux-radius) + 0.15rem);
  box-shadow: var(--ux-merge-shadow);
  margin-bottom: var(--ux-stack-gap);
  overflow: hidden;
}

.ux-panel__head {
  padding: 1.15rem var(--ux-inset-pad-x);
  border-bottom: 1px solid var(--ux-border);
  background: var(--ux-surface-subtle);
}

.ux-panel__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ux-text);
  margin: 0;
  letter-spacing: -0.015em;
}

.ux-panel__meta {
  font-size: 0.8125rem;
  color: var(--ux-text-muted);
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

.ux-panel__body {
  padding: 0;
}

.ux-panel__body--padded {
  padding: var(--ux-inset-pad-y) var(--ux-inset-pad-x);
}

/* Today’s board inside panel */
.ux-panel .today-work-board {
  margin-bottom: 0;
}

.ux-panel .today-work-board__header {
  padding: 1rem var(--ux-inset-pad-x) 0;
  border-bottom: none;
}

.ux-panel .today-work-class {
  margin: 0 var(--ux-inset-pad-x) 1.25rem;
}

.ux-panel .today-work-class:last-child {
  margin-bottom: 1.5rem;
}

.ux-panel .today-work-board__empty {
  padding: 1.5rem var(--ux-inset-pad-x) 1.75rem;
}

/* ——— Accordion for secondary dashboard sections ——— */
.ux-accordion .accordion-item {
  border: 1px solid var(--ux-border);
  border-radius: var(--ux-radius) !important;
  margin-bottom: 0.65rem;
  overflow: hidden;
}

.ux-accordion .accordion-item:last-child {
  margin-bottom: 0;
}

.ux-accordion .accordion-button {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ux-text);
  background: var(--ux-surface-subtle);
  box-shadow: none !important;
}

.ux-accordion .accordion-button:not(.collapsed) {
  background: var(--ux-surface);
  color: var(--ux-accent);
}

.ux-accordion .accordion-body {
  background: var(--ux-surface);
  padding: var(--ux-inset-pad-y) var(--ux-inset-pad-x);
}

/* ——— Task page: linear student flow ——— */
.ux-task-flow {
  border: 1px solid var(--ux-border);
  border-radius: calc(var(--ux-radius) + 0.15rem);
  background: var(--ux-surface);
  box-shadow: var(--ux-merge-shadow);
  margin-bottom: var(--ux-stack-gap);
}

.ux-task-flow__intro {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ux-border);
  background: var(--ux-surface-subtle);
}

.ux-task-flow__intro h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--ux-text);
}

.ux-task-flow__intro p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ux-text-muted);
  line-height: 1.45;
}

.ux-task-flow__step {
  padding: 1.2rem var(--ux-inset-pad-x);
  border-bottom: 1px solid var(--ux-border);
}

.ux-task-flow__step:last-child {
  border-bottom: none;
}

.ux-task-flow__step-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ux-text-muted);
  margin-bottom: 0.5rem;
}

.ux-task-flow__step--active {
  background: linear-gradient(90deg, rgba(29, 78, 216, 0.06), transparent);
  border-left: 3px solid var(--ux-accent);
  padding-left: calc(var(--ux-inset-pad-x) - 3px);
}

/* ——— Session / timer page banner ——— */
.ux-session-status {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem var(--ux-inset-pad-x);
  background: var(--ux-surface-subtle);
  border: 1px solid var(--ux-border);
  border-radius: var(--ux-radius);
  box-shadow: var(--ux-merge-shadow);
  margin-bottom: var(--ux-stack-gap);
}

.ux-session-status__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--ux-text);
}

.ux-session-status__next {
  font-size: 0.875rem;
  color: var(--ux-text-muted);
  margin: 0;
  max-width: 36rem;
}

/* ——— Compact stat chips ——— */
.ux-stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--ux-stack-gap-sm);
}

.ux-stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 2rem;
  font-size: 0.8125rem;
  box-shadow: var(--ux-merge-shadow);
}

.ux-stat-chip.flex-column {
  align-items: flex-start;
  border-radius: var(--ux-radius);
}

.ux-stat-chip strong {
  font-weight: 700;
  color: var(--ux-text);
}

/* ——— Teacher class quick actions ——— */
.ux-teacher-class-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ux-teacher-class-actions .btn {
  font-size: 0.8125rem;
}

/* ——— All tasks page (student) ——— */
.playful-main-wrap .my-tasks-page .my-tasks-table-card {
  margin-bottom: var(--ux-stack-gap);
}

.my-tasks-table thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ux-text-muted);
  background: var(--ux-surface-subtle);
  border-bottom: 1px solid var(--ux-border);
  padding: 0.85rem 1rem;
  white-space: nowrap;
}

.my-tasks-table tbody td {
  padding: 1rem 1rem;
  vertical-align: middle;
  border-color: var(--ux-border);
}

.my-tasks-table tbody tr:last-child td {
  border-bottom: 0;
}

.my-tasks-row--overdue {
  box-shadow: inset 3px 0 0 0 rgba(220, 53, 69, 0.55);
}

.my-tasks-col-task {
  min-width: 12rem;
}

.my-tasks-task-title {
  display: inline-block;
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--ux-text);
  text-decoration: none;
}

.my-tasks-task-title:hover {
  color: var(--ux-accent);
  text-decoration: underline;
}

.my-tasks-task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.my-tasks-table .pill {
  font-size: 0.625rem;
  padding: 0.3rem 0.55rem;
  letter-spacing: 0.06em;
}

@media (max-width: 767.98px) {
  .my-tasks-table tbody td {
    padding: 0.85rem 0.75rem;
  }
}

/* ——— In-app YouTube shell (task + session pages) ——— */
.app-youtube-shell__toolbar {
  flex-shrink: 0;
}

.app-youtube-shell:fullscreen,
.app-youtube-shell:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #000;
}

.app-youtube-shell:fullscreen .app-youtube-shell__stage,
.app-youtube-shell:-webkit-full-screen .app-youtube-shell__stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  aspect-ratio: auto;
  --bs-aspect-ratio: auto;
}

.app-youtube-shell:fullscreen .ratio::before,
.app-youtube-shell:-webkit-full-screen .ratio::before {
  display: none;
}

.app-youtube-shell:fullscreen .app-youtube-shell__stage iframe,
.app-youtube-shell:fullscreen .app-youtube-shell__stage #yt-player,
.app-youtube-shell:fullscreen .app-youtube-shell__stage #yt-player iframe,
.app-youtube-shell:-webkit-full-screen .app-youtube-shell__stage iframe,
.app-youtube-shell:-webkit-full-screen .app-youtube-shell__stage #yt-player,
.app-youtube-shell:-webkit-full-screen .app-youtube-shell__stage #yt-player iframe {
  width: 100%;
  height: 100%;
}

/* Student home: completed tasks subsection */
.today-task-list--completed {
  border-radius: 0.5rem;
  border: 1px solid rgba(25, 135, 84, 0.2);
  background: rgba(25, 135, 84, 0.04);
  padding: 0.35rem 0;
}

.today-task-list--completed .today-task-row {
  border-color: transparent;
}

/* All tasks: completed table */
.playful-main-wrap .my-tasks-table-card--done {
  border-color: rgba(25, 135, 84, 0.22);
}

.my-tasks-row--done td {
  background: rgba(25, 135, 84, 0.03);
}
