/* Unfold — Workspace Stylesheet */
/* Bird's eye view of all pieces with pan+zoom + inline editing */

/* ── Override: workspace escapa do content wrapper ─────────────── */

.uf-content:has(.uf-workspace) {
    padding: 0;
    overflow: hidden;
}

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

body:has(.uf-workspace) .uf-topbar {
    display: none;
}

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

body:has(.uf-workspace) .uf-sidebar {
    width: 56px;
    min-width: 56px;
}

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

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

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

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

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

/* ── Workspace Layout ──────────────────────────────────────────── */

.uf-workspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #1a1a1a;
}

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

.uf-ws-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);
    z-index: 100;
}

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

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

.uf-ws-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.15s;
}

.uf-ws-back:hover {
    color: var(--primary);
}

.uf-ws-campaign-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

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

.uf-ws-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-ws-tool-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.uf-ws-tool-btn.active {
    border-color: #ff4444;
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.uf-ws-piece-count {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    font-family: 'JetBrains Mono', monospace;
}

/* ── Workspace Viewport (pan+zoom area) ────────────────────────── */

.uf-ws-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.uf-ws-viewport:active {
    cursor: grabbing;
}

/* ── Workspace Canvas (transformed container) ──────────────────── */

.uf-ws-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    padding: 80px;
}

/* ── Type Groups ───────────────────────────────────────────────── */

.uf-ws-type-group {
    margin-bottom: 80px;
}

.uf-ws-type-label {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.25);
    margin-bottom: 32px;
    padding-left: 4px;
    user-select: none;
}

.uf-ws-type-label span {
    font-weight: 400;
    font-size: 11px;
    color: rgba(255,255,255,0.15);
    margin-left: 8px;
    letter-spacing: 0;
    text-transform: none;
}

.uf-ws-frames-row {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ── Frame (individual piece) ──────────────────────────────────── */

.uf-ws-frame {
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s, opacity 0.25s ease;
    flex-shrink: 0;
}

.uf-ws-frame-canvas {
    background: #ffffff;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    overflow: hidden;
    position: relative;
}

.uf-ws-frame:hover .uf-ws-frame-canvas {
    border-color: var(--primary);
    box-shadow: 0 2px 20px rgba(250, 176, 5, 0.15);
}

.uf-ws-frame-canvas img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.uf-ws-frame-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Composed frame (green accent) ────────────────────────────────── */

.uf-ws-frame-composed {
    background: #1a2e1a !important;
    color: rgba(80, 220, 80, 0.5) !important;
    font-size: 9px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 500 !important;
}

.uf-ws-frame:has(.uf-ws-frame-composed) .uf-ws-frame-canvas {
    border-color: rgba(80, 220, 80, 0.4);
}

.uf-ws-frame:has(.uf-ws-frame-composed):hover .uf-ws-frame-canvas {
    border-color: rgba(80, 220, 80, 0.7);
    box-shadow: 0 2px 20px rgba(80, 220, 80, 0.15);
}

.uf-ws-frame-label {
    margin-top: 8px;
    text-align: center;
    user-select: none;
}

.uf-ws-frame-rg {
    font-size: 9px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

.uf-ws-frame-dims {
    font-size: 9px;
    color: rgba(255,255,255,0.3);
    font-family: 'JetBrains Mono', monospace;
}

.uf-ws-frame-name {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Lightbox dimming (non-editing pieces) ───────────────────── */

.uf-ws-dimmed {
    opacity: 0.15;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* ── Active Frame (editing in-place) ──────────────────────────── */

.uf-ws-frame.editing {
    cursor: default;
    z-index: 50;
}

.uf-ws-frame.editing .uf-ws-frame-canvas {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), 0 4px 40px rgba(250, 176, 5, 0.25);
    overflow: visible;
}

/* Mini toolbar that appears above the editing frame */
.uf-ws-frame-toolbar {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 4px 8px;
    white-space: nowrap;
    z-index: 60;
}

.uf-ws-frame.editing .uf-ws-frame-toolbar {
    display: flex;
}

/* ── Floating Panels (shown during in-place editing) ──────────── */

.uf-ws-float-panel {
    position: fixed;
    top: 52px;
    width: 220px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    z-index: 300;
    display: none;
    flex-direction: column;
}

.uf-ws-float-panel.visible {
    display: flex;
}

.uf-ws-float-panel-left {
    left: 68px;
}

.uf-ws-float-panel-right {
    right: 12px;
}

/* ── Fullscreen Editor Overlay (for granular editing) ─────────── */

.uf-ws-editor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.92);
    z-index: 500;
    flex-direction: column;
}

.uf-ws-editor-overlay.visible {
    display: flex;
}

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

.uf-ws-editor-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.uf-ws-editor-panel {
    width: 240px;
    min-width: 240px;
    background: var(--surface, #222);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.uf-ws-editor-panel-left {
    border-right: 1px solid rgba(255,255,255,0.08);
}

.uf-ws-editor-panel-right {
    border-left: 1px solid rgba(255,255,255,0.08);
}

.uf-ws-editor-canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    background: #2a2a2a;
    position: relative;
}

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

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

@media (max-width: 900px) {
    .uf-ws-editor-panel {
        display: none;
    }
    .uf-ws-float-panel {
        display: none !important;
    }
}
