/* Page recording — toolbar, click flash, result canvas */

.phone-stage {
  position: relative;
  overflow: visible;
}

.rec-export-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.rec-export-header-text {
  flex: 1;
  min-width: 0;
}

.recording-canvas-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.rec-canvas-export-wrap {
  padding: 12px 16px 16px;
}

.rec-export-mode {
  padding: 40px 48px 44px !important;
  box-sizing: border-box !important;
  background: #f8fafc;
}

.recording-canvas-wrap.is-full-capture,
.recording-canvas-wrap.is-full-capture .recording-canvas-root,
.recording-canvas-wrap.is-full-capture .rec-canvas-scroll {
  overflow: visible !important;
  max-height: none !important;
}

.rec-session-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  outline: none;
  border-radius: 6px;
}

.rec-session-subtitle {
  margin: 0 0 4px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
  outline: none;
  border-radius: 6px;
}

.rec-canvas-meta {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
}

.rec-editable:hover,
.rec-editable:focus {
  background: rgba(0, 184, 118, 0.08);
  outline: 1px dashed rgba(0, 184, 118, 0.35);
}

.rec-editable:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-weight: 400;
}

.rec-session-subtitle:empty::before,
.rec-frame-subtitle:empty::before {
  content: attr(data-placeholder);
  color: #cbd5e1;
  font-weight: 400;
}

.rec-export-mode .rec-editable:hover,
.rec-export-mode .rec-editable:focus {
  background: transparent;
  outline: none;
}

.rec-export-mode [data-placeholder]::before,
.rec-export-mode .rec-editable:empty::before {
  content: none !important;
  display: none !important;
}

.rec-export-mode .rec-placeholder-hidden {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.rec-export-mode .rec-copy-btn,
.rec-export-mode .rec-export-hide {
  visibility: hidden !important;
  pointer-events: none;
}

.phone-stage-main {
  position: relative;
}

.recording-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  will-change: transform;
}

.recording-bar[hidden] { display: none !important; }

