/* ============================================
   DIFFUSION CANVAS — v1.0
   UI System 2.0 // 2026-03-18 // 48°12'N 16°22'E
   ============================================ */

:root {
    --bg:           #F2F2F2;
    --surface:      #FFFFFF;
    --text:         #111111;
    --text-muted:   #777777;
    --border:       #111111;
    --border-light: #CCCCCC;
    --accent:       #FF4500;
    --font-sans:    'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-mono:    'Roboto Mono', 'Courier New', Courier, monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

/* ============ CANVAS CONTAINER ============ */

.canvas-container {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
    background-image:
        radial-gradient(circle, rgba(0,0,0,0.22) 1px, transparent 1px),
        radial-gradient(circle, rgba(0,0,0,0.08) 0.5px, transparent 0.5px);
    background-size: 80px 80px, 16px 16px;
}

#connectionCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: auto;
    z-index: 1;
    transform-origin: 0 0;
    background: transparent;
}

.node-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* ============ CANVAS TITLE (TOP LEFT) ============ */

.canvas-title {
    position: absolute;
    top: 0; left: 0;
    font-family: var(--font-sans);
    pointer-events: none;
    z-index: 1001;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px 12px;
    line-height: 1;
}

.canvas-title > div:first-child {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: -0.03em;
}

.canvas-title > div:nth-child(2) {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-top: 5px;
}

.canvas-credit {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.canvas-credit a {
    color: var(--text-muted);
    text-decoration: underline;
    pointer-events: auto;
    cursor: pointer;
}

.canvas-credit a:hover {
    color: var(--accent);
}

/* ============ CANVAS CONTROLS (TOP RIGHT) ============ */

.canvas-controls {
    position: absolute;
    top: 0; right: 0;
    display: flex;
    align-items: stretch;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    z-index: 1000;
}

/* ============ THEME TOGGLE ============ */

.theme-toggle {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-light);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text);
    line-height: 1;
    transition: background 0.1s, color 0.1s;
}

.theme-toggle:hover {
    background: var(--text);
    color: var(--surface);
}

.theme-icon {
    color: inherit;
}

/* ============ TOOLBAR OVERLAY ============ */

.toolbar-overlay {
    position: absolute;
    top: 62px;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 999;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: move;
    user-select: none;
    min-width: 176px;
}

/* Toolbar section label */
.toolbar-overlay::before {
    content: '01 — NODES';
    display: block;
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    pointer-events: none;
    cursor: default;
}

.toolbar-overlay::after {
    content: none;
}

/* ============ BUTTONS ============ */

.btn {
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
    letter-spacing: 0.04em;
    transition: background 0.1s, color 0.1s;
    border-radius: 0;
}

.btn:last-child {
    border-bottom: none;
}

.btn:hover, .btn.active {
    background: var(--text);
    color: var(--surface);
}

.btn:disabled {
    color: var(--border-light);
    cursor: not-allowed;
    background: var(--surface);
}

.btn:disabled:hover {
    background: var(--surface);
    color: var(--border-light);
}

.btn-section-start {
    border-top: 1px solid var(--border);
}

.btn-danger {
    color: var(--accent);
    background: var(--surface);
}

.btn-danger:hover {
    background: var(--accent);
    color: #fff;
}

/* Toolbar section divider */
.toolbar-overlay > [style*="border-top"] {
    border-top: 1px solid var(--border) !important;
    border-color: var(--border) !important;
    margin: 0 !important;
    height: 0;
}

/* ============ STATUS BAR (BOTTOM CENTER) ============ */

.status {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 6px 20px;
    min-width: 220px;
    text-align: center;
}

/* ============ NODES ============ */

.node {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0;
    min-width: 240px;
    cursor: move;
    user-select: none;
    pointer-events: auto;
    border-radius: 0;
}

