/* Unfold — Editor Stylesheet */
/* Layout: fullscreen 3-column (layers + canvas + properties) */

/* ── Override: editor page escapa do content wrapper ─────────────── */

/* Quando tem .uf-editor-layout, o content perde padding e max-width */
.uf-content:has(.uf-editor-layout) {
    padding: 0;
    overflow: hidden;
}

.uf-content:has(.uf-editor-layout) .uf-content-wrapper {
    max-width: none;
    height: 100%;
}

/* Esconder topbar e brand-bar no modo editor para maximizar espaço */
body:has(.uf-editor-layout) .uf-topbar {
    display: none;
}

body:has(.uf-editor-layout) .uf-brand-bar {
    display: none;
}

/* Sidebar mais compacta no editor */
body:has(.uf-editor-layout) .uf-sidebar {
    width: 56px;
    min-width: 56px;
}

body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-logo-text,
body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-link span,
body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-user-info {
    display: none;
}

body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-logo {
    justify-content: center;
    padding: 0;
}

body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-link {
    justify-content: center;
    padding: 12px 0;
}

body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-footer {
    justify-content: center;
}

body:has(.uf-editor-layout) .uf-sidebar .uf-sidebar-user {
    justify-content: center;
}

/* ── Editor Layout ───────────────────────────────────────────────── */

.uf-editor-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Panels (left + right) ──────────────────────────────────────── */

.uf-editor-panel {
    width: 240px;
    min-width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--surface-header);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.uf-editor-properties {
    border-right: none;
    border-left: 1px solid var(--surface-header);
}

.uf-editor-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--surface-header);
}

.uf-editor-panel-header h3 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    margin: 0;
}

.uf-editor-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.uf-editor-panel-footer {
    padding: 8px;
    border-top: 1px solid var(--surface-header);
    display: flex;
    gap: 6px;
}

/* ── Layer Items ─────────────────────────────────────────────────── */

.uf-editor-layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 12px;
}

.uf-editor-layer-item:hover {
    background: var(--bg);
}

.uf-editor-layer-item.active {
    background: rgba(250, 176, 5, 0.08);
    border-left: 2px solid var(--primary);
}

.uf-editor-layer-icon {
    width: 22px;
    height: 22px;
    background: var(--bg);
    border: 1px solid var(--surface-header);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.uf-editor-layer-name {
    flex: 1;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uf-editor-layer-vis {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.4;
    transition: opacity 0.15s;
    padding: 2px;
}

.uf-editor-layer-vis:hover {
    opacity: 1;
}

/* ── Drag & Drop Layers ──────────────────────────────────────────── */

.uf-editor-layer-grip {
    cursor: grab;
    color: rgba(255,255,255,0.15);
    font-size: 11px;
    line-height: 1;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
    transition: color 0.15s;
    user-select: none;
}

.uf-editor-layer-item:hover .uf-editor-layer-grip {
    color: rgba(255,255,255,0.5);
}

.uf-editor-layer-item[draggable="true"] {
    cursor: default;
}

.uf-editor-layer-item.dragging {
    opacity: 0.25;
}

.uf-editor-layer-item.drag-over-above {
    box-shadow: inset 0 2px 0 0 var(--primary);
}

.uf-editor-layer-item.drag-over-below {
    box-shadow: inset 0 -2px 0 0 var(--primary);
}

/* ── Canvas Area ─────────────────────────────────────────────────── */

.uf-editor-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #2a2a2a;
    overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────────────── */

.uf-editor-toolbar {
    height: 44px;
    min-height: 44px;
    background: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.uf-editor-toolbar-left,
.uf-editor-toolbar-center,
.uf-editor-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uf-editor-toolbar-sep {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.12);
    margin: 0 4px;
}

.uf-editor-piece-info {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 8px;
}

.uf-editor-piece-info strong {
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.uf-editor-tool-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.6);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
}

.uf-editor-tool-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.uf-editor-zoom {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    font-family: 'JetBrains Mono', monospace;
    min-width: 40px;
    text-align: center;
}

/* ── Canvas Container ────────────────────────────────────────────── */

.uf-editor-canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
}

.uf-editor-canvas-container canvas {
    box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

/* ── Properties Panel ────────────────────────────────────────────── */

.uf-editor-prop-empty {
    text-align: center;
    padding: 24px 12px;
    font-size: 11px;
    color: var(--text-light);
}

.uf-editor-prop-section {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    padding: 10px 8px 4px;
    margin-top: 4px;
}

.uf-editor-prop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px;
}

.uf-editor-prop-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-light);
    min-width: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.uf-editor-prop-value {
    font-size: 12px;
    color: var(--text);
    flex: 1;
}

.uf-editor-prop-input,
.uf-editor-prop-select {
    flex: 1;
    padding: 4px 6px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--surface-header);
    outline: none;
}

.uf-editor-prop-input:focus,
.uf-editor-prop-select:focus {
    border-color: var(--primary);
}

.uf-editor-prop-textarea {
    width: 100%;
    padding: 6px;
    font-size: 11px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--surface-header);
    outline: none;
    resize: vertical;
    min-height: 60px;
}

.uf-editor-prop-textarea:focus {
    border-color: var(--primary);
}

.uf-editor-prop-color {
    width: 28px;
    height: 28px;
    border: 1px solid var(--surface-header);
    cursor: pointer;
    padding: 0;
    background: none;
}

/* ── Button sizes ────────────────────────────────────────────────── */

.uf-btn-sm {
    padding: 6px 14px;
    font-size: 10px;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .uf-editor-properties { display: none; }
}

@media (max-width: 900px) {
    .uf-editor-layers { display: none; }
}

/* ── Safe Zone Overlay ─────────────────────────────────────────── */

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

.uf-safe-zone-top,
.uf-safe-zone-bottom,
.uf-safe-zone-left,
.uf-safe-zone-right {
    position: absolute;
    background: rgba(255, 50, 50, 0.12);
    border: 0;
    box-sizing: border-box;
}

/* Dashed border on the safe edge (inner side) */
.uf-safe-zone-top    { border-bottom: 1px dashed rgba(255, 80, 80, 0.6); }
.uf-safe-zone-bottom { border-top: 1px dashed rgba(255, 80, 80, 0.6); }
.uf-safe-zone-left   { border-right: 1px dashed rgba(255, 80, 80, 0.6); }
.uf-safe-zone-right  { border-left: 1px dashed rgba(255, 80, 80, 0.6); }

.uf-safe-zone-label {
    position: absolute;
    top: 6px;
    right: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: rgba(255, 80, 80, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    letter-spacing: 0.3px;
}

/* Active state for the toggle button */
.uf-ws-tool-btn.active {
    color: #ff5050;
    background: rgba(255, 80, 80, 0.15);
}
