/* =============================================================================
   Scene Editor Page Styles
   ============================================================================= */

/* Scene Editor - Video Gallery Style */
.editor-page {
    overflow: hidden;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px); /* Account for nav bar height */
    padding: 2rem;
    max-width: none;
}

.editor-header {
    padding-bottom: 1rem;
    margin-bottom: 0;
    width: 100%;
    border-bottom: none;
}

.editor-header .scene-filter-bar {
    margin-bottom: 0;
    width: 100%;
}

.scene-count {
    color: var(--text-secondary);
    font-size: 1rem;
}

.btn-add-scene {
    background: var(--accent);
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-scene:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.editor-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    margin-top: 1.5rem;
    grid-template-columns: none;
    gap: 0;
    min-height: auto;
}

/* Scene Gallery Grid - Uses unified spa-card component */
.scene-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    flex: 1;
    overflow-y: auto;
    padding-top: 4px; /* Space for card outline/focus ring */
    padding-right: 1rem;
    padding-bottom: 1rem;
    align-content: start;
}

/* Thumbnail placeholder for scenes without images */
.scene-gallery .thumbnail-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--bg-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

/* Edit overlay on hover */
.edit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.spa-card:hover .edit-overlay,
.spa-card:focus .edit-overlay {
    opacity: 1;
}

.edit-icon {
    width: 50px;
    height: 50px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

/* Panel backdrop for click-outside-to-close */
.editor-page .panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99;
}

.editor-page .panel-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* Scene Editor Panel (slide-in overlay) */
.scene-editor-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50%;
    max-width: 600px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scene-editor-panel.open {
    transform: translateX(0);
}

/* Panel Header */
.scene-editor-panel .panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-header .scene-name-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 500;
    padding: 0.25rem 0;
    outline: none;
    min-width: 0;
}

.panel-header .scene-name-input:focus {
    border-bottom-color: var(--accent);
}

.panel-header .scene-name-input::placeholder {
    color: var(--text-muted);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-actions .btn-icon {
    background: var(--bg-light);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.header-actions .btn-icon:hover {
    background: var(--border);
    color: var(--text-primary);
}

.header-actions .btn-icon.btn-delete {
    color: #e57373;
}

.header-actions .btn-icon.btn-delete:hover {
    background: var(--danger);
    color: white;
}

.header-actions .btn-save {
    background: #4caf50;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease;
}

.header-actions .btn-save:hover {
    background: #43a047;
}

.header-actions .btn-save svg,
.header-actions .btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Panel Content */
.scene-editor-panel .panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Form sections */
.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid.single {
    grid-template-columns: 1fr;
}

.form-grid.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Inline volume control for three-column layout */
.volume-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-inline input[type="range"] {
    flex: 1;
    min-width: 0;
}

.volume-inline .volume-value {
    font-size: 0.75rem;
    min-width: 32px;
    text-align: right;
}

.input-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-field label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-field input,
.form-field select {
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Volume sliders */
.volume-sliders {
    display: flex;
    gap: 1.5rem;
}

.volume-slider {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.volume-slider label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.volume-slider input[type="range"] {
    width: 100%;
}

.volume-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Footer */
.editor-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* Video Selectors */
.video-selectors {
    display: flex;
    gap: 1rem;
}

.video-selector {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.video-selector-thumb {
    position: relative;
    width: 100%;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    transition: border-color 0.2s, transform 0.2s;
}

.video-selector-thumb:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

.video-selector-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumb-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    pointer-events: none;
}

.video-thumb-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-family: monospace;
}

.video-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.video-filename {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Compact volume row (inside video selector column) */
.volume-row-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.volume-row-compact label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.volume-row-compact input[type="range"] {
    flex: 1;
    min-width: 0;
}

.volume-row-compact .volume-value {
    font-size: 0.7rem;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: right;
}

/* Form section without divider */
.form-section.no-divider {
    border-bottom: none;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Form section with divider before */
.form-section.divider-before {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .scene-editor-panel {
        width: 60%;
    }
}

@media (max-width: 900px) {
    .scene-editor-panel {
        width: 100%;
        max-width: none;
    }
    .scene-gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}
