/* Flow Canvas - Visual Programming Overlay */

.fc-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #1a1a2e;
    color: white;
    font-family: RobotoCondensedRegular, sans-serif;
}

/* Toolbar */
.fc-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #16213e;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.fc-toolbar-title {
    font-size: 14pt;
    font-weight: 500;
    margin-right: auto;
}

.fc-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background-color: #1a1a2e;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s;
}

.fc-toolbar-btn:hover {
    background-color: #0f3460;
}

.fc-toolbar-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background-color: #1a1a2e;
    color: white;
    cursor: pointer;
    font-size: 10pt;
    text-decoration: none;
    transition: background-color 0.15s;
}

.fc-toolbar-link:hover {
    background-color: #0f3460;
    color: white;
}

.fc-toolbar-separator {
    width: 1px;
    height: 24px;
    background-color: #0f3460;
    margin: 0 4px;
}

/* Viewport wrapper (HTML div for layout + background) */
.fc-viewport-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    background-color: #1a1a2e;
    background-image:
        radial-gradient(circle, #2a2a4e 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
}

.fc-viewport-wrapper:active {
    cursor: grabbing;
}

/* SVG fills the wrapper */
.fc-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Node styles */
.flow-node rect {
    rx: 8;
    ry: 8;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: filter 0.15s;
}

.flow-node:hover rect {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Selected node */
.flow-node--selected rect {
    filter: drop-shadow(0 0 8px rgba(99, 179, 237, 0.7));
    stroke-dasharray: none;
}

/* Dragging cursor */
.flow-node {
    cursor: grab;
}

.flow-node:active {
    cursor: grabbing;
}

.flow-node text {
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 11px;
    fill: #1e293b;
    pointer-events: none;
    user-select: none;
}

.flow-node-type {
    font-size: 8px !important;
    fill: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Port circles */
.flow-port {
    fill: white;
    stroke-width: 2;
    r: 5;
    transition: r 0.15s;
    cursor: crosshair;
    pointer-events: all;
}

.flow-port:hover {
    r: 7;
}

.flow-port--highlight {
    r: 8 !important;
    fill: #60a5fa !important;
    stroke: #3b82f6 !important;
}

/* Temporary connection line during drawing */
.fc-temp-connection {
    pointer-events: none;
}

/* Connection paths */
.flow-connection path {
    fill: none;
    stroke: #64748b;
    stroke-width: 1.5;
    transition: stroke 0.15s, stroke-width 0.15s;
}

.flow-connection {
    cursor: pointer;
}

.flow-connection:hover path {
    stroke: #94a3b8;
    stroke-width: 2.5;
}

/* Selected connection */
.flow-connection--selected path {
    stroke: #60a5fa;
    stroke-width: 2.5;
}

.flow-connection--selected text {
    fill: #60a5fa !important;
}

.flow-connection text {
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 9px;
    fill: #94a3b8;
    pointer-events: none;
    user-select: none;
}

/* Connection arrow marker */
.fc-arrow-marker {
    fill: #64748b;
}

/* Filter bar */
.fc-filter-bar {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background-color: rgba(22, 33, 62, 0.9);
    border: 1px solid #0f3460;
    border-radius: 8px;
    z-index: 10;
}

.fc-filter-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 1.5px solid var(--chip-stroke);
    border-radius: 14px;
    background-color: transparent;
    color: #64748b;
    cursor: pointer;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 9pt;
    transition: background-color 0.15s, color 0.15s, opacity 0.15s;
    opacity: 0.5;
}

.fc-filter-chip:hover {
    opacity: 0.8;
}

.fc-filter-chip--active {
    background-color: var(--chip-fill);
    color: #1e293b;
    opacity: 1;
}

.fc-filter-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background-color: var(--chip-fill);
    border: 1.5px solid var(--chip-stroke);
}

/* Stats badge */
.fc-stats {
    font-size: 9pt;
    color: #64748b;
    margin-left: 8px;
}

/* Breadcrumb bar */
.fc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background-color: #16213e;
    border-bottom: 1px solid #0f3460;
    font-size: 13px;
    flex-shrink: 0;
}

.fc-breadcrumb-btn {
    background: none;
    border: none;
    color: #60a5fa;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 12px;
}

.fc-breadcrumb-btn:hover {
    background-color: #0f3460;
    color: #93c5fd;
}

.fc-breadcrumb-sep {
    color: #475569;
}

.fc-breadcrumb-current {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 12px;
}

/* Three-panel layout */
.fc-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left palette sidebar */
.fc-palette {
    width: 200px;
    flex-shrink: 0;
    background-color: #16213e;
    border-right: 1px solid #0f3460;
    overflow-y: auto;
    padding: 12px 0;
    transition: width 0.2s, padding 0.2s, opacity 0.2s;
}

.fc-palette--hidden {
    width: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
}

.fc-palette-group {
    margin-bottom: 12px;
}

.fc-palette-group-title {
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 4px 14px;
    margin-bottom: 4px;
}

.fc-palette-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 10pt;
    text-align: left;
    transition: background-color 0.15s;
}

.fc-palette-item:hover {
    background-color: #0f3460;
}

.fc-palette-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1.5px solid;
    flex-shrink: 0;
}

/* Right property panel */
.fc-property-panel {
    width: 420px;
    flex-shrink: 0;
    background-color: #16213e;
    border-left: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fc-property-header {
    padding: 10px 14px;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.fc-property-title {
    font-size: 10pt;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.fc-property-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    color: #1e293b;
    background-color: #f8fafc;
}

/* Sticky Notes */
.flow-sticky-note {
    cursor: grab;
}

.flow-sticky-note:active {
    cursor: grabbing;
}

.flow-sticky-note rect {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: filter 0.15s;
}

.flow-sticky-note:hover rect {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.flow-sticky-note--selected rect {
    filter: drop-shadow(0 0 8px rgba(99, 179, 237, 0.7));
}

.flow-sticky-note-text {
    padding: 8px 10px;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 11px;
    color: #1e293b;
    pointer-events: none;
    user-select: none;
    overflow: hidden;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-sizing: border-box;
}

.flow-sticky-note-edit {
    padding: 8px 10px;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 11px;
    color: #1e293b;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    word-wrap: break-word;
    box-sizing: border-box;
}

/* Color swatches in toolbar */
.fc-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #0f3460;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.fc-color-swatch:hover {
    transform: scale(1.2);
    border-color: #60a5fa;
}

/* Inline connection position editor (foreignObject) */
.fc-conn-edit-fo {
    overflow: visible;
}

.fc-conn-edit {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(22, 33, 62, 0.92);
    border: 1px solid #0f3460;
    border-radius: 4px;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 9px;
    color: #94a3b8;
    white-space: nowrap;
}

.fc-conn-edit-input {
    width: 36px;
    padding: 1px 3px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 3px;
    color: #e2e8f0;
    font-family: RobotoCondensedRegular, sans-serif;
    font-size: 9px;
    text-align: center;
}

.fc-conn-edit-input:focus {
    outline: none;
    border-color: #3b82f6;
}
