/* Full-page student workspace. This intentionally replaces the old nested modal experience. */

body.modal-open {
  overflow: auto !important;
}

#students.student-workspace-open > .card:first-child {
  display: none;
}

#students.student-workspace-open {
  display: block;
}

.student-form-wrapper.student-workspace {
  margin: 0;
}

.student-form-wrapper.student-workspace.student-modal-overlay {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  overflow: visible;
  overscroll-behavior: auto;
}

.student-form-wrapper.student-workspace.hidden {
  display: none !important;
}

.student-workspace .student-modal-card {
  position: static;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible !important;
  clip-path: none !important;
  isolation: auto !important;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.student-workspace .student-modal-card > .card-heading.student-editor-header {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem 1rem;
  align-items: center;
  padding: 1.35rem 1.5rem 0;
  background: var(--surface) !important;
  border-bottom: 0;
  backdrop-filter: none;
}

.student-workspace-heading {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.student-workspace-back {
  flex: 0 0 auto;
  min-height: 38px;
}

.student-workspace .student-editor-header > div:first-child {
  min-width: 0;
}

.student-workspace .student-editor-header h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
}

.student-workspace-subtitle {
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.student-workspace .student-edit-tabs {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  gap: 0.2rem;
  width: 100%;
  margin: 0;
  padding: 0.25rem 0 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.student-workspace .student-edit-tabs::-webkit-scrollbar {
  display: none;
}

.student-workspace .student-edit-tab {
  padding: 0.8rem 0.9rem 0.9rem;
  border-bottom-width: 3px;
}

.student-workspace .student-edit-panel {
  padding: 1.35rem 1.5rem 2rem;
}

.student-workspace .student-edit-panel[data-student-edit-panel="pieces"] {
  padding-top: 1.2rem;
}

.student-workspace .student-edit-panel[data-student-edit-panel="new-piece"],
.student-workspace .student-edit-panel[data-student-edit-panel="details"],
.student-workspace .student-edit-panel[data-student-edit-panel="portal"] {
  max-width: 900px;
}

.student-workspace .student-edit-panel[data-student-edit-panel="portal"] {
  padding-bottom: 2.25rem;
}

.student-workspace .student-new-piece-panel .piece-form {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.student-workspace .student-new-piece-panel::before,
.student-workspace .student-new-piece-panel::after,
.student-workspace .student-new-piece-panel .piece-form::before {
  content: none !important;
  display: none !important;
}

.student-workspace .embedded-pieces-editor {
  display: grid;
  gap: 1rem;
}

.student-workspace .pieces-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.student-workspace .pieces-heading > div:first-child p {
  max-width: 640px;
}

.student-workspace .student-pieces-list {
  display: grid;
  gap: 0.9rem;
}

.student-workspace .student-pieces-list::before {
  content: none !important;
  display: none !important;
}

.student-workspace .piece-admin-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.25rem;
  padding: 1.1rem 1.15rem;
}

.student-workspace .piece-admin-actions {
  align-self: start;
}

.student-workspace .piece-progress-editor {
  grid-column: 1 / -1;
  grid-template-columns: minmax(120px, 1fr) auto minmax(100px, 140px) auto;
  column-gap: 0.65rem;
  align-items: end;
}

.student-workspace .piece-progress-actions {
  grid-column: 4;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 0.4rem;
  width: auto;
  min-width: 0;
}

.student-workspace .piece-progress-actions .button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding-inline: 0.7rem;
  white-space: nowrap;
}

.student-workspace .piece-progress-editor .piece-save-status:empty {
  display: none;
}

.student-workspace .piece-progress-editor .piece-save-status:not(:empty) {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
}

.student-workspace .completed-pieces-disclosure {
  margin-top: 0.35rem;
}

.student-workspace > .student-modal-card > .form-actions {
  position: static;
  margin-top: 1.35rem;
  padding: 1rem 1.5rem 1.75rem;
  background: var(--surface);
  backdrop-filter: none;
}

.student-workspace-overview {
  display: grid;
  gap: 1rem;
  padding-bottom: 2.25rem !important;
}

.student-workspace-overview-intro h3 {
  margin-bottom: 0.25rem;
  font-size: 1.18rem;
}

.student-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.student-overview-stat {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.student-overview-stat span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.student-overview-stat strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
}

.student-overview-section {
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.student-overview-section-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.student-overview-section-actions .button {
  width: auto;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.student-record-section {
  margin-bottom: 0.5rem;
  padding-bottom: 1.4rem;
}

.practice-week-admin {
  margin-bottom: 0.25rem;
  padding-bottom: 1.4rem;
}

.practice-week-admin #resetPracticeWeek {
  margin-bottom: 0.15rem;
}

.student-overview-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.student-overview-section-head h3 {
  display: flex;
  align-items: center;
  min-height: 38px;
  margin: 0;
  font-size: 1rem;
}

.student-workspace .student-edit-panel[data-student-edit-panel="details"] .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-workspace .student-edit-panel[data-student-edit-panel="details"] .form-row > label {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.student-workspace #usualTime {
  display: block;
  box-sizing: border-box;
  inline-size: -webkit-fill-available !important;
  width: -webkit-fill-available !important;
  min-inline-size: 0 !important;
  min-width: 0 !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  justify-self: stretch;
  text-align: center;
}

@supports not (width: -webkit-fill-available) {
  .student-workspace #usualTime {
    inline-size: 100% !important;
    width: 100% !important;
  }
}

.student-workspace #usualTime::-webkit-datetime-edit {
  width: auto;
  min-width: 0;
  text-align: center;
}

.student-drive-folder-field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  margin-bottom: 0.85rem;
}

