﻿/* Plotweave — Alysum Studio process / plot map (matches Note Graph chrome) */

:root {
    --pw-bg: #0b1220;
    --pw-panel: rgba(15, 23, 42, 0.94);
    --pw-border: rgba(255, 255, 255, 0.1);
    --pw-text: #f9fafb;
    --pw-muted: #9ca3af;
    --pw-accent: #a78bfa;
    --pw-select: #fbbf24;
    --pw-port: #c4b5fd;
    --pw-edge: rgba(196, 181, 253, 0.85);
    --pw-danger: #f87171;
    --pw-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(ellipse 120% 60% at 50% -10%, var(--theme-body-spot, rgba(124, 58, 237, 0.28)) 0%, transparent 55%),
        linear-gradient(180deg, #0d1426 0%, var(--pw-bg) 42%);
    color: var(--pw-text);
}

.pw-app {
    height: 100%;
    display: grid;
    grid-template-rows: 56px 1fr;
    min-height: 0;
}

.pw-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-bottom: 1px solid var(--pw-border);
    background: var(
        --theme-welcome-bar,
        var(--alysum-chrome-gradient, linear-gradient(135deg, #4c1d95, #7c3aed 45%, #ec4899))
    );
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    z-index: 20;
    min-width: 0;
}

.pw-toolbar-left,
.pw-toolbar-center,
.pw-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pw-toolbar-left { flex: 0 0 auto; }
.pw-toolbar-center { flex: 1 1 auto; justify-content: center; flex-wrap: wrap; }
.pw-toolbar-right { flex: 0 0 auto; margin-left: auto; }

.pw-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    font-weight: 900;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.pw-brand img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.pw-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.18);
    flex: 0 0 auto;
}

.pw-title-input {
    width: min(220px, 28vw);
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(2, 6, 23, 0.45);
    color: #f8fafc;
    font-family: inherit;
    font-size: 13px;
}

.pw-status {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
}

.pw-status.is-dirty { color: #fde68a; }
.pw-status.is-saved { color: #a7f3d0; }

.pw-btn {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.pw-btn:hover { background: rgba(255, 255, 255, 0.14); }
.pw-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pw-btn.is-active {
    background: rgba(124, 58, 237, 0.35);
    border-color: rgba(167, 139, 250, 0.45);
}

.pw-btn-primary {
    background: rgba(124, 58, 237, 0.45);
    border-color: rgba(167, 139, 250, 0.4);
}

.pw-btn-ghost { background: transparent; }

.pw-btn-danger {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.28);
}

.pw-workspace {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(220px, 280px);
    min-height: 0;
    overflow: hidden;
}

.pw-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--pw-panel);
}

.pw-side-left { border-right: 1px solid var(--pw-border); }
.pw-side-right { border-left: 1px solid var(--pw-border); }

.pw-side-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--pw-border);
    flex-shrink: 0;
}

.pw-side-head h2 {
    margin: 0;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.pw-side-body {
    flex: 1;
    overflow: auto;
    padding: 12px 14px;
    min-height: 0;
}

.pw-side-section + .pw-side-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--pw-border);
}

.pw-side-section h3 {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 800;
    color: var(--pw-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pw-map-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pw-map-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--pw-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.pw-map-item strong { font-size: 13px; }
.pw-map-item span { font-size: 11px; color: var(--pw-muted); }

.pw-map-item.is-active {
    border-color: rgba(167, 139, 250, 0.55);
    background: rgba(124, 58, 237, 0.18);
}

.pw-stencil {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pw-stencil-item {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.pw-stencil-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--pw-border);
}

.pw-stencil-item.is-active {
    background: rgba(124, 58, 237, 0.22);
    border-color: rgba(167, 139, 250, 0.45);
}

.pw-stencil-glyph {
    width: 52px;
    height: 34px;
    border: 1px solid var(--pw-border);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pw-stencil-glyph svg { width: 44px; height: 26px; }

.pw-hint {
    margin: 0;
    font-size: 11px;
    line-height: 1.45;
    color: var(--pw-muted);
}

.pw-stage-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at center, rgba(124, 58, 237, 0.1) 0%, rgba(2, 6, 23, 0.92) 72%),
        #020617;
}

.pw-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.pw-empty.is-hidden { display: none; }

.pw-empty-card {
    max-width: 380px;
    padding: 20px 24px;
    border-radius: 14px;
    border: 1px solid var(--pw-border);
    background: rgba(15, 23, 42, 0.92);
    box-shadow: var(--pw-shadow);
    text-align: center;
    pointer-events: auto;
}

.pw-empty-card h3 { margin: 0 0 8px; }
.pw-empty-card p { margin: 0; color: var(--pw-muted); font-size: 14px; line-height: 1.5; }

.pw-stage {
    display: block;
    width: 100%;
    height: 100%;
    cursor: default;
    outline: none;
}

.pw-stage[data-tool="pan"] { cursor: grab; }
.pw-stage[data-tool="pan"]:active { cursor: grabbing; }
.pw-stage[data-tool="place"] { cursor: crosshair; }

.pw-viewbar {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid var(--pw-border);
    background: rgba(15, 23, 42, 0.92);
    z-index: 3;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.pw-text-drawer {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: 56px;
    width: min(340px, 46vw);
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--pw-border);
    background: rgba(15, 23, 42, 0.97);
    box-shadow: -10px 0 32px rgba(0, 0, 0, 0.45);
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.pw-text-drawer.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.pw-text-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.pw-text-drawer-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--pw-text);
}

