/* ========================================
   Trim + Compose — essential styles for JS-rendered content
   Uses BeautifulGrids tokens, no dark theme
   ======================================== */

/* ---- Trim: playhead ---- */

.trim-playhead-flag {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: grab;
    touch-action: none;
    z-index: 10;
    transform: translateX(-50%);
}

.trim-playhead-flag::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 3px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid var(--color-accent, #f0c850);
}

.trim-playhead-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-accent, #f0c850);
    z-index: 3;
    left: 0;
    pointer-events: none;
}

/* ---- Trim: word editor ---- */

.trim-words {
    line-height: 2;
    min-height: 40px;
}

.trim-word, .trim-island {
    display: inline;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--color-text-primary, #1A1A1A);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    border: 1px solid transparent;
}

.trim-word:hover, .trim-island:hover {
    background: var(--color-bg-tertiary, #F3F4F6);
    border-color: var(--color-border, #E5E7EB);
}

.trim-word.filler, .trim-island.filler {
    color: #d4890a;
    border-bottom: 1px dashed #d4890a;
}

.trim-word.struck, .trim-island.struck {
    text-decoration: line-through;
    color: var(--color-text-muted, #9CA3AF);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

.trim-pause {
    display: inline-block;
    min-width: 8px;
    height: 16px;
    margin: 0 2px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 3px;
    vertical-align: middle;
    cursor: pointer;
    font-size: 0;
    transition: all 0.15s;
}

.trim-pause.long {
    background: rgba(239, 68, 68, 0.15);
    min-width: 16px;
}

.trim-pause.struck {
    background: rgba(239, 68, 68, 0.06);
    min-width: 4px;
}

.trim-pause:hover::after {
    content: attr(data-duration);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text-primary, #1A1A1A);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.trim-text-fallback {
    font-size: 14px;
    color: var(--color-text-secondary, #6B7280);
    text-align: center;
    line-height: 1.5;
}

/* Clip timeline */
.trim-clip-timeline {
    position: relative;
    height: 80px;
    background: var(--color-bg-secondary, #fff);
    border-radius: 6px;
    overflow: hidden;
}

.trim-clip-timeline.hidden { display: none; }
.trim-clip-timeline canvas { width: 100%; height: 100%; display: block; }

.clip-edge-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36px;
    margin-left: -18px;
    cursor: ew-resize;
    touch-action: none;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clip-edge-handle::after {
    content: '';
    width: 4px;
    height: 32px;
    background: var(--color-accent, #f0c850);
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(240, 200, 80, 0.3);
}

.trim-timecode {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
    font-size: 10px;
    color: var(--color-text-muted, #9CA3AF);
    font-family: inherit;
}

/* ---- Compose: card preview ---- */

.edit-carousel {
    flex: 1;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.edit-carousel::-webkit-scrollbar { display: none; }

.edit-card {
    flex: 0 0 100%;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.edit-card-preview {
    width: 100%;
    max-width: 380px;
    aspect-ratio: 9 / 16;
    background: var(--color-bg-tertiary, #F3F4F6);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.edit-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.5;
}

.edit-card-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transform: scaleX(-1);
}

.edit-card-title {
    position: absolute;
    z-index: 3;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    text-align: center;
    padding: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.7);
    cursor: grab;
}

.edit-card-caption {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--color-text-primary, #1A1A1A);
    border-radius: 6px;
    margin: 0 8px;
    cursor: grab;
}

.edit-card-caption.hidden { visibility: hidden; }

.edit-card-caption.caption-dark {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
}

.edit-card-caption.caption-light {
    background: rgba(255, 255, 255, 0.85);
    color: #111;
}

.edit-card-caption.caption-none {
    background: none;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.edit-card-caption.caption-karaoke {
    background: none;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.caption-word {
    display: inline;
    opacity: 0.4;
    font-size: 14px;
    transition: all 0.1s;
}

.caption-word-active {
    opacity: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-accent, #f0c850);
}

.edit-card-number {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.4);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

/* BG removal */
.edit-card-preview.bg-active .edit-card-video { opacity: 0; }

.edit-card-preview.bg-active {
    background-image:
        linear-gradient(45deg, #ddd 25%, transparent 25%),
        linear-gradient(-45deg, #ddd 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ddd 75%),
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: #eee;
}

.edit-card-preview.bg-active .edit-card-bg {
    z-index: 0;
    opacity: 1;
}

.bg-removal-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    display: none;
}

/* ---- Teleprompter words ---- */

.teleprompter-word {
    transition: color 0.2s, opacity 0.2s;
}

.teleprompter-word.upcoming {
    opacity: 0.4;
}

.teleprompter-word.active {
    color: var(--color-accent, #f0c850);
    opacity: 1;
    font-weight: 700;
}

.teleprompter-word.spoken {
    opacity: 0.25;
}

/* ---- Review takes ---- */

.review-swipe {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.review-takes-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
}

.review-takes-carousel::-webkit-scrollbar { display: none; }

.review-take {
    flex: 0 0 80%;
    scroll-snap-align: center;
    margin: 0 10%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--color-bg-secondary, #fff);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 12px;
}

.review-take.committed {
    border-color: var(--color-accent, #f0c850);
}

.review-take-indicator {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted, #9CA3AF);
    padding: 8px;
}

.review-take-video {
    width: 100%;
    max-height: 280px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--color-bg-tertiary, #F3F4F6);
    transform: scaleX(-1);
}

.review-take-text {
    font-size: 14px;
    color: var(--color-text-secondary, #6B7280);
    text-align: center;
    line-height: 1.5;
}

.review-take-duration {
    font-size: 13px;
    color: var(--color-text-muted, #9CA3AF);
}

/* ---- Review take details ---- */

.review-take-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-take-label {
    font-size: var(--font-size-label, 12px);
    font-weight: 600;
    color: var(--color-text-primary, #1A1A1A);
}

.review-take-badge {
    font-size: var(--font-size-micro, 9px);
    font-weight: 600;
    background: var(--color-accent, #f0c850);
    color: #111;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.review-take-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-take-waveform {
    height: 40px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    padding: 4px 0;
}

.review-take-waveform-bars {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 100%;
    width: 100%;
}

.waveform-bar {
    flex: 1;
    background: var(--color-accent, #f0c850);
    opacity: 0.4;
    border-radius: 1px 1px 0 0;
    min-width: 2px;
}

.review-take .btn-play-take {
    background: none;
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: var(--font-size-control, 11px);
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    align-self: flex-start;
}

.review-take .btn-play-take:hover {
    background: var(--color-bg-tertiary);
}

/* ---- Safe zone overlays (platform guides) ---- */

.safe-zone-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 4;
}