.student-drive-folder-label {
  color: var(--text);
  font-weight: 650;
}

.student-drive-folder-connected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 46px;
  padding: 0.55rem 0.6rem 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.student-drive-folder-status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.student-drive-folder-logo {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
}

.student-drive-folder-copy {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.student-drive-folder-copy strong {
  color: var(--text);
  font-size: 0.9rem;
}

.student-drive-folder-copy > span {
  color: var(--muted);
  font-size: 0.76rem;
}

.student-drive-folder-connected .button {
  flex: 0 0 auto;
  width: auto;
  min-width: 64px;
}

.student-drive-folder-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  min-width: 0;
}

.student-drive-folder-editor input {
  min-width: 0;
}

.student-drive-folder-editor .button {
  width: auto;
  min-width: 74px;
}

.student-overview-drive-link {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0.45rem;
  border-radius: 10px;
  background: transparent;
  transition: background 0.16s ease, transform 0.16s ease;
}

.student-overview-drive-link:hover,
.student-overview-drive-link:focus-visible {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.student-overview-drive-link svg {
  display: block;
  width: 22px;
  height: 22px;
}

.student-workspace #studentPieceStartedOn {
  display: block;
  box-sizing: border-box;
  inline-size: auto;
  width: auto;
  min-inline-size: 0;
  min-width: 0;
  max-width: 100%;
  justify-self: stretch;
  align-self: stretch;
}

.student-workspace .portal-account-status {
  display: block;
  min-height: 1.25rem;
  margin: 0.45rem 0 1rem;
}

.student-workspace .portal-account-actions {
  margin-top: 0;
}

.student-overview-piece-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.student-overview-piece-chip {
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
}

.student-overview-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .student-workspace .student-modal-card > .card-heading.student-editor-header {
    grid-template-columns: 1fr;
  }

  .student-workspace .student-edit-tabs {
    grid-column: 1;
  }

  .student-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-workspace .piece-admin-card {
    grid-template-columns: 1fr;
  }

  .student-workspace .piece-progress-editor {
    grid-column: 1;
    grid-template-columns: minmax(120px, 1fr) auto minmax(100px, 140px) auto;
  }

  .student-workspace .piece-progress-editor label:has([data-piece-xp]) {
    grid-column: auto;
  }

  .student-workspace .piece-progress-actions {
    grid-column: 4;
    justify-content: flex-end;
  }
}

@media (max-width: 700px) {
  .student-workspace .piece-progress-editor {
    grid-template-columns: minmax(0, 1fr) auto minmax(100px, 130px);
  }

  .student-workspace .piece-progress-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
  }

  .student-workspace .piece-progress-editor .piece-save-status:not(:empty) {
    grid-row: 3;
  }
}

@media (max-width: 620px) {
  .student-workspace .student-modal-card > .card-heading.student-editor-header,
  .student-workspace .student-edit-panel,
  .student-workspace > .student-modal-card > .form-actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .student-workspace .student-edit-panel {
    padding-bottom: 1.75rem;
  }

  .student-workspace-overview {
    padding-bottom: 2rem !important;
  }

  .student-workspace-heading {
    align-items: flex-start;
  }

  .student-workspace .student-edit-tab {
    flex: 0 0 auto;
  }

  .student-overview-grid {
    grid-template-columns: 1fr;
  }

  .student-overview-section-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .student-overview-section-actions {
    justify-content: flex-start;
  }

  .student-workspace .piece-progress-editor {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .student-workspace .piece-progress-editor > [data-piece-progress-label] {
    grid-column: 2;
  }

  .student-workspace .piece-progress-editor label:has([data-piece-xp]) {
    grid-column: 1 / -1;
  }

  .student-workspace .piece-progress-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    flex-direction: column;
    align-items: stretch;
  }

  .student-workspace .piece-progress-editor .piece-save-status:not(:empty) {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .student-workspace .piece-progress-actions .button {
    flex: 0 1 auto;
    min-width: 0;
    width: 100%;
  }

  .student-workspace .student-edit-panel[data-student-edit-panel="details"] .form-row {
    grid-template-columns: 1fr;
  }

  .student-drive-folder-editor {
    grid-template-columns: 1fr;
  }

  .student-drive-folder-editor .button {
    width: 100%;
  }
}

.student-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.piece-admin-card .piece-save-status {
  min-width: 0;
  align-self: center;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
}
@media (max-width: 620px) {
  .student-overview-grid { grid-template-columns: 1fr; }
}
