/* 2026 Premium Design System: Dark Mode & Glassmorphism */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0b0b0f;
    --bg-secondary: rgba(18, 18, 29, 0.6);
    --glass-bg: rgba(22, 22, 37, 0.45);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-border-focus: rgba(110, 68, 255, 0.4);
    
    --accent-primary: #6e44ff;
    --accent-secondary: #ff3b30;
    --accent-gradient: linear-gradient(135deg, #6e44ff 0%, #b624ff 100%);
    --accent-gradient-hover: linear-gradient(135deg, #815cff 0%, #c447ff 100%);
    
    --text-primary: #f5f5f7;
    --text-secondary: #8e8e93;
    --text-muted: #48484a;
    
    --success: #34c759;
    --warning: #ff9500;
    --danger: #ff3b30;
    --info: #007aff;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(110, 68, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(182, 36, 255, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Glassmorphism Card Utility */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: border-color var(--transition-smooth), transform var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

/* Typography & Layouts */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.8;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Form Inputs */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--glass-border-focus);
    box-shadow: 0 0 0 3px rgba(110, 68, 255, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

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

.btn-danger:hover {
    filter: brightness(1.1);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: rgba(52, 199, 89, 0.15); color: var(--success); }
.badge-warning { background: rgba(255, 149, 0, 0.15); color: var(--warning); }
.badge-danger { background: rgba(255, 59, 48, 0.15); color: var(--danger); }
.badge-info { background: rgba(0, 122, 255, 0.15); color: var(--info); }

/* Installer Specific Layout */
.installer-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.installer-card {
    width: 100%;
    max-width: 540px;
}

.installer-header {
    text-align: center;
    margin-bottom: 32px;
}

.installer-logo {
    font-size: 32px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.installer-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.installer-step-item {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.installer-step-item.active {
    color: var(--accent-primary);
    font-weight: 700;
}

/* System Requirements List */
.req-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.req-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.req-name {
    font-size: 14px;
}

/* Grid & Tables for Dashboard */
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(14, 14, 23, 0.9);
    border-right: 1px solid var(--glass-border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-left: 12px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-link.active {
    border-left: 3px solid var(--accent-primary);
}

.main-content {
    padding: 40px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-top: 24px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th, .custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.custom-table th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.custom-table td {
    font-size: 14px;
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Modal and Glass Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    transform: translateY(20px);
    transition: transform var(--transition-smooth);
}

.overlay.active .modal-content {
    transform: translateY(0);
}

/* Visual Mapper layout */
.mapper-row {
    display: grid;
    grid-template-columns: 1fr 120px 1fr 40px;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.mapper-header {
    display: grid;
    grid-template-columns: 1fr 120px 1fr 40px;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ------------------------------------------------------------- */
/* NODE CANVAS FLOW BUILDER WORKSPACE */
/* ------------------------------------------------------------- */
.canvas-workspace-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    background: var(--bg-primary);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.canvas-workspace-overlay.active {
    display: flex;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(14, 14, 23, 0.95);
    z-index: 10;
    backdrop-filter: blur(12px);
}

.workspace-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.workspace-title-area {
    display: flex;
    flex-direction: column;
}

.workspace-subtitle {
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
}

.workspace-header-center {
    display: flex;
    gap: 8px;
    align-items: center;
}

.workspace-header-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.workspace-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Left Sidebar (Nodes Palette) */
.palette-sidebar {
    width: 260px;
    background: rgba(10, 10, 15, 0.85);
    border-right: 1px solid var(--glass-border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    z-index: 2;
    backdrop-filter: blur(16px);
}

.palette-title {
    font-size: 15px;
    font-weight: 600;
}

.palette-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.palette-cat-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
    user-select: none;
}

.palette-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.palette-icon {
    font-size: 18px;
}

.palette-item-text {
    display: flex;
    flex-direction: column;
}

.palette-item-text strong {
    font-size: 13px;
    color: var(--text-primary);
}

.palette-item-text span {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Center Canvas Viewport */
.canvas-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #06060a;
    cursor: grab;
    user-select: none;
}

.canvas-viewport:active {
    cursor: grabbing;
}

.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}

.canvas-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

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

/* Draggable Canvas Visual Nodes */
.canvas-node {
    position: absolute;
    min-width: 220px;
    background: rgba(22, 22, 35, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    cursor: default;
    z-index: 5;
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.canvas-node.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 16px rgba(110, 68, 255, 0.25);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
    cursor: move;
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}

.node-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.node-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.node-info {
    font-size: 11px;
    color: var(--text-secondary);
    word-break: break-all;
}

/* Node type colors */
.node-source { border-top: 3px solid #6e44ff; }
.node-source .node-header { background: rgba(110, 68, 255, 0.1); color: #8e6dff; }

.node-mapper, .node-status_mapper, .node-regex, .node-math { border-top: 3px solid #00f2fe; }
.node-mapper .node-header, .node-status_mapper .node-header, .node-regex .node-header, .node-math .node-header { background: rgba(0, 242, 254, 0.08); color: #00f2fe; }

.node-filter { border-top: 3px solid #f6d365; }
.node-filter .node-header { background: rgba(246, 211, 101, 0.08); color: #f6d365; }

.node-destination { border-top: 3px solid #43e0aa; }
.node-destination .node-header { background: rgba(67, 224, 170, 0.08); color: #43e0aa; }

/* Drag Ports */
.port {
    width: 12px;
    height: 12px;
    background: #0d0d12;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    position: absolute;
    cursor: crosshair;
    z-index: 10;
    transition: background var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.port:hover {
    background: var(--accent-primary);
    border-color: #fff;
    transform: scale(1.3);
}

.port-in {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.port-in:hover {
    transform: translateY(-50%) scale(1.3);
}

.port-out {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.port-out:hover {
    transform: translateY(-50%) scale(1.3);
}

.port-label {
    position: absolute;
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 700;
    pointer-events: none;
}

.port-in + .port-label {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.port-out + .port-label {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* SVG Wires */
.connection-line {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke var(--transition-fast), stroke-width var(--transition-fast);
    pointer-events: stroke;
    cursor: pointer;
}

.connection-line:hover {
    stroke: var(--accent-primary);
    stroke-width: 5;
}

.connection-temp-line {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 3;
    stroke-dasharray: 6, 4;
}

/* Simulation animated glows */
.connection-line.active-path {
    stroke: var(--success);
    stroke-width: 4.5;
    filter: drop-shadow(0 0 4px rgba(52, 199, 89, 0.6));
}

.connection-line.active-path-animated {
    stroke-dasharray: 12, 10;
    animation: connection-flow 25s linear infinite;
}

@keyframes connection-flow {
    to {
        stroke-dashoffset: -1000;
    }
}

.connection-line.error-path {
    stroke: var(--danger);
    stroke-width: 4.5;
    filter: drop-shadow(0 0 4px rgba(255, 59, 48, 0.6));
}

.connection-line.skipped-path {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 2.5;
}

/* Right Sidebar: Context Settings */
.settings-sidebar {
    width: 320px;
    background: rgba(10, 10, 15, 0.85);
    border-left: 1px solid var(--glass-border);
    padding: 20px 16px;
    overflow-y: auto;
    z-index: 2;
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
}

.settings-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    opacity: 0.6;
}

.settings-header {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Bottom Drawer (Sandbox) */
.sandbox-drawer {
    position: absolute;
    bottom: 0;
    left: 260px;
    right: 320px;
    background: rgba(14, 14, 23, 0.95);
    border-top: 1px solid var(--glass-border);
    z-index: 5;
    backdrop-filter: blur(16px);
    transition: transform var(--transition-smooth);
    transform: translateY(calc(100% - 44px)); /* Only show header by default */
}

.sandbox-drawer.expanded {
    transform: translateY(0);
}

.sandbox-drawer-header {
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 13px;
    user-select: none;
}

.sandbox-drawer-header:hover {
    background: rgba(255,255,255,0.02);
}

.sandbox-drawer-body {
    height: 240px;
    padding: 20px;
    overflow: hidden;
}

.sandbox-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: 100%;
}

.sandbox-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sandbox-pane h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Visual Mapper Connector List styles */
.visual-mapper-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visual-mapper-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 8px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

/* Floating wire popup inspect */
.wire-popover {
    position: absolute;
    z-index: 1000;
    background: rgba(14, 14, 23, 0.95);
    border: 1px solid var(--glass-border-focus);
    border-radius: var(--radius-sm);
    padding: 10px;
    box-shadow: var(--shadow);
    width: 260px;
    backdrop-filter: blur(12px);
    pointer-events: auto;
}

.wire-popover-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 4px;
}

.wire-popover-content {
    font-size: 11px;
    max-height: 140px;
    overflow-y: auto;
    margin-top: 0;
}

/* Timeline logs container details */
.timeline-container {
    position: relative;
    padding-left: 24px;
    margin-top: 16px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--glass-border);
}

.timeline-node {
    position: relative;
    margin-bottom: 24px;
}

.timeline-node:last-child {
    margin-bottom: 0;
}

.timeline-bullet {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 3px solid var(--accent-primary);
    z-index: 2;
}

.timeline-bullet.success { border-color: var(--success); }
.timeline-bullet.failed { border-color: var(--danger); }
.timeline-bullet.warning { border-color: var(--warning); }
.timeline-bullet.info { border-color: var(--info); }

.timeline-content {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-title {
    font-weight: 600;
    font-size: 13px;
}

/* Visual Settings components */
.settings-grid-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.settings-grid-table th, .settings-grid-table td {
    padding: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
}

.settings-grid-table th {
    color: var(--text-secondary);
    text-align: left;
    font-weight: 600;
}

.condition-builder-row {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.condition-builder-row .form-control {
    padding: 6px 10px;
    font-size: 13px;
}

.condition-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
