/* ========================================
   Scene Cards — BeautifulGrids-aligned components
   Replaces old card-item/card-words/trim-handle system
   ======================================== */

/* ---- Scene card (glass-card variant) ---- */

.scene-card {
    overflow: hidden;
    margin-bottom: 0;
    transition: border-color 0.15s;
}

.scene-card.editing {
    border-color: var(--color-accent, #f0c850);
}

/* ---- Scene header — half-cell height row ---- */

.scene-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 4px;
    height: auto;
}

.scene-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-accent, #f0c850);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-label, 12px);
    font-weight: 700;
    flex-shrink: 0;
}

.scene-btn {
    background: none;
    border: none;
    color: var(--color-accent, #f0c850);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    flex-shrink: 0;
}

.scene-btn:hover {
    opacity: 0.7;
}

.scene-time {
    font-size: var(--font-size-caption, 10px);
    font-weight: 500;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.scene-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
}

.scene-thumb-empty {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px dashed var(--color-border);
    background: var(--color-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.scene-thumb-empty:hover {
    border-color: var(--color-text-secondary);
    color: var(--color-text-secondary);
}

.scene-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.scene-action-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: var(--font-size-control, 11px);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.1s, background 0.1s;
}

.scene-action-btn:hover {
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
}

/* ---- Scene body — flowing text ---- */

.scene-body {
    padding: 6px 12px 12px;
    line-height: 1.85;
    font-size: 16px;
    font-weight: 400;
    color: var(--color-text-primary);
    user-select: none;
    -webkit-user-select: none;
}

/* ---- Scene word (individual text unit) ---- */

.scene-word {
    display: inline;
    padding: 2px 1px;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 400;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    position: relative;
}

.scene-word:active {
    opacity: 0.7;
}

.scene-word.selected {
    background: var(--color-accent, #f0c850);
    color: #fff;
    border-radius: 3px;
    padding: 2px 2px;
}

.scene-empty {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: var(--font-size-sm, 14px);
}

/* ---- Drop cursors (during word drag) ---- */

.scene-word.drop-before::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 2px;
    bottom: 2px;
    width: 2px;
    background: var(--color-accent, #f0c850);
    border-radius: 1px;
}

.scene-word.drop-after::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 2px;
    bottom: 2px;
    width: 2px;
    background: var(--color-accent, #f0c850);
    border-radius: 1px;
}

/* ---- Scene divider (trim handle between cards) ---- */

.scene-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    cursor: ns-resize;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.scene-divider-line {
    position: absolute;
    left: 24px;
    right: 24px;
    height: 1px;
    background: var(--color-border);
    transition: background 0.15s;
}

.scene-divider-grip {
    width: 32px;
    height: 18px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--color-text-muted);
    z-index: 1;
    transition: background 0.15s, border-color 0.15s;
}

.scene-divider:active .scene-divider-line,
.scene-divider.active .scene-divider-line {
    background: var(--color-accent, #f0c850);
}

.scene-divider:active .scene-divider-grip,
.scene-divider.active .scene-divider-grip {
    background: var(--color-accent, #f0c850);
    border-color: var(--color-accent, #f0c850);
    color: #fff;
}

/* ---- Drag ghost (floating during word drag) ---- */

.drag-ghost {
    position: fixed;
    z-index: 1000;
    padding: 4px 10px;
    background: rgba(250, 250, 250, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translate(-50%, 0);
}

/* ---- Drag trash zone ---- */

.drag-trash {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 32px;
    background: rgba(239, 68, 68, 0.08);
    border: 2px dashed rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: var(--color-danger, #EF4444);
    font-size: var(--font-size-sm, 14px);
    font-weight: 600;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.drag-trash.hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--color-danger, #EF4444);
}

/* ---- Fullscreen card editor ---- */

.fullscreen-edit {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
}

.fullscreen-edit-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    height: var(--grid-cell, 30px);
    border-bottom: 1px solid var(--color-border);
}

.fullscreen-edit-textarea {
    flex: 1;
    padding: 16px;
    border: none;
    outline: none;
    resize: none;
    font-size: 16px;
    line-height: 1.85;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}
