/* OrbitOS Teacher Workspace Shell */

body {
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(125, 174, 255, 0.12), transparent 20%),
    linear-gradient(180deg, #141d2d 0%, #182335 100%);
}

.workspace-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.workspace-app.auth-locked .workspace-header,
.workspace-app.auth-locked .workspace-main {
  display: none;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-gate-panel {
  width: min(560px, 100%);
  border-radius: 30px;
  border: 1px solid rgba(148, 168, 200, 0.16);
  background:
    linear-gradient(180deg, rgba(29, 42, 64, 0.98), rgba(23, 34, 52, 0.98));
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  text-align: center;
}

.auth-gate-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: linear-gradient(145deg, #4f95ff 0%, #2c72ff 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: var(--weight-bold);
  box-shadow: 0 18px 38px rgba(44, 114, 255, 0.35);
}

.auth-gate-panel h1 {
  margin-top: 8px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.auth-gate-panel p {
  margin: 16px auto 0;
  max-width: 440px;
  color: var(--text-secondary);
  font-size: 16px;
}

.auth-gate-login {
  margin-top: 26px;
  display: flex;
  justify-content: center;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 30, 46, 0.84);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 80;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(145deg, #4f95ff 0%, #2c72ff 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: var(--weight-bold);
  box-shadow: 0 16px 34px rgba(44, 114, 255, 0.35);
}

.brand-title {
  font-size: 18px;
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
}

.brand-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.workspace-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.workspace-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.workspace-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.workspace-tab.active {
  background: linear-gradient(145deg, rgba(66, 140, 255, 0.28), rgba(66, 140, 255, 0.14));
  color: #f7fbff;
  box-shadow: inset 0 0 0 1px rgba(66, 140, 255, 0.22);
}

.workspace-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-main {
  width: min(1520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.admin-view-as-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(37, 59, 90, 0.98), rgba(24, 42, 67, 0.96));
  box-shadow: 0 18px 42px rgba(8, 13, 22, 0.22);
}

.admin-view-as-bar.is-active {
  border-color: rgba(45, 212, 191, 0.34);
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.16), transparent 38%),
    linear-gradient(135deg, rgba(31, 63, 78, 0.98), rgba(24, 42, 67, 0.96));
}

.admin-view-as-copy {
  min-width: 220px;
}

.admin-view-as-copy strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.admin-view-as-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.admin-view-as-controls .select {
  max-width: 420px;
  min-width: min(360px, 100%);
}

.hero-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
  border-radius: 26px;
  border: 1px solid rgba(148, 168, 200, 0.14);
  background:
    linear-gradient(135deg, rgba(32, 47, 72, 0.95) 0%, rgba(24, 37, 58, 0.93) 100%);
  box-shadow: var(--shadow-md);
}

body[data-view="student"] .hero-panel,
body[data-view="hallway"] .hero-panel,
body[data-view="admin"] .hero-panel {
  padding: 20px 24px;
}