/* Image & result nodes: wider default, no extra chrome */
.image-node,
.result-node {
    min-width: 220px;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

/* Image/result nodes get a minimal 20px drag strip; label fades in on hover */
.image-node .node-header,
.result-node .node-header {
    padding: 3px 6px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
    opacity: 0.4;
    transition: opacity 0.15s;
}

.image-node:hover .node-header,
.result-node:hover .node-header {
    opacity: 1;
}

.node-title {
    font-weight: 500;
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.node-close {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    font-size: 9px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    flex-shrink: 0;
}

.node-close:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.clear-button {
    position: absolute;
    top: 3px;
    right: 26px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: 0;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 8px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.1s;
}

.clear-button:hover {
    background: var(--text);
    color: var(--surface);
    border-color: var(--text);
}

.node-content {
    padding: 10px;
}

/* ── IMAGE NODE ── */

/* Image/result node-content has no padding — image fills edge to edge */
.image-node .node-content,
.result-node .node-content {
    padding: 0;
    position: relative;
}

.image-node .drop-zone {
    border: 1px dashed var(--border-light);
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 9px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: var(--bg);
    transition: all 0.1s;
    margin: 8px;
}

.image-node .drop-zone:hover,
.image-node .drop-zone.drag-over {
    border-color: var(--text);
    border-style: solid;
    background: var(--surface);
    color: var(--text);
}

.image-node .image-wrapper,
.result-node .image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: block;
    line-height: 0; /* remove gap below inline img */
}

.image-node img,
.result-node img {
    width: 100%;
    display: block;
    border: none;
    border-radius: 0;
}

/* Legacy .image-controls (kept for compat) */
.image-controls {
    display: none;
}

/* ── PROMPT NODE ── */

/* Node itself stretches vertically; flex column keeps actions pinned to bottom */
.prompt-node {
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

.prompt-node .node-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0; /* allow shrink inside flex parent */
}

.prompt-node textarea {
    flex: 1;
    width: 100%;
    min-height: 80px;
    padding: 10px 10px 8px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: 12px;
    resize: none; /* node handle controls size */
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-y: auto;
    display: block;
}

.prompt-node textarea:focus {
    outline: none;
    background: var(--surface);
}

/* Custom scrollbar — thin, flat, blueprint */
.prompt-node textarea::-webkit-scrollbar {
    width: 3px;
}
.prompt-node textarea::-webkit-scrollbar-track {
    background: var(--bg);
}
.prompt-node textarea::-webkit-scrollbar-thumb {
    background: var(--border-light);
}
.prompt-node textarea::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}

/* Char / word counter row */
.prompt-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
    flex-shrink: 0;
}

.prompt-char-count {
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Clone button inside prompt-meta — tiny */
.prompt-clone-btn {
    flex: unset !important;
    padding: 3px 7px !important;
    font-size: 11px !important;
    border: 1px solid var(--border-light) !important;
    background: var(--surface) !important;
    color: var(--text-muted) !important;
}

.prompt-clone-btn:hover {
    background: var(--text) !important;
    color: var(--surface) !important;
}

/* ── SELECTS ── */

.aspect-ratio-select,
.model-select {
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    margin-bottom: 0;
    -webkit-appearance: none;
    appearance: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.aspect-ratio-select option,
.model-select option {
    background: var(--surface);
    color: var(--text);
    text-transform: none;
}

.aspect-ratio-select:focus,
.model-select:focus {
    outline: none;
    border-color: var(--text);
}

.action-node select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-light);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.action-node select option {
    background: var(--surface);
    color: var(--text);
    text-transform: none;
}

.action-node select:focus {
    outline: none;
    border-color: var(--text);
}

.action-node {
    border-color: var(--border);
    background: var(--surface);
}

.action-node .node-title {
    color: var(--text);
}

/* ── NODE ACTIONS ── */

.node-actions {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
    border: 1px solid var(--border-light);
}

.model-indicator {
    font-size: 8px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-light);
}

.node-btn {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all 0.1s;
    text-align: left;
    border-radius: 0;
}

.node-btn:last-child {
    border-bottom: none;
}

.node-btn:hover {
    background: var(--text);
    color: var(--surface);
}

.node-btn:disabled {
    color: var(--border-light);
    cursor: not-allowed;
    background: var(--surface);
}

/* ── CONNECTION POINTS ── */

.connection-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--text);
    border: 2px solid var(--surface);
    border-radius: 50%;
    cursor: crosshair;
    z-index: 10;
    transition: background 0.1s, transform 0.1s;
}

