/* engineer.css — Engineer's Console styles.
 *
 * Designed to match the PT transport window screenshots:
 *   - Dark brushed-metal bar (#3a3a3c) housing transport buttons
 *   - Light-grey button bodies with subtle bevels
 *   - Dark LCD-style SMPTE display with green digits
 *   - Card-based collapsible sections for everything else
 *
 * All sizes work down to iPad Pro 11" portrait (834px) and up to a
 * large director monitor.
 */

.eng-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 24px;
  max-width: 1280px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  /* pwa136 — main.css sets body { overflow: hidden } for the actor
     reader. Override on the engineer console so the section stack
     scrolls when it exceeds the viewport. iPad-safe momentum scroll. */
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* ── Header ────────────────────────────────────────────────────── */
.eng-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 14px;
  background: #2a2c30;
  color: #f2f2f7;
  border-radius: 10px;
}
.eng-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.eng-layout-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.eng-layout-label { color: #aeaeb2; }
.eng-layout-select {
  padding: 4px 8px;
  border-radius: 6px;
  background: #3a3a3c;
  color: #f2f2f7;
  border: 1px solid #48484a;
  font-size: 12px;
  min-width: 120px;
}
.eng-layout-btn {
  padding: 5px 8px;
  border-radius: 6px;
  background: #48484a;
  color: #f2f2f7;
  border: 1px solid #5a5a5c;
  font-size: 13px;
  cursor: pointer;
  min-width: 28px;
}
.eng-layout-btn:hover { background: #5a5a5c; }

/* ── Section cards ─────────────────────────────────────────────── */
.eng-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eng-card {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
}
.eng-card.eng-dragging   { opacity: 0.55; transform: scale(0.99); }
.eng-card.eng-drop-target {
  border-color: #2c5fa6;
  box-shadow: 0 0 0 2px rgba(44, 95, 166, 0.25);
}
.eng-card-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.eng-card-summary::-webkit-details-marker { display: none; }
.eng-card-grip {
  cursor: grab;
  color: #9ca3af;
  font-size: 14px;
  padding: 2px 4px;
  letter-spacing: -2px;
}
.eng-card-grip:active { cursor: grabbing; }
.eng-card-title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
}
.eng-card-chevron {
  color: #9ca3af;
  font-size: 14px;
  transition: transform 0.15s ease;
}
.eng-card[open] .eng-card-chevron { transform: rotate(180deg); }
.eng-card-body { padding: 4px 14px 14px; }

/* ── Stub sections (placeholder cards) ─────────────────────────── */
.eng-stub {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.5;
  padding: 8px 0;
}
.eng-stub p { margin: 4px 0; }
.eng-stub code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
}
.eng-stub-todo {
  font-style: italic;
  color: #9ca3af;
  font-size: 11.5px;
  margin-top: 8px !important;
}
.eng-error {
  color: #b91c1c;
  font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: #fef2f2;
  padding: 8px;
  border-radius: 6px;
}

/* ════════════════════════════════════════════════════════════════
 *  TRANSPORT BAR — PT-replica
 * ════════════════════════════════════════════════════════════════ */