.pw-text-drawer-head .pw-hint {
    margin: 4px 0 0;
    font-size: 12px;
}

.pw-text-drawer-input {
    flex: 1;
    min-height: 200px;
    width: 100%;
    resize: vertical;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--pw-border);
    background: rgba(2, 6, 23, 0.85);
    color: var(--pw-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
}

.pw-text-drawer-input:focus {
    outline: none;
    border-color: rgba(167, 139, 250, 0.55);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.25);
}

.pw-zoom-label {
    min-width: 44px;
    text-align: center;
    font-size: 12px;
    color: var(--pw-muted);
    font-weight: 700;
}

.pw-props-empty {
    margin: 0;
    font-size: 13px;
    color: var(--pw-muted);
    line-height: 1.5;
}

.pw-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.pw-field label {
    font-size: 10px;
    font-weight: 800;
    color: var(--pw-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pw-field input,
.pw-field textarea,
.pw-field select {
    padding: 8px 10px;
    border: 1px solid var(--pw-border);
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.55);
    color: #f8fafc;
    font: inherit;
    font-size: 13px;
}

.pw-field textarea { min-height: 72px; resize: vertical; }

.pw-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pw-shortcuts {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--pw-border);
}

.pw-label-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.pw-label-pill {
    padding: 4px 10px;
    border: 1px solid var(--pw-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.pw-label-pill:hover {
    border-color: rgba(167, 139, 250, 0.45);
    background: rgba(124, 58, 237, 0.22);
}

.pw-color-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    max-height: 168px;
    overflow-y: auto;
    padding-right: 2px;
}

.pw-color-swatch {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    min-height: 32px;
}

.pw-color-swatch:hover { border-color: rgba(167, 139, 250, 0.45); }
.pw-color-swatch.is-active { border-color: var(--pw-select); box-shadow: 0 0 0 1px var(--pw-select); }

.pw-color-swatch-fill,
.pw-color-swatch-stroke {
    display: block;
    height: 14px;
    width: 100%;
}

.pw-field input[type="color"] {
    height: 36px;
    padding: 2px;
    cursor: pointer;
}

/* SVG elements */
.pw-node-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
    fill: #f9fafb;
    pointer-events: none;
    user-select: none;
}

.pw-port {
    fill: var(--pw-port);
    stroke: #312e81;
    stroke-width: 1;
    cursor: crosshair;
    opacity: 0;
}

.pw-node.is-selected .pw-port,
.pw-node:hover .pw-port { opacity: 1; }

.pw-handle {
    fill: #fff;
    stroke: var(--pw-select);
    stroke-width: 1.5;
    cursor: nwse-resize;
}

.pw-edge-label-bg {
    fill: rgba(15, 23, 42, 0.92);
    stroke: var(--pw-border);
    stroke-width: 1;
}

.pw-edge-label-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 11px;
    fill: #e9d5ff;
    font-weight: 700;
}

.pw-edge { cursor: pointer; }

/* New map template picker */
body.pw-modal-open { overflow: hidden; }

.pw-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pw-modal[hidden] { display: none; }

.pw-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
}

.pw-modal-panel {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(84vh, 720px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--pw-border);
    border-radius: 14px;
    background: var(--pw-panel);
    box-shadow: var(--pw-shadow);
    overflow: hidden;
}

.pw-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--pw-border);
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.12) 0%, transparent 100%);
}

.pw-modal-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.pw-modal-body {
    flex: 1;
    overflow: auto;
    padding: 14px 18px 18px;
}

.pw-template-group + .pw-template-group {
    margin-top: 16px;
}

.pw-template-cat {
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pw-muted);
}

.pw-template-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.pw-template-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 12px 10px;
    border: 1px solid var(--pw-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.pw-template-card:hover {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(124, 58, 237, 0.16);
}

.pw-template-card.is-blank {
    border-style: dashed;
}

.pw-template-card strong {
    font-size: 13px;
    font-weight: 800;
}

.pw-template-card span {
    font-size: 11px;
    line-height: 1.4;
    color: var(--pw-muted);
}

.pw-template-card em {
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    color: var(--pw-accent);
    margin-top: 2px;
}

@media (max-width: 960px) {
    .pw-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .pw-side-right {
        border-left: none;
        border-top: 1px solid var(--pw-border);
    }
}