.connection-point.input {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point.output {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-point:hover {
    background: var(--accent);
    transform: translateY(-50%) scale(1.5);
}

/* ── RESULT NODE ── */

.result-node {
    border-color: var(--border);
    background: var(--surface);
}

.result-node .node-title {
    color: var(--text);
}

/* ── DRAW NODE ── */

.draw-node {
    border-color: var(--border);
    background: var(--surface);
}

.draw-node .node-title {
    color: var(--text);
}

.draw-canvas-wrapper {
    position: relative;
    background: #fff;
    border: 1px solid var(--border-light);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.draw-canvas {
    display: block;
    cursor: crosshair;
}

.draw-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.draw-tools {
    display: flex;
    gap: 0;
    align-items: center;
    border: 1px solid var(--border-light);
}

.draw-tool-btn {
    padding: 6px 10px;
    background: var(--surface);
    border: none;
    border-right: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 8px;
    font-family: var(--font-mono);
    transition: all 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.draw-tool-btn:last-of-type {
    border-right: none;
}

.draw-tool-btn.active {
    background: var(--text);
    color: var(--surface);
}

.draw-tool-btn:hover:not(.active) {
    background: var(--bg);
    color: var(--text);
}

.draw-color-picker {
    width: 30px;
    height: 28px;
    border: 1px solid var(--border-light);
    border-radius: 0;
    cursor: pointer;
    background: #000;
    padding: 2px;
}

.draw-size-slider {
    flex: 1;
    min-width: 60px;
    height: 28px;
    background: transparent;
    border: none;
    padding: 0 8px;
    cursor: pointer;
    accent-color: var(--text);
}

.draw-size-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 1px;
    background: var(--border-light);
}

.draw-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 8px;
    background: var(--text);
    cursor: pointer;
    border-radius: 50%;
    margin-top: -4px;
}

.draw-size-slider::-moz-range-track {
    width: 100%;
    height: 1px;
    background: var(--border-light);
}

.draw-size-slider::-moz-range-thumb {
    width: 8px;
    height: 8px;
    background: var(--text);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

/* ============ LOADING SPINNER ============ */

.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px solid var(--border-light);
    border-top: 1px solid var(--text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============ MINIMAP ============ */

.minimap {
    position: absolute;
    bottom: 0; right: 0;
    width: 220px;
    height: 165px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    overflow: hidden;
    z-index: 1000;
}

.minimap::before {
    content: '02 — MINIMAP';
    position: absolute;
    top: 6px; left: 8px;
    font-family: var(--font-mono);
    font-size: 7px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    z-index: 2;
    pointer-events: none;
}

.minimap::after {
    content: 'v1.0';
    position: absolute;
    top: 6px; right: 8px;
    font-family: var(--font-mono);
    font-size: 7px;
    color: var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 2;
    pointer-events: none;
}

.minimap-canvas {
    width: 100%;
    height: 100%;
}

.minimap-viewport {
    position: absolute;
    border: 1px solid var(--accent);
    background: rgba(255, 69, 0, 0.04);
    pointer-events: none;
}

/* ============ ZOOM CONTROLS (BOTTOM LEFT) ============ */

.zoom-controls {
    position: absolute;
    bottom: 0; left: 0;
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    z-index: 1000;
}

.zoom-btn {
    padding: 9px 13px;
    background: var(--surface);
    border: none;
    border-right: 1px solid var(--border-light);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-mono);
    transition: all 0.1s;
    border-radius: 0;
    line-height: 1;
}

.zoom-btn:hover {
    background: var(--text);
    color: var(--surface);
}

.zoom-level {
    padding: 9px 12px;
    color: var(--text-muted);
    font-size: 9px;
    font-family: var(--font-mono);
    min-width: 52px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-right: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ LIGHTBOX ============ */

.lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(242, 242, 242, 0.97);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    cursor: zoom-out;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 0;
}

/* ============ SCALE INDICATOR / IMAGE ACTIONS — hover overlays ============ */

/* Dimension badge — top-right corner of image, appears on hover */
.scale-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 7px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #fff;
    background: rgba(17,17,17,0.75);
    padding: 2px 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
}

.node:hover .scale-indicator {
    opacity: 1;
}

/* Action bar — slides up from bottom of image on hover */
.image-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
    pointer-events: none;
}

.node:hover .image-actions {
    opacity: 1;
    pointer-events: auto;
}

.icon-btn {
    flex: 1;
    padding: 7px 6px;
    background: rgba(17,17,17,0.82);
    border: none;
    border-right: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
    border-radius: 0;
    text-align: center;
    backdrop-filter: none;
}

.icon-btn:last-child {
    border-right: none;
}

.icon-btn:hover {
    background: rgba(255,69,0,0.9);
}

/* ============ RESIZE HANDLE ============ */

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--border-light);
    border: 1px solid var(--text);
    cursor: nwse-resize;
    z-index: 15;
    right: -1px;
    bottom: -1px;
    border-radius: 0;
    transition: background 0.1s;
}

.resize-handle:hover {
    background: var(--text);
}

/* ============ CONTEXT MENU ============ */

.context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0;
    z-index: 10001;
    display: none;
    min-width: 180px;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 9px 14px;
    font-size: 9px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:hover {
    background: var(--text);
    color: var(--surface);
}