.hero-copy h1 {
  margin-top: 6px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.hero-copy p {
  margin-top: 10px;
  max-width: 760px;
  color: var(--text-secondary);
  font-size: 15px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.teacher-shell {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 20px;
  min-height: 0;
}

.teacher-shell.page-focus {
  grid-template-columns: 1fr;
}

.teacher-shell.page-focus .teacher-sidebar {
  display: none;
}

.teacher-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-card,
.stage-card {
  border-radius: 24px;
  border: 1px solid rgba(148, 168, 200, 0.14);
  background: linear-gradient(180deg, rgba(29, 42, 64, 0.98), rgba(23, 34, 52, 0.98));
  box-shadow: var(--shadow-sm);
}

.side-card {
  padding: 18px;
}

.side-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.side-card h2 {
  font-size: 18px;
  letter-spacing: -0.03em;
  margin-top: 4px;
}

.auth-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.teacher-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

body[data-view="student"] .teacher-stage,
body[data-view="hallway"] .teacher-stage,
body[data-view="admin"] .teacher-stage {
  gap: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: 10px;
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 6px 6px;
}

.workspace-search {
  flex: 1 1 280px;
  max-width: 360px;
}

.toolbar-clear {
  padding-inline: 12px;
}

.stage-card {
  min-height: 540px;
  overflow: hidden;
}

body[data-view="student"] .stage-card,
body[data-view="hallway"] .stage-card,
body[data-view="admin"] .stage-card {
  min-height: 420px;
}

.hidden {
  display: none !important;
}

.admin-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
}

.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-hero-stack {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-hero h2 {
  margin-top: 4px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.admin-hero p {
  margin-top: 8px;
  max-width: 720px;
  color: var(--text-secondary);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar,
.admin-workspace {
  border-radius: 24px;
  border: 1px solid rgba(148, 168, 200, 0.14);
  background: linear-gradient(180deg, rgba(22, 31, 48, 0.98), rgba(15, 22, 35, 0.98));
  box-shadow: var(--shadow-md);
}

.admin-sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 108px;
}

.admin-sidebar-head h3,
.admin-workspace-head h3 {
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.admin-sidebar-head p,
.admin-workspace-head p {
  margin-top: 8px;
  color: var(--text-secondary);
}

.admin-sidebar-nav,
.admin-sidebar-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-nav-button {
  width: 100%;
  border: 1px solid rgba(148, 168, 200, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  text-align: left;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.admin-nav-button span,
.admin-nav-button em {
  color: var(--text-secondary);
  font-style: normal;
  font-size: 13px;
}

.admin-nav-button:hover {
  border-color: rgba(97, 163, 255, 0.22);
  background: rgba(66, 140, 255, 0.08);
}

.admin-nav-button.active {
  border-color: rgba(66, 140, 255, 0.3);
  background: linear-gradient(180deg, rgba(66, 140, 255, 0.18), rgba(66, 140, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(66, 140, 255, 0.16);
}

.admin-nav-button.active em {
  color: #d9ebff;
}

.admin-workspace {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-workspace-head {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 168, 200, 0.12);
}

.admin-workspace-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-editor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  border: 1px solid rgba(66, 140, 255, 0.24);
  background: rgba(66, 140, 255, 0.08);
  padding: 14px 16px;
}

.admin-editor-status strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.admin-schedule-modal {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-schedule-modal .modal-head {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.admin-block-row {
  gap: 12px;
  cursor: grab;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.admin-block-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-block-row.dragging {
  opacity: 0.6;
  cursor: grabbing;
  transform: scale(0.99);
}

.admin-block-row.drag-over {
  border-color: rgba(66, 140, 255, 0.45);
  background: rgba(66, 140, 255, 0.1);
}

.admin-drag-handle {
  display: inline-flex;
  width: 22px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  cursor: grab;
}

.admin-field-check {
  justify-content: flex-end;
}

.admin-grid-encounter {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.admin-card {
  border-radius: 20px;
  border: 1px solid rgba(148, 168, 200, 0.14);
  background: linear-gradient(180deg, rgba(22, 31, 48, 0.98), rgba(15, 22, 35, 0.98));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-inline-card {
  gap: 10px;
}

.admin-inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.admin-card-muted {
  opacity: 0.92;
}

.admin-card-head h3 {
  margin-top: 4px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.admin-copy {
  color: var(--text-secondary);
  font-size: 14px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.admin-dropzone,
.admin-output {
  border-radius: 18px;
  border: 1px dashed rgba(148, 168, 200, 0.22);
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.admin-list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 168, 200, 0.14);
  background: rgba(255, 255, 255, 0.025);
  padding: 14px 16px;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-danger-soft {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.08);
  color: #fecaca;
}

.btn-danger-soft:hover {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.14);
}

.admin-list-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}

.admin-list-row-active {
  border-color: rgba(66, 140, 255, 0.28);
  background: linear-gradient(180deg, rgba(66, 140, 255, 0.12), rgba(66, 140, 255, 0.04));
}

@media (max-width: 900px) {
  .workspace-header {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .workspace-tabs {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .teacher-shell {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

}

@media (max-width: 760px) {
  .workspace-main {
    width: min(100%, calc(100% - 20px));
    padding-top: 18px;
  }

  .admin-view-as-bar,
  .admin-view-as-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-view-as-controls .select {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .workspace-header {
    padding: 14px 12px;
  }

  .workspace-meta {
    width: 100%;
    justify-content: space-between;
  }

  .hero-panel {
    padding: 20px 18px;
    border-radius: 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .stage-card,
  .side-card {
    border-radius: 20px;
  }
}