.recording-bar.is-dragging {
  opacity: 0.92;
  cursor: grabbing;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.rec-bar-drag {
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 4px 2px;
  margin: 0 -2px 0 -4px;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  line-height: 1;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.rec-bar-drag:hover { color: #e2e8f0; }
.recording-bar.is-dragging .rec-bar-drag { cursor: grabbing; color: #fff; }

.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.recording-label {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: #fca5a5;
}

.recording-count {
  color: #cbd5e1;
  min-width: 36px;
}

.rec-bar-btn {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #334155;
  color: #fff;
}

.rec-bar-btn.primary { background: var(--opay); color: #fff; }
.rec-bar-btn.ghost { background: transparent; color: #94a3b8; }
.rec-bar-btn:hover { filter: brightness(1.08); }

.phone-stage.recording-on .phone {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.45), 0 25px 50px rgba(0, 0, 0, 0.25);
}

#rec-pending-layer {
  position: absolute;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  overflow: visible;
}

.rec-pending-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.45);
  border: 2.5px solid #ef4444;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: auto;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font: inherit;
  overflow: visible;
  z-index: 1;
}

.rec-pending-marker .rec-marker-num {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  z-index: 0;
}

.rec-pending-marker .rec-marker-x {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #7f1d1d;
  border: 2px solid #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}

/* Recording result canvas (wide) */
.recording-canvas-wrap {
  display: none;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.recording-canvas-wrap:not([hidden]) {
  display: block;
}

.phone-stage-main.canvas-mode .recording-canvas-wrap:not([hidden]) {
  display: block;
}

.recording-canvas-root {
  padding: 8px 12px 12px;
  min-width: 0;
}

.rec-canvas-scroll {
  overflow: auto;
  padding-bottom: 8px;
}

.rec-canvas-track {
  position: relative;
  min-width: min-content;
  padding: 6px 0 12px;
}

.rec-canvas-rows {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 80px;
  width: var(--rec-row-max-width, max-content);
}

.rec-canvas-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 48px;
  min-width: min-content;
  width: 100%;
}

.rec-links-svg {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.rec-frame-node {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 200px;
  display: flex;
  flex-direction: column;
}

.rec-frame-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
  /* Keep phone tops aligned across a row even when titles wrap differently */
  min-height: 56px;
  height: 56px;
  overflow: hidden;
}

.rec-frame-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rec-frame-title {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  line-height: 1.3;
  outline: none;
  border-radius: 4px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  min-height: calc(1.3em * 2);
  max-height: calc(1.3em * 2);
}

.rec-frame-subtitle {
  font-size: 10px;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.3;
  outline: none;
  border-radius: 4px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.3em;
}

.rec-frame-idx {
  font-size: 11px;
  font-weight: 800;
  background: var(--opay);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rec-export-mode .rec-session-subtitle:empty,
.rec-export-mode .rec-frame-subtitle:empty {
  display: none;
}

.rec-copy-btn {
  border: 0;
  background: var(--opay-light);
  color: var(--opay-dark);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.rec-copy-btn:hover { background: #bbf7d0; }

.rec-frame-del {
  border: 0;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rec-frame-del:hover { background: #fecaca; }

.rec-export-mode .rec-frame-del {
  visibility: hidden !important;
  pointer-events: none;
}

.rec-frame-img-wrap {
  position: relative;
  border-radius: 12px;
  overflow: visible;
  border: 2px solid #e2e8f0;
  background: #111;
  cursor: copy;
  width: 100%;
  aspect-ratio: 390 / 844;
  flex: 0 0 auto;
}

.rec-frame-img-clip {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #111;
}

.rec-frame-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  vertical-align: top;
}

.rec-marker.on-image {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.45);
  border: 2px solid #ef4444;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: auto;
  cursor: pointer;
  padding: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  color: #fff;
  font: inherit;
  overflow: visible;
}
.rec-marker.on-image:hover,
.rec-marker.on-image:focus-visible {
  background: rgba(185, 28, 28, 0.9);
}
.rec-marker-num {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  position: relative;
  z-index: 0;
}
.rec-marker-x {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #7f1d1d;
  border: 2px solid #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}

.recording-empty {
  color: #64748b;
  padding: 24px;
  text-align: center;
}

/* Nav — recordings */
.nav-section-recording .nav-section-body {
  padding-bottom: 8px;
}

.nav-rec-start {
  width: 100%;
  margin-bottom: 8px;
  background: #0f766e !important;
  color: #fff !important;
  font-weight: 700;
  justify-content: center;
  gap: 8px;
}

.nav-recording-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 4px;
}

.nav-recording-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  width: auto;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 12px;
}

.nav-recording-item > .ph {
  flex-shrink: 0;
  margin-top: 2px;
}

.nav-rec-item-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  padding: 2px 0;
}

.nav-rec-item-btn {
  width: 26px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nav-rec-item-btn i { font-size: 13px; }

.nav-rec-item-btn:hover {
  background: #334155;
  color: #e2e8f0;
}

.nav-rec-item-btn.danger:hover {
  background: #450a0a;
  color: #fca5a5;
}

.nav-recording-item.archived { opacity: 0.75; font-size: 11px; }

.nav-recording-item.on {
  background: #0f766e;
  color: #fff;
}

.nav-rec-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.nav-rec-meta strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-rec-meta small {
  font-size: 10px;
  color: #94a3b8;
}

.nav-recording-item.on .nav-rec-meta small { color: #99f6e4; }

.nav-rec-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  margin-top: 6px;
  background: #334155;
  color: #e2e8f0;
  font-size: 11px;
  cursor: pointer;
}

.nav-rec-action.muted { background: #1e293b; color: #94a3b8; }
.nav-rec-action.danger { background: #450a0a; color: #fca5a5; }

.nav-rec-empty {
  font-size: 11px;
  color: #64748b;
  line-height: 1.45;
  margin: 4px 0 8px;
  padding: 0 4px;
}

.nav-rec-archive {
  margin-top: 4px;
}

.nav-rec-archive.collapsed {
  display: none;
}