.context-menu-item.disabled {
    color: var(--border-light);
    cursor: not-allowed;
}

.context-menu-item.disabled:hover {
    background: transparent;
    color: var(--border-light);
}

/* ============ PASSWORD MODAL ============ */

.password-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(242, 242, 242, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
}

.password-modal.hidden {
    display: none;
}

.password-container {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 40px;
    max-width: 400px;
    width: 90%;
}

.password-container h2 {
    color: var(--text);
    font-size: 12px;
    font-family: var(--font-mono);
    margin-bottom: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.password-container p {
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
    margin-bottom: 24px;
}

.password-container input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    margin-bottom: 16px;
}

.password-container input:focus {
    outline: none;
    border-color: var(--text);
}

.password-container button {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--text);
    color: var(--surface);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: all 0.1s;
}

.password-container button:hover {
    background: #333;
}

.password-error {
    color: var(--accent);
    font-size: 10px;
    font-family: var(--font-mono);
    margin-top: 10px;
    min-height: 18px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ============ USER INFO ============ */

.user-info {
    position: fixed;
    top: 20px;
    right: 80px;
    display: none !important;
}

.user-info-inline {
    display: flex;
    align-items: stretch;
    background: transparent;
}

.user-info-inline > * {
    border-left: 1px solid var(--border-light);
    padding: 9px 12px;
    display: flex;
    align-items: center;
}

.user-menu-btn {
    padding: 9px 14px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-light);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.1s;
    display: flex;
    align-items: center;
}

.user-menu-btn:hover {
    background: var(--text);
    color: var(--surface);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0;
    min-width: 200px;
    display: none;
    z-index: 1001;
}

.user-dropdown.active {
    display: block;
}

.user-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 9px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background: var(--text);
    color: var(--surface);
}

.user-dropdown-item.danger:hover {
    background: var(--accent);
    color: #fff;
}

.user-info-wrapper {
    position: relative;
}

.user-photo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
}

.user-info span,
.user-info-inline span {
    color: var(--text);
    font-size: 10px;
    font-family: var(--font-mono);
}

