/*
 * Editor-specific chrome for editor-brand-modal.html.
 * Covers the header, video background, timeline, and sidebar iframe.
 * Pair with assets/modal.css (reset + modal styles) and the DS tokens.css.
 */

body {
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  background: var(--color-bg-page);
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* HEADER + icon shells now live in assets/header.css (shared with player). */

/* ════════════════════════════════
   MAIN CONTENT AREA
════════════════════════════════ */
.content {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.preview-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 20px;
  background: #0a0a0a;
}

.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: #000000;
}
.preview-stage.branded {
  background: #1D8C98;
}

/* Window / screen recording — no explicit height so the video uses its
   natural aspect ratio; no letterbox bars, shadow follows actual content */
.preview-screen {
  position: absolute;
  top: 50%;
  left: 15%;
  width: 72%;
  transform: translateY(-50%);
  border-radius: 3px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* Person video — square crop, bottom-left */
.preview-pip {
  position: absolute;
  bottom: 6%;
  left: 2.5%;
  width: 19%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Airtime logo watermark — top-left teal area, hidden until brand is saved */
.preview-logo {
  display: none;
  position: absolute;
  top: 4%;
  left: 2.5%;
  height: 18px;
  width: auto;
  opacity: 0.9;
  pointer-events: none;
}
.preview-stage.branded .preview-logo { display: block; }

/* ════════════════════════════════
   TIMELINE (Figma Make — pixel-exact)
════════════════════════════════ */
.timeline-block {
  position: relative;
  background: var(--color-bg-chrome);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 100%;
  isolation: isolate;
}
.timeline-block::before {
  content: '';
  position: absolute;
  inset: 0;
  border-top: 1px solid var(--surface-overlay-1);
  pointer-events: none;
  z-index: 10;
}

.tl-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  width: 100%;
  z-index: 2;
}

.tl-group-left {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tl-group-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}
.tl-group-right {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tl-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.tl-icon-btn:hover { background: var(--surface-overlay-1); }
.tl-icon-btn.disabled,
.tl-btn.disabled { opacity: 0.3; cursor: default; }
.tl-icon-btn.disabled:hover { background: transparent; }

.tl-nav-pair { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.tl-divider {
  width: 9px;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  padding: 4px 4px;
  flex-shrink: 0;
}
.tl-divider > span {
  flex: 1 0 0;
  min-height: 1px;
  width: 1px;
  background: var(--surface-overlay-1);
}

.tl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: var(--font-weight-button-default);
  font-size: var(--font-size-button-default);
  line-height: var(--line-height-button-default);
  color: #ffffff;
  white-space: nowrap;
  font-variation-settings: 'wdth' 100;
  flex-shrink: 0;
}
.tl-btn:hover:not(.disabled):not(.tl-btn-primary):not(.tl-btn-glass) {
  background: var(--surface-overlay-1);
}

.tl-btn-glass {
  background: var(--surface-overlay-1);
  border: 1px solid var(--surface-overlay-1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tl-btn-glass:hover { background: var(--surface-overlay-2); }

.tl-btn-primary {
  background: var(--color-brand);
  color: #000000;
}
.tl-btn-primary:hover { background: var(--color-brand-hover); }

.tl-icon-16 {
  position: relative;
  width: 16px;
  height: 16px;
  overflow: hidden;
  flex-shrink: 0;
}
.tl-icon-16 > .i { position: absolute; }
.tl-icon-16 > .i svg { display: block; width: 100%; height: 100%; }
.i-trash  { inset: 7.29% 17.71% 15.62% 17.71%; }
.i-split  { inset: 18.75% 15.63% 18.75% 15.62%; }

.tl-icon-20 {
  position: relative;
  width: 20px;
  height: 20px;
  overflow: hidden;
  flex-shrink: 0;
}
.tl-icon-20 > .i { position: absolute; }
.tl-icon-20 > .i svg { display: block; width: 100%; height: 100%; }
.i-undo,
.i-redo   { inset: 18.75%; }
.i-search { inset: 12.5% 9.37% 9.38% 12.5%; }
.i-speed  { inset: 9.83% 9.38% 9.82% 6.25%; }

.tl-play-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.tl-play-icon {
  position: relative;
  width: 24px;
  height: 24px;
  overflow: hidden;
  flex-shrink: 0;
}
.tl-play-icon > .i {
  position: absolute;
  top: 21.79%;
  bottom: 21.79%;
  left: 25%;
  right: 25%;
}
.tl-play-icon > .i svg { display: block; width: 100%; height: 100%; }

.tl-play-glyph-pause { display: none; }
#tl-play[aria-pressed="true"] .tl-play-glyph-play  { display: none; }
#tl-play[aria-pressed="true"] .tl-play-glyph-pause { display: block; }

.tl-time {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: var(--font-weight-button-default);
  font-size: var(--font-size-button-default);
  line-height: var(--line-height-button-default);
  color: #ffffff;
  white-space: nowrap;
  font-variation-settings: 'wdth' 100;
  flex-shrink: 0;
}

.tl-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.tl-settings-btn:hover { background: var(--surface-overlay-1); }

.tl-canvas {
  position: relative;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding: 8px 0 16px 0;
  width: 100%;
  z-index: 1;
}

.tl-ruler {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 0 16px 0;
  width: 1440px;
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}
.tl-ruler-img {
  width: 1440px;
  height: 12px;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.tl-clips {
  display: flex;
  align-items: center;
  padding-left: 24px;
  gap: 1px;
  position: relative;
  width: 100%;
  z-index: 1;
}

.tl-track {
  background: rgba(255,255,255,0.05);
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  gap: 4px;
  height: 60px;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  position: relative;
}
.tl-frames {
  flex: 1 0 0;
  min-height: 0;
  display: flex;
  padding-top: 4px;
  width: 100%;
  position: relative;
}
.tl-frames-inner {
  flex: 1 0 0;
  min-width: 0;
  height: 100%;
  background-image: url('timeline-frames.png');
  background-size: 48.3453px 28px;
  background-repeat: repeat;
  background-position: top left;
}
.tl-waveform {
  height: 24px;
  width: 1416px;
  flex-shrink: 0;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.tl-clip {
  position: absolute;
  top: 0;
  left: 24px;
  width: 1416px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}
.tl-clip::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--color-brand);
  border-radius: 8px;
  pointer-events: none;
}
.tl-clip-thumb {
  height: 60px;
  width: 40px;
  position: relative;
  flex-shrink: 0;
}
.tl-clip-thumb.right svg { display: block; width: 100%; height: 100%; }
.tl-clip-thumb.left {
  transform: rotate(180deg);
}
.tl-clip-thumb.left svg { display: block; width: 100%; height: 100%; }

.tl-playhead {
  position: absolute;
  left: 109px;
  top: 8px;
  width: 15px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 3;
  pointer-events: none;
}
.tl-playhead svg { display: block; width: 100%; height: 100%; }

/* ════════════════════════════════
   SIDEBAR
════════════════════════════════ */
.sidebar {
  width: 384px;
  min-width: 384px;
  height: 100%;
  border-left: 1px solid rgba(255,255,255,0.07);
  background: var(--color-bg-page);
  overflow-y: auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
  color: #ffffff;
}

.sb-section {
  border-bottom: 1px solid var(--surface-overlay-soft);
  padding: 6px 0;
}
.sb-section:last-of-type { border-bottom: none; }
.sb-section > summary { list-style: none; }
.sb-section > summary::-webkit-details-marker { display: none; }

.sb-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  cursor: pointer;
  user-select: none;
  color: rgba(255,255,255,0.65);
}
.sb-section-head:hover { color: #ffffff; }

.sb-toggle {
  flex: 0 0 auto;
  width: 24px;
  height: 16px;
  border-radius: 10px;
  background: var(--color-highlight-primary);
  border: 1px solid var(--color-highlight-primary);
  cursor: pointer;
  position: relative;
  padding: 0;
  overflow: hidden;
  transition: background 150ms ease-out;
  box-sizing: border-box;
}
.sb-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translateX(0) translateY(-50%);
  transition: transform 150ms ease-out, background 150ms ease-out;
}
.sb-toggle-on {
  background: rgba(121,221,232,0.15);
}
.sb-toggle-on::after {
  background: #79DDE8;
  transform: translateX(8px) translateY(-50%);
}

.sb-section-title {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sb-chevron {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
  transition: transform 0.15s ease;
  transform: rotate(-90deg);
}
.sb-chevron svg { width: 12px; height: 12px; display: block; }
.sb-section[open] .sb-chevron { transform: rotate(0deg); }

/* Brand row — no toggle; label shows brand name or "No Brand",
   right button is Edit / + Add. */
.sb-section-brand .sb-section-head { cursor: default; }
.sb-section-brand .sb-section-head:hover { color: rgba(255,255,255,0.65); }
.sb-brand-label--empty { color: #ffffff; }

/* Layout only — appearance handled by .btn.btn-primary.btn-ghost */
.sb-brand-name {
  flex: 0 0 auto;
  margin: 0;
}

.sb-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 10px 26px;
}

.sb-chapter {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 0;
}
.sb-chapter-time {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  width: 32px;
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}
.sb-chapter-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sb-chapter-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}
.sb-chapter-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  line-height: 1.3;
}

.sb-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: rgba(255,255,255,0.7);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sb-action:hover {
  background: var(--surface-overlay-soft);
  color: #ffffff;
}
.sb-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  font-size: 14px;
  line-height: 1;
}
.sb-action-icon-refresh svg { width: 12px; height: 12px; display: block; }