.eng-tx {
  background: linear-gradient(to bottom, #3a3a3c 0%, #2a2a2c 100%);
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid #1c1c1e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.eng-tx-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Transport buttons — light brushed-metal look matching PT compact. */
.eng-tx-btn {
  width: 38px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(to bottom, #efefef 0%, #c8c8c8 100%);
  border: 1px solid #6b6b6d;
  color: #2a2a2c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: filter 0.1s ease, transform 0.06s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 1px 2px rgba(0,0,0,0.3);
}
.eng-tx-btn:hover { filter: brightness(1.05); }
.eng-tx-btn:active { transform: translateY(1px); }
.eng-tx-btn-firing { filter: brightness(0.85); }
.eng-tx-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}
.eng-tx-icon svg { width: 18px; height: 18px; }

/* Specific state colors per button */
.eng-tx-stop.eng-tx-stopped .eng-tx-icon { color: #3b82f6; }     /* Blue stop = stopped */
.eng-tx-play.eng-tx-playing .eng-tx-icon { color: #22c55e; }     /* Green play = playing */
.eng-tx-play.eng-tx-play-loop .eng-tx-icon { color: #f97316; }   /* Orange loop = loop play */
.eng-tx-rec.eng-tx-recording .eng-tx-icon { color: #ef4444; }    /* Red record = recording */
.eng-tx-rec.eng-tx-rec-qp .eng-tx-icon    { color: #ef4444; }    /* Red P-circle = QuickPunch */

/* pwa136 — Record-armed-ready (TransportPrimed). PT itself flashes the
   record button red when transport is armed but not rolling; mirror
   that here. 0.7 s cadence matches PT's blink. */
@keyframes engRecArmedFlash {
  0%, 49%   { color: #ef4444; }
  50%, 100% { color: #6b7280; }
}
.eng-tx-rec.eng-tx-rec-primed .eng-tx-icon {
  animation: engRecArmedFlash 0.7s steps(2, end) infinite;
}
.eng-tx-chasing .eng-tx-icon { color: #3b82f6; }                 /* Blue TC chase active */

/* Status pills — 2 small dots next to record */
.eng-tx-pills {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 4px;
}
.eng-tx-pill {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #2a2a2c;
  border: 1px solid #5a5a5c;
}
.eng-tx-pill-arm.eng-tx-pill-on     { background: #ef4444; border-color: #fca5a5; }
.eng-tx-pill-monitor.eng-tx-pill-on { background: #22c55e; border-color: #86efac; }

/* SMPTE LCD display — dark green-on-black */
.eng-tx-lcd {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0d1410;
  border: 1px solid #1c1c1e;
  border-radius: 7px;
  padding: 4px 10px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.6);
  cursor: pointer;
  user-select: none;
}
.eng-tx-lcd-value {
  font-family: "Courier New", "Menlo", monospace;
  font-size: 20px;
  font-weight: 700;
  color: #22ff22;
  text-shadow: 0 0 6px rgba(34,255,34,0.45);
  letter-spacing: 1.5px;
  min-width: 144px;
  text-align: center;
}
.eng-tx-chevron {
  background: transparent;
  border: 0;
  color: #22ff22;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

/* Expanded transport (chevron-revealed) */
.eng-tx-expand {
  margin-top: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  color: #d1d5db;
  font-size: 12px;
}
.eng-tx-expand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eng-tx-toggle {
  background: #1c1c1e;
  color: #d1d5db;
  border: 1px solid #48484a;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: "Courier New", monospace;
}
.eng-tx-toggle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.eng-tx-toggle:hover:not(:disabled) {
  background: #2c2c2e;
  border-color: #5a5a5c;
}
.eng-tx-toggle-on {
  background: #1f4d2a !important;
  border-color: #2e7d3e !important;
  color: #c8f5d4 !important;
  box-shadow: 0 0 6px rgba(46, 125, 62, 0.45);
}
.eng-tx-toggle-on:hover:not(:disabled) {
  background: #266d39 !important;
}
.eng-tx-startend {
  margin-left: auto;
  font-family: "Courier New", monospace;
  font-size: 11.5px;
  color: #aeaeb2;
}

/* ── Jump-to-SMPTE modal ───────────────────────────────────────── */
.eng-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.eng-modal {
  background: #ffffff;
  border-radius: 10px;
  padding: 18px 22px;
  min-width: 320px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
.eng-modal h3 {
  margin: 0 0 14px;
  font-size: 16px;
  color: #1f2937;
}
.eng-modal-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 18px;
  font-family: "Courier New", monospace;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: 2px;
}
.eng-modal-input-err {
  border-color: #ef4444;
  animation: shake 0.2s linear 2;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.eng-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.eng-modal-actions .btn-primary,
.eng-modal-actions .btn-secondary {
  padding: 8px 14px;
  border-radius: 6px;
  border: 0;
  font-size: 13px;
  cursor: pointer;
}
.eng-modal-actions .btn-primary {
  background: #2c5fa6;
  color: #ffffff;
}
.eng-modal-actions .btn-primary:hover { background: #3471c2; }
.eng-modal-actions .btn-secondary {
  background: #e5e7eb;
  color: #374151;
}
.eng-modal-actions .btn-secondary:hover { background: #d1d5db; }

/* ── PT Tracks section ──────────────────────────────────────────── */
.eng-tracks {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.eng-tracks th, .eng-tracks td {
  padding: 5px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.eng-tracks th {
  background: #f9fafb;
  color: #6b7280;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.eng-tracks td.r, .eng-tracks th.r { text-align: right; }
.eng-tracks td.muted { color: #9ca3af; }
.eng-arm-btn {
  width: 28px;
  height: 22px;
  border-radius: 4px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #6b7280;
  cursor: pointer;
  font-size: 11px;
}
.eng-arm-btn:hover { background: #fee2e2; color: #ef4444; }
.eng-arm-btn.eng-arm-on {
  background: #ef4444; color: #fff; border-color: #b91c1c;
}
.eng-arm-btn.eng-arm-firing { transform: scale(0.92); }
.eng-arm-btn.eng-arm-err {
  background: #fde68a; color: #92400e; border-color: #f59e0b;
}
.eng-tracks-hint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 6px;
  font-style: italic;
}

/* pwa146 — Full dark-mode pass for the Engineer's Console (supersedes
 * pwa145's narrow PT-Tracks-only fix).
 *
 * The hardcoded light surfaces (#ffffff card bg, #f9fafb / #f3f4f6
 * accents, #e5e7eb borders, #1f2937 text) all become light-on-white
 * when the body inherits theme-dark. Override every .eng-* surface
 * that has a hardcoded light value above. Light theme stays untouched. */

/* Cards (the white container behind each section's body). */
body.theme-dark .eng-card {
  background: #1e2126;
  border-color: #303540;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
body.theme-dark .eng-card.eng-drop-target {
  border-color: #4a8bcf;
  box-shadow: 0 0 0 2px rgba(74, 139, 207, 0.35);
}
body.theme-dark .eng-card-summary { color: #e6e8eb; }
/* pwa148 — EC's section headers use .eng-card-title (NOT the shared
 * .var-ss-title — EC has its own inline section shell predating the
 * shared module). pwa147 themed the shared selectors but missed these.
 * Result: titles like "Send All to Verse" rendered near-black on dark. */
body.theme-dark .eng-card-title   { color: #e6e8eb; }
body.theme-dark .eng-card-grip    { color: #6b7280; }
body.theme-dark .eng-card-chevron { color: #9ba3ad; }

/* PT Tracks table. */
body.theme-dark .eng-tracks th,
body.theme-dark .eng-tracks td {
  border-bottom-color: #303540;
  color: #e6e8eb;
}
body.theme-dark .eng-tracks th {
  background: #25282d;
  color: #9ba3ad;
}
body.theme-dark .eng-tracks td.muted { color: #6b7280; }
body.theme-dark .eng-tracks-hint     { color: #6b7280; }

/* Record-arm buttons. */
body.theme-dark .eng-arm-btn {
  background: #2a2e35;
  border-color: #3a4048;
  color: #cbd2da;
}
body.theme-dark .eng-arm-btn:hover {
  background: #4a1d1d;
  color: #ff9999;
}
body.theme-dark .eng-arm-btn.eng-arm-on {
  background: #c0392b;
  color: #fff;
  border-color: #8e2818;
}
body.theme-dark .eng-arm-btn.eng-arm-err {
  background: #4a3a18;
  color: #fde68a;
  border-color: #92400e;
}

/* Jump-to-TC modal + other generic .eng surfaces. */
body.theme-dark .eng-modal {
  background: #1e2126;
  color: #e6e8eb;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
body.theme-dark .eng-modal h3 { color: #e6e8eb; }
body.theme-dark .eng-modal input,
body.theme-dark .eng-modal select {
  background: #25282d;
  color: #e6e8eb;
  border-color: #3a4048;
}
body.theme-dark .eng-modal input:focus,
body.theme-dark .eng-modal select:focus { border-color: #ef4444; }

/* Verse Markers section panels. */
body.theme-dark .eng-vm-naming,
body.theme-dark .eng-vm-now {
  background: #25282d;
  color: #e6e8eb;
}
body.theme-dark .eng-vm-now-name { color: #f1f3f5; }
body.theme-dark .eng-vm-btn {
  background: #2a2e35;
  color: #cbd2da;
  border-color: #3a4048;
}
body.theme-dark .eng-vm-btn:hover {
  background: #3a4048;
  border-color: #545b65;
}
body.theme-dark .eng-vm-btn.eng-vm-btn-primary {
  background: #2c5fa6; color: #fff; border-color: #1e4a82;
}
body.theme-dark .eng-vm-help code {
  background: #25282d; color: #e6e8eb;
}
body.theme-dark .eng-vm-row:hover,
body.theme-dark .eng-vm-recent-row:hover {
  background: #2a2e35 !important;
}
body.theme-dark .eng-vm-smpte { color: #6fa8e0; }
body.theme-dark .eng-vm-name  { color: #e6e8eb; }

/* ── Send All to Verse + Don't Record ──────────────────────────── */
.eng-sv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.eng-sv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eng-sv-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #4b5563;
}
.eng-sv-row input[type="number"] {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}
.eng-sv-send {
  margin-left: auto;
  padding: 6px 14px;
  background: #2c5fa6;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.eng-sv-send:hover { background: #3471c2; }
.eng-sv-status {
  font-size: 11.5px;
  color: #6b7280;
  font-family: ui-monospace, Menlo, monospace;
}
.eng-sv-dr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid #f3f4f6;
}
.eng-sv-dr-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.eng-sv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.eng-sv-chip:has(input:checked) {
  background: #fee2e2; border-color: #fca5a5; color: #b91c1c;
}

/* ── Current Chapter readout ───────────────────────────────────── */
.eng-cc {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 18px;
  padding: 6px 0;
}
.eng-cc-book {
  font-size: 18px;
  font-weight: 600;
  color: #4b5563;
}
.eng-cc-ch {
  font-size: 38px;
  font-weight: 800;
  color: #1f2937;
  font-family: "Helvetica Neue", Helvetica, sans-serif;
  letter-spacing: -1px;
}

/* ── Verse Markers section ─────────────────────────────────────── */
.eng-vm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.eng-vm-naming { background: #f9fafb; border-radius: 6px; padding: 6px 10px; }
.eng-vm-naming summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #4b5563; }
.eng-vm-naming-body { padding-top: 6px; font-size: 11.5px; color: #6b7280; }
/* pwa137 — Verse Marker section: state pill + action buttons */
.eng-vm-status {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 12px; background: #f9fafb;
  border-radius: 6px; margin-bottom: 4px;
}
.eng-vm-now-label { font-size: 10px; text-transform: uppercase; color: #6b7280; font-weight: 600; letter-spacing: 0.5px; }
.eng-vm-now-name  { font-size: 18px; font-weight: 700; color: #1f2937; font-family: ui-monospace, Menlo, monospace; }
.eng-vm-around    { display: flex; flex-direction: column; gap: 2px; font-size: 11px; text-align: right; }
.eng-vm-btn {
  flex: 1; padding: 8px 6px; border-radius: 6px; border: 1px solid #d1d5db;
  background: #ffffff; color: #1f2937; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: background 100ms, border-color 100ms;
}
.eng-vm-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.eng-vm-btn:active { transform: translateY(1px); }
.eng-vm-btn-primary {
  background: #2c5fa6; color: #fff; border-color: #1e4a82;
}
.eng-vm-btn-primary:hover { background: #1e4a82; }
.eng-vm-recent-row:hover { background: #f3f4f6 !important; }
.eng-vm-help code { background: #fff; padding: 1px 4px; border-radius: 3px; }
.eng-vm-counter { margin-top: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.eng-vm-list { font-size: 12.5px; }
.eng-vm-row {
  display: grid;
  grid-template-columns: 60px 100px 1fr;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  align-items: center;
}
.eng-vm-row:hover { background: #f3f4f6; }
.eng-vm-row-flash { background: #d1fae5; }
.eng-vm-num { color: #9ca3af; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.eng-vm-smpte { font-family: "Courier New", monospace; font-size: 12px; color: #2c5fa6; }
.eng-vm-name { color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Notes section ─────────────────────────────────────────────── */
.eng-notes-header {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.eng-notes-bucket {
  color: #2c5fa6;
  text-transform: none;
  letter-spacing: normal;
}
.eng-notes-list { font-size: 12.5px; }
.eng-note-row {
  display: grid;
  grid-template-columns: 100px 130px 1fr;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  align-items: center;
}
.eng-note-row:hover { background: #f3f4f6; }
.eng-note-row-flash { background: #d1fae5; }
.eng-note-smpte { font-family: "Courier New", monospace; font-size: 12px; color: #2c5fa6; }
.eng-note-actor { color: #4b5563; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eng-note-text { color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Small viewport tightening */
@media (max-width: 720px) {
  .eng-tx-row { gap: 2px; }
  .eng-tx-btn { width: 34px; height: 30px; }
  .eng-tx-lcd-value { font-size: 16px; min-width: 116px; }
  .eng-startend { display: none; }
  .eng-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