.user-credits {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-link {
    background: transparent;
    color: var(--text);
    text-decoration: none;
    font-size: 9px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: color 0.1s;
}

.admin-link:hover {
    color: var(--accent);
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 9px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: color 0.1s;
}

.logout-btn:hover {
    color: var(--accent);
}

/* ============ COOKIE NOTICE ============ */

.cookie-notice {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    z-index: 100001;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.cookie-notice.active {
    transform: translateY(0);
}

.cookie-notice-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
}

.cookie-notice-text {
    flex: 1;
    min-width: 300px;
}

.cookie-notice-text h3 {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.cookie-notice-text p {
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.cookie-notice-small {
    font-size: 9px !important;
    color: var(--text-muted) !important;
}

.cookie-notice-text a {
    color: var(--text);
    text-decoration: underline;
}

.cookie-notice-text a:hover {
    color: var(--accent);
}

.cookie-notice-actions {
    display: flex;
    gap: 0;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.cookie-btn {
    padding: 10px 24px;
    border: none;
    border-right: 1px solid var(--border-light);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: all 0.1s;
    white-space: nowrap;
    border-radius: 0;
}

.cookie-btn:last-child {
    border-right: none;
}

.cookie-btn-accept {
    background: var(--text);
    color: var(--surface);
}

.cookie-btn-accept:hover {
    background: #333;
}

.cookie-btn-decline {
    background: var(--surface);
    color: var(--text-muted);
}

.cookie-btn-decline:hover {
    background: var(--bg);
    color: var(--text);
}

/* ============ LOGIN MODAL ============ */

.login-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: var(--surface);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    padding: 20px;
}

.login-modal.hidden {
    display: none;
}

.login-container {
    background: var(--surface);
    border: 1px solid var(--border);
    max-width: 580px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.login-hero {
    padding: 40px 40px 32px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

/* Technical coordinate micro-data */
.login-hero::after {
    content: '48°12\'N // 16°22\'E';
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-family: var(--font-mono);
    font-size: 7px;
    color: var(--border-light);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.login-headline {
    font-family: var(--font-sans);
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.login-headline i {
    font-style: normal;
    font-size: 11px;
    font-weight: 400;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    display: block;
    margin-top: 16px;
    line-height: 1.5;
}

.local-login-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
}

.form-group {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-light);
}

.form-group:last-of-type {
    border-bottom: none;
}

.form-group label {
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    padding: 10px 20px 4px;
}

.form-group input {
    padding: 6px 20px 12px;
    border: none;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text);
    background: transparent;
}

.form-group input:focus {
    outline: none;
    background: var(--bg);
}

.login-btn {
    padding: 15px 20px;
    background: var(--text);
    color: var(--surface);
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    cursor: pointer;
    transition: background 0.1s;
    width: 100%;
    text-align: center;
}

.login-btn:hover {
    background: #333;
}

.login-error {
    color: var(--accent);
    font-size: 9px;
    font-family: var(--font-mono);
    text-align: center;
    min-height: 18px;
    padding: 8px 20px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-separator {
    display: flex;
    align-items: center;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    padding: 0 20px;
}

.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
}

.login-separator span {
    padding: 12px 16px;
    font-size: 8px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 15px 20px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.1s;
    letter-spacing: 0.04em;
}

.oauth-btn:last-child {
    border-bottom: none;
}

.oauth-btn:hover {
    background: var(--bg);
}

.login-disclaimer {
    padding: 14px 20px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    position: relative;
}

/* Version micro-data */
.login-disclaimer::after {
    content: 'v1.0 // 2026-03-18';
    position: absolute;
    top: 8px;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 7px;
    color: var(--border-light);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.login-disclaimer p {
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1.6;
    margin: 0;
    font-family: var(--font-mono);
}

.login-disclaimer strong {
    color: var(--text);
    font-weight: 600;
}

.login-footer {
    color: var(--text-muted);
    font-size: 9px;
    margin: 0;
    text-align: center;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.headline-prefix,
.headline-registered {
    /* remove old decorative sizing */
    font-size: inherit;
    vertical-align: baseline;
    margin: 0;
}

/* ============ HEADER RIGHT ============ */

.header-right {
    display: flex;
    align-items: stretch;
}

/* ============ BOARDS ============ */

.toolbar-section-label {
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    pointer-events: none;
    cursor: default;
}

.board-name-display {
    padding: 5px 14px;
    font-size: 8px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-top: 1px solid var(--border);
    min-height: 26px;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.boards-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.boards-modal.active {
    display: flex;
}

.boards-modal-inner {
    background: var(--surface);
    border: 1px solid var(--border);
    width: 360px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.boards-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.boards-modal-title {
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
}

.boards-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.1s;
}

.boards-modal-close:hover { color: var(--text); }

.boards-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.boards-modal-body::-webkit-scrollbar { width: 3px; }
.boards-modal-body::-webkit-scrollbar-track { background: transparent; }
.boards-modal-body::-webkit-scrollbar-thumb { background: var(--border-light); }

.board-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
    transition: background 0.1s;
}

.board-item:hover { background: var(--bg); }

.board-item.active { border-left: 2px solid var(--text); padding-left: 12px; }

.board-item-name {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.board-item-actions { display: flex; gap: 4px; flex-shrink: 0; }

.board-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 8px;
    font-family: var(--font-mono);
    transition: all 0.1s;
    line-height: 1;
}

.board-btn:hover { background: var(--text); color: var(--surface); border-color: var(--text); }
.board-delete-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.boards-empty {
    padding: 24px 14px;
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
}

/* ============ AUTO-SAVE INDICATOR ============ */

@keyframes fadeInOut {
    0%   { opacity: 0; transform: translateX(-50%) translateY(4px); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    85%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

/* ============ DARK MODE (optional toggle) ============ */

body.dark-mode {
    --bg:           #111111;
    --surface:      #1a1a1a;
    --text:         #EEEEEE;
    --text-muted:   #666666;
    --border:       #333333;
    --border-light: #2a2a2a;
}

body.dark-mode .canvas-container {
    background: #111;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.14) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,0.05) 0.5px, transparent 0.5px);
    background-size: 80px 80px, 16px 16px;
}

body.dark-mode .lightbox {
    background: rgba(17, 17, 17, 0.97);
}

body.dark-mode .password-modal {
    background: rgba(17, 17, 17, 0.98);
}

body.dark-mode .login-modal {
    background: var(--surface);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
    .cookie-notice {
        padding: 16px;
    }

    .cookie-notice-content {
        flex-direction: column;
        gap: 16px;
    }

    .cookie-notice-text {
        min-width: auto;
    }

    .cookie-notice-actions {
        width: 100%;
        flex-direction: column;
        border: 1px solid var(--border);
    }

    .cookie-btn {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }

    .cookie-btn:last-child {
        border-bottom: none;
    }
}
