/* ═══════════════════════════════════════════════════════════════════
   StreamersForge — Scene Editor Styles
   Overlay slots on the scene canvas, add overlay modal,
   sidebar overlay list items.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Overlay Slots (on the scene canvas) ────────────────────── */

.overlay-slot {
    position: absolute;
    border: 2px solid var(--accent-primary, #646cff);
    border-radius: 6px;
    background: hsla(240, 50%, 50%, 0.08);
    cursor: move;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}

.overlay-slot:hover {
    border-color: var(--accent-hover, #818cf8);
    box-shadow: 0 0 0 1px var(--accent-hover, #818cf8);
}

.overlay-slot.selected {
    border-color: var(--accent-primary, #646cff);
    box-shadow: 0 0 0 2px var(--accent-primary, #646cff),
        inset 0 0 20px hsla(240, 60%, 60%, 0.08);
}

.overlay-slot.overlay-slot-hidden {
    opacity: 0.35;
    border-style: dashed;
}

.overlay-slot-label {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #a1a1aa);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 16px);
}


/* ─── Sidebar: Scene Overlay List Items ──────────────────────── */

.overlay-item.compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.overlay-item.compact:hover {
    background: var(--bg-hover, hsla(0, 0%, 100%, 0.04));
}

.overlay-item.compact.active {
    background: var(--bg-active, hsla(240, 60%, 50%, 0.12));
}

.overlay-item.compact.overlay-item-dimmed {
    opacity: 0.45;
}

.overlay-item-icon {
    flex-shrink: 0;
    color: var(--text-muted, #71717a);
}

.overlay-item-info {
    min-width: 0;
    flex: 1;
}

.overlay-item-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #e4e4e7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overlay-item-meta {
    font-size: 10px;
    color: var(--text-muted, #71717a);
}


/* ─── Add Overlay Modal ──────────────────────────────────────── */

.scene-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: hsla(0, 0%, 0%, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

.scene-modal {
    background: var(--bg-panel, #1e1e2e);
    border-radius: 12px;
    border: 1px solid var(--border-color, #27272a);
    width: 420px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px hsla(0, 0%, 0%, 0.5);
    animation: slideUpModal 0.2s ease-out;
}

.scene-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #27272a);
}

.scene-modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #e4e4e7);
    margin: 0;
}

.scene-modal-close {
    background: none;
    border: none;
    color: var(--text-muted, #71717a);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.scene-modal-close:hover {
    background: var(--bg-hover, hsla(0, 0%, 100%, 0.06));
    color: var(--text-primary, #e4e4e7);
}

.scene-modal-body {
    padding: 12px;
    overflow-y: auto;
}

.scene-overlay-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.15s;
}

.scene-overlay-item.selectable {
    cursor: pointer;
}

.scene-overlay-item.selectable:hover {
    background: var(--bg-hover, hsla(0, 0%, 100%, 0.06));
}

.scene-overlay-item-icon {
    flex-shrink: 0;
    color: var(--accent-primary, #646cff);
}

.scene-overlay-item-info {
    min-width: 0;
    flex: 1;
}

.scene-overlay-item-info strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary, #e4e4e7);
}

.scene-overlay-meta {
    font-size: 11px;
    color: var(--text-muted, #71717a);
}


/* ─── Animations ─────────────────────────────────────────────── */

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* --- Anchor Markers (on canvas) --- */

.anchor-marker {
    position: absolute;
    transform: translate(-8px, -8px);
    z-index: 9000;
    cursor: grab;
    user-select: none;
    pointer-events: auto;
}

.anchor-marker:hover,
.anchor-marker.selected {
    z-index: 9001;
}

.anchor-crosshair {
    width: 16px;
    height: 16px;
    color: #f5a623;
    opacity: 0.8;
    transition: opacity 0.15s, transform 0.15s;
}

.anchor-marker:hover .anchor-crosshair,
.anchor-marker.selected .anchor-crosshair {
    opacity: 1;
    transform: scale(1.25);
}

.anchor-label {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 600;
    color: #f5a623;
    background: hsla(40, 20%, 10%, 0.85);
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.anchor-marker.selected .anchor-label {
    background: #f5a623;
    color: #1a1a1a;
}


/* --- Alignment Grid (3x3) --- */

.alignment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 72px;
    padding: 2px;
    background: var(--bg-inset, hsla(0, 0%, 100%, 0.03));
    border-radius: 6px;
    border: 1px solid var(--border-color, #27272a);
}

.alignment-grid-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.12s;
    padding: 0;
}

.alignment-grid-btn:hover {
    background: hsla(0, 0%, 100%, 0.08);
}

.alignment-grid-btn.active {
    background: var(--accent-primary, #646cff);
}

.alignment-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted, #71717a);
    transition: background 0.12s;
}

.alignment-grid-btn.active .alignment-dot {
    background: #fff;
}

.alignment-grid-btn:hover .alignment-dot {
    background: var(--text-primary, #e4e4e7);
}


/* --- Anchor Group Headers (sidebar) --- */

.anchor-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 4px;
    font-size: 10px;
    font-weight: 700;
    color: #f5a623;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    user-select: none;
    border-bottom: 1px solid hsla(40, 50%, 50%, 0.15);
    margin-bottom: 2px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.anchor-group-header:hover {
    background: hsla(40, 50%, 50%, 0.06);
}

.anchor-group-header.selected {
    background: hsla(40, 50%, 50%, 0.1);
    border-left-color: #f5a623;
    color: #f5a623;
}

.anchor-group-header.drag-over {
    background: hsla(44, 90%, 50%, 0.12);
    border-left-color: #f5a623;
    outline: 1px dashed #f5a623;
    outline-offset: -1px;
}

.anchor-group-header .anchor-group-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.anchor-group-header .anchor-group-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.anchor-group-unanchored {
    color: #e67e22;
}

.anchor-group-unanchored .anchor-group-icon {
    opacity: 0.7;
}


/* --- Anchor Mode Cursor --- */

.anchor-mode-active {
    cursor: crosshair !important;
}

.anchor-mode-active * {
    cursor: crosshair !important;
}


/* --- Anchor Props Section --- */

.anchor-props-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.anchor-props-row select {
    flex: 1;
    min-width: 0;
}


/* --- Anchors Management List (in properties) --- */

.anchor-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.anchor-list-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    background: hsla(0, 0%, 100%, 0.03);
    font-size: 11px;
}

.anchor-list-item:hover {
    background: hsla(0, 0%, 100%, 0.06);
}

.anchor-list-item input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary, #e4e4e7);
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
}

.anchor-list-item input:focus {
    border-color: var(--accent-primary, #646cff);
    outline: none;
}

.anchor-list-item .anchor-coords {
    color: var(--text-muted, #71717a);
    font-size: 10px;
    white-space: nowrap;
}

.anchor-list-item .anchor-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted, #71717a);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.anchor-list-item:hover .anchor-delete-btn {
    opacity: 1;
}

.anchor-list-item .anchor-delete-btn:hover {
    color: var(--danger, #ef4444);
}