/* ATEM SuperSource Builder Styles */

:root {
    --canvas-bg: #1a1a1a;
    --box-1: #2ecc71;
    --box-2: #3498db;
    --box-3: #e67e22;
    --box-4: #9b59b6;
    --box-active: #ffffff;
    --guide-color: rgba(255, 255, 255, 0.15);
    /* Inherited or defined here for safety */
    --brand-cyan: #00f2ff;
    --border-color: #333;
    --bg-surface: #111;
}

.page-content {
    padding-top: 40px;
    padding-bottom: 80px;
}

.tool-header h1 {
    font-weight: 900;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #fff 0%, var(--brand-cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text {
    max-width: 900px;
    margin-bottom: 20px;
    color: var(--text-main);
    line-height: 1.7;
    font-size: 1.1rem;
}

/* Builder Layout Grid */
.builder-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin: 40px 0;
}

.builder-main {
    background: #0d0d0d;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Canvas Logic */
.canvas-container {
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    background: var(--canvas-bg);
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 2px solid #222;
    overflow: hidden;
}

.canvas {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Guides and Snapping */
.center-guides {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.guide-v, .guide-h {
    position: absolute;
    background: var(--guide-color);
}

.guide-v { width: 1px; height: 100%; left: 50%; top: 0; }
.guide-h { height: 1px; width: 100%; top: 50%; left: 0; }

.safe-areas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.safe-action, .safe-title {
    position: absolute;
    border: 1px dashed rgba(255,255,255,0.1);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.safe-action { width: 90%; height: 90%; }
.safe-title { width: 80%; height: 80%; }

.safe-action span, .safe-title span {
    position: absolute;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    top: 4px;
    left: 8px;
}

.hidden { opacity: 0; visibility: hidden; }

/* Draggable Boxes: Ghost Frame showing uncropped source */
.ss-box-ghost {
    position: absolute;
    border: 1px dashed rgba(255,255,255,0.08); /* Faint dashed line */
    pointer-events: none;
    z-index: 5;
}

/* Actual Visible/Active Clip Area */
.ss-box {
    position: absolute;
    border: 2px solid currentColor;
    background: rgba(255,255,255,0.05);
    cursor: move;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    user-select: none;
    transition: background 0.2s ease, border-width 0.1s ease;
    z-index: 10;
}

.ss-box.active {
    background: rgba(255,255,255,0.12);
    border-width: 3px;
    z-index: 100;
}

.ss-box .box-label {
    background: currentColor;
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Handles are now placed on the cropped corners but still part of logically resizing the box */
.handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    border: 2px solid #000;
    z-index: 110;
}

.handle.tl { top: -7px; left: -7px; cursor: nwse-resize; }
.handle.tr { top: -7px; right: -7px; cursor: nesw-resize; }
.handle.bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.handle.br { bottom: -7px; right: -7px; cursor: nwse-resize; }

/* Expanded Slider Group for Pos/Size/Crop */
.box-settings-card {
    border-left: 4px solid var(--box-color);
    background: #0d0d0d;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.param-item label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.param-item label span {
    color: var(--brand-cyan);
    font-family: var(--font-mono);
}

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

.crop-group-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #555;
    margin: 15px 0 10px 0;
    padding-top: 10px;
    border-top: 1px solid #222;
}

/* Export Area */
.export-section {
    margin-top: 50px;
    background: #0d0d0d;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.code-container {
    background: #050505;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
    border: 1px solid #222;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #d1d1d1;
    white-space: pre;
}

.import-instructions {
    margin-top: 25px;
    padding: 20px;
    background: rgba(0, 242, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid var(--brand-cyan);
}

.import-instructions h4 { margin-top: 0; color: var(--brand-cyan); }
.import-instructions li { margin-bottom: 8px; color: #aaa; }

/* Responsive */
@media (max-width: 1024px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .builder-main { padding: 15px; }
}
