/* =========================================================================
   Tutorials — the tenant viewer (#tutorialsScreen) and the super-admin
   authoring pane (#lobbyPaneTutorials).

   Same contract as maintenance.css, dataHub.css and landingShowcase.css:
   this sheet defines NO colours of its own. Every value is a var() from
   app.css's :root, so dark mode needs zero overrides here, and every offset
   uses logical properties (margin-inline, inset-inline-*) so Arabic and
   Kurdish mirror on their own.
   ========================================================================= */

/* ------------------------------------------------ tenant viewer --------- */

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

.tut-rail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 12px;
}

.tut-section {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.tut-section:hover { color: var(--ink); border-color: var(--brand-1); }

.tut-section.active {
  color: var(--ink);
  border-color: var(--brand-1);
  background: var(--pill-blue-soft-bg);
}

.tut-section-ico { display: flex; flex: 0 0 auto; color: var(--brand-1); }

.tut-section-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tut-section-name { font-weight: 600; color: var(--ink); }
.tut-section-desc {
  font-size: 10.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tut-section-count {
  margin-inline-start: auto;
  flex: 0 0 auto;
  min-width: 20px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-text);
}

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

.tut-player:empty { display: none; }

/* 16:9 without a wrapper hack. Both an <iframe> and a <video> fill it. */
.tut-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  overflow: hidden;
}

.tut-frame iframe,
.tut-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.tut-now {
  padding: 12px 2px 0;
}
.tut-now h3 {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
}
.tut-now p {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0;
  /* Instructions are authored as plain text with real line breaks; keeping
     them is the difference between a numbered list and a wall of prose. */
  white-space: pre-wrap;
}

.tut-list { display: flex; flex-direction: column; gap: 8px; }

.tut-card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.tut-card:hover {
  border-color: var(--brand-1);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.tut-card.playing {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 1px var(--brand-1);
}

.tut-card-head { display: flex; align-items: center; gap: 10px; }

.tut-card-play {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}

.tut-card.playing .tut-card-play { background: var(--patina); }

.tut-card-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  min-width: 0;
}

.tut-card-time {
  margin-inline-start: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
}

.tut-card-body {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 8px 0 0;
  /* Two lines in the list; the full text shows under the player. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tut-empty {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 18px;
  text-align: center;
  border: 1px dashed var(--panel-edge);
  border-radius: 10px;
}

.tut-empty-lg { padding: 44px 22px; }
.tut-empty-lg h3 {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 8px;
}
.tut-empty-lg p { margin: 0; line-height: 1.65; max-width: 420px; margin-inline: auto; }

/* -------------------------------------------- super-admin authoring ----- */

.tut-admin-note {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.6;
  color: var(--amber-note-text);
  background: var(--amber-note);
  border: 1px solid var(--amber-note-edge);
  border-radius: 9px;
  padding: 10px 12px;
  margin: 0 0 16px;
}

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

.tut-admin-rail, .tut-admin-composer {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 14px;
}

.tut-admin-rail-head {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.tut-admin-section {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--panel-edge);
  border-radius: 9px;
  margin-bottom: 6px;
  padding-inline-end: 4px;
  transition: border-color .15s ease, background .15s ease;
}

.tut-admin-section.active { border-color: var(--brand-1); background: var(--pill-blue-soft-bg); }

.tut-admin-section-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}

.tut-admin-section-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tut-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.tut-icon-btn:hover { color: var(--ink); background: var(--surface-hover); }
.tut-icon-btn.danger:hover { color: var(--rust); }

.tut-admin-newsection {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-edge);
}

.tut-admin-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.tut-admin-composer { display: flex; flex-direction: column; gap: 9px; }

.tut-admin-newsection input,
.tut-admin-newsection select,
.tut-admin-composer input[type="text"],
.tut-admin-composer input[type="url"],
.tut-admin-composer input[type="file"],
.tut-admin-composer textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
}

.tut-admin-composer textarea { resize: vertical; line-height: 1.55; }

.tut-admin-newsection input:focus,
.tut-admin-composer input:focus,
.tut-admin-composer textarea:focus {
  outline: 2px solid var(--steel);
  outline-offset: 0;
  border-color: var(--steel);
}

.tut-kind-row {
  display: flex;
  gap: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
}
.tut-kind-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.tut-upload-row { display: flex; align-items: center; gap: 10px; }

.tut-progress {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 4px;
  background: var(--panel-edge);
  overflow: hidden;
}
.tut-progress > i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-3));
  transition: width .2s ease;
}

.tut-upload-label {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
}

.tut-admin-videos { display: flex; flex-direction: column; gap: 8px; }

.tut-admin-video {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 12px 14px;
}

/* A draft is deliberately dimmed rather than hidden: a part-finished upload
   has to stay visible, or the only sign of a failed upload would be a video
   that silently never appears for anybody. */
.tut-admin-video.draft { border-style: dashed; }

.tut-admin-video-head { display: flex; align-items: center; gap: 10px; }
.tut-admin-video-head h4 {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  min-width: 0;
}
.tut-admin-video-head .fs-pill { margin-inline-start: auto; }

.tut-admin-video-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-soft);
}
.tut-admin-video-meta a { color: var(--brand-1); text-decoration: none; }
.tut-admin-video-meta a:hover { text-decoration: underline; }

.tut-admin-video-body {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.tut-admin-video .tut-progress { margin-top: 9px; }

.tut-admin-video-actions { display: flex; gap: 8px; margin-top: 10px; }
.tut-admin-video-actions .danger { color: var(--rust); }

/* ------------------------------------------------------- responsive ----- */

@media (max-width: 900px) {
  .tut-layout, .tut-admin-layout { grid-template-columns: 1fr; }
  .tut-rail {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .tut-rail::-webkit-scrollbar { display: none; }
  .tut-section { width: auto; flex: 0 0 auto; }
  /* The description makes each pill far too wide once they sit in a row. */
  .tut-section-desc { display: none; }
}

@media (max-width: 640px) {
  .tut-layout { padding: 12px; gap: 12px; }
  .tut-now h3 { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .tut-card:hover { transform: none; }
  .tut-progress > i { transition: none; }
}
