:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --card-header-bg: #334155; 
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #334155;
    --input-bg: #020617;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #161b22;;
    color: var(--text-primary);
    line-height: 1.6;
 
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0; /* REMOVED PADDING */
    overflow: hidden; /* Prevent scroll */
}

.container {
    width: 100vw; /* Full width */
    max-width: none; /* No max width */
    padding: 0; /* Remove padding */
    height: 100vh;
    background-color: transparent;
}

/* Main Grid Layout */
/* Main Grid Layout */
.content-grid {
    display: grid;
    /* Variables for column widths */
    --left-col: 1fr;
    --right-col: 1fr;
    
    /* 3 Columns: Left Middle Right */
    grid-template-columns: var(--left-col) 2fr var(--right-col);
    grid-template-rows: 1fr 30px;
    gap: 0;
    align-items: start;
    height: 100vh;
    transition: grid-template-columns 0.3s ease, --left-col 0.3s ease; /* Transition vars if supported or property */
}

/* Collapsed Grid State */
.content-grid.left-collapsed {
    --left-col: 80px; /* Switch left column to fixed width */
}

/* Sidebar (General) */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.action-buttons{
    display: flex;

    justify-content: space-around;
}

.skip-boot-button-container {
    margin-top: 10px;
    display: flex;
    flex-direction:row;
    align-items: center;
    gap: 8px;
}

.skip-boot-button-container input {
    width: max-content;
}

.skip-boot-button-container label {
    margin: 0;
}

/* Left Sidebar (Action Bar) Styles */
.left-action-bar {
    grid-row: 1;
    padding: 1.5rem;
    background-color: #161b22;; /* Matches background */
    border-right: 1px solid var(--border-color);
    align-items: flex-start; /* Top align */
    transition: all 0.3s ease;
}

.left-action-bar.collapsed {
    padding: 1.5rem 0.5rem; /* Reduced padding */
    align-items: center; /* Center icons */
}

.action-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
}

.left-action-bar.collapsed .action-bar-header {
    justify-content: center;
    flex-direction: column-reverse; /* Put toggle above title (which is hidden anyway) */
    gap: 10px;
}

.action-bar-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    font-weight: 600;
}

.left-action-bar.collapsed .action-bar-title {
    display: none; /* Hide title */
}

.toggle-sidebar-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.action-btn {
    width: 100%;
    text-align: left;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.5rem;
    white-space: nowrap; /* Prevent text wrap */
    overflow: hidden;
}

.left-action-bar.collapsed .action-btn {
    justify-content: center;
    padding: 1rem 0;
}

.left-action-bar.collapsed .btn-text {
    display: none; /* Hide text */
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.action-btn .icon {
    font-size: 1.2rem;
    min-width: 24px; /* Ensure icon stability */
    text-align: center;
}

/* Middle Dashboard */
.dashboard-wrapper {
    grid-row: 1;
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
}

/* Right Sidebar: Spans entire height (Row 1 + 2) */
.right-sidebar {
    grid-column: 3;
    grid-row: 1 / span 2; /* Full Height */
    padding: 0;
    border-left: 1px solid var(--border-color);
    z-index: 10;
}

/* Footer Status Bar */
.status-footer {
    grid-column: 1 / span 2; /* Spans Left and Middle */
    grid-row: 2;
    background-color: var(--card-bg); /* Or darker: #0f172a */
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    gap: 1rem;
    z-index: 5;
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Backdrop dim */
    backdrop-filter: blur(4px); /* Blur effect */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center; /* Center horizontally and vertically */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 60vw; /* Constrain width */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #161b22;;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

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

.modal-body {
    padding: 1.5rem;
    background-color: #161b22;;
    max-height: 70vh; /* Prevent overflow on small screens */
    overflow-y: auto;
}

/* Helper for modal forms */
.config-form {
    display: flex;
    flex-direction: column;
}


.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-label {
    font-weight: 500;
}

.status-value {
    color: var(--text-primary);
}

.status-value.online { color: var(--success-color); }
.status-value.offline { color: var(--danger-color); }

.separator {
    color: var(--border-color);
}

/* ... existing Styles ... */
/* Remove old header styles if they exist or just ignore */

.card {
    background-color: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0;
    overflow: hidden;
    /* height: 100%; Left sidebar cards don't need 100% height necessarily, config cards stacked */
}

/* Ensure left sidebar cards don't stretch weirdly if using flux column */
.sidebar:not(.right-sidebar) .card {
    height: auto; 
}
/* Middle dashboard wrapper fills height */
.dashboard-wrapper {
   display: flex;
   flex-direction: column;
   gap: 1rem;
}

.card-header {
    background-color: #161b22;;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-body {
    padding: 1.5rem;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.collapsible-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ... existing code ... */

/* Variable Node Styles */
/* ... existing code ... */

.var-name {
    color: var(--text-secondary);
    margin-right: 1rem;
    font-size: 0.95rem;
    min-width: 200px;
    text-align: left;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select {
    width: 100%;
    padding: 0.85rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background-color: rgba(2, 6, 23, 0.8);
}

.select-wrapper {
    position: relative;
}

/* Custom Select Arrow */
.select-wrapper::after {
    content: "▼";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.7rem;
    pointer-events: none;
}

select {
    appearance: none;
    cursor: pointer;
}

button.btn-primary {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
}

button.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.4);
}

button.btn-primary:active {
    transform: translateY(0);
}



/* Layout Classes */
/* Layout Classes */
/* .card removed (defined earlier) */

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.status-msg {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Tree View Styles */
/* Dashboard Styles */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    height: 90vh; /* Fill vertical space */
    position: sticky;
    top: 2.5rem;
}

.dashboard-toolbar {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}

.windows-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); /* Responsive columns */
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    flex: 1; /* Take remaining height */
    
    /* Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.windows-grid::-webkit-scrollbar {
    width: 6px;
}
.windows-grid::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

/* Window Card Styles */
.window-card {
    background-color: #161b22;;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    height: 600px; /* Fixed height for consistency, or use aspect-ratio */
    max-height: 80vh;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.window-header {
    background-color: #161b22;;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab; /* Suggest dragging, even if not impl yet */
}

.window-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.window-controls {
    display: flex;
    gap: 0.5rem;
}

#btnEnterBoot{
    width: 32%;
}

#btnExitBoot{
    width: 32%;
}
#btnStartUpdate{
    width: 32%;
}

.window-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
    transition: color 0.2s;
}

.window-btn:hover {
    color: var(--text-primary);
}
.window-btn.close:hover {
    color: var(--danger-color);
}

.window-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.window-content::-webkit-scrollbar { width: 6px; }
.window-content::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 3px; }

/* Tree specific inside window */
.tree-list {
    list-style: none;
    padding-left: 0.8rem;
    margin: 0;
    border-left: 1px solid rgba(255,255,255,0.05);
}

.tree-item { margin: 0.1rem 0; }

.btn-secondary {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background-color: rgba(59, 130, 246, 0.3);
}

.tree-content {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    user-select: none;
}

.tree-content:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.folder-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-left: 0.5rem;
}

.toggle-icon {
    font-size: 0.7rem;
    color: var(--text-secondary);
    width: 1.2rem;
    text-align: center;
    transition: transform 0.2s;
}

.children-container {
    border-left: 1px solid var(--border-color);
    margin-left: 0.9rem;
    padding-left: 0.5rem;
}

.hidden {
    display: none;
}

/* Variable Node Styles */
.var-icon {
    color: var(--accent-color);
    font-size: 0.6rem;
    margin-right: 0.6rem;
}

.var-name {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.val-group {
    display: contents; /* Let children participate in grid */
}

.var-value, .var-hex {
    font-family: 'Monaco', 'Consolas', monospace;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: right;
}

.var-value {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    min-width: 100px;
    text-align: center;
    transition: background-color 0.3s, color 0.3s;
    white-space: nowrap;
}

.var-value.updated {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.var-hex {
    color: #a5b4fc;
    background: rgba(0, 0, 0, 0.2);
    min-width: 100px;
    text-align: center;
}
/* Removed .var-enum as we'll merge it into value or handle differently */
/* Keeping it just in case, but hidden */
.var-enum {
    display: none; 
}

.write-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.write-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 100px;
    font-family: inherit;
}

.write-select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    max-width: 150px;
    font-family: inherit;
}

.write-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.write-btn:hover {
    background-color: #4f46e5;
}

.write-btn:active {
    transform: translateY(1px);
}

/* Right Sidebar Specifics */
.right-sidebar {
    height: 100%;
    margin-bottom: 0px;
    position: relative;
    background-color: #161b22;; /* Match card bg */
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    left: -15px; /* Shift left into gap */
    top: 0;
    bottom: 0;
    width: 20px; /* Hit area */
    cursor: col-resize;
    z-index: 100;
    display: flex;
    justify-content: center;
}

.resize-handle::after {
    content: "";
    width: 4px;
    height: 100%;
    background-color: transparent; /* Invisible normally */
    transition: background-color 0.2s;
    border-radius: 2px;
}

.resize-handle:hover::after, .content-grid.resizing .resize-handle::after {
    background-color: var(--accent-color); /* Visible on hover/drag */
}

.content-grid.resizing {
    cursor: col-resize;
}

.sticky-header {
    flex-shrink: 0;
}

/* Flush Source Library Card */
.source-library-card {
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-right: none;
    border-left: 1px solid rgba(255,255,255,0.05);
    background-color: transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contain scrollable area */
    min-height: 0;
}

/* Ensure the tree root inside the card scrolls */
#sourceLibraryRoot {
    flex: 1 1 0px;
    overflow-y: auto;
    padding-right: 5px; /* Space for scrollbar */
    min-height: 0; /* Enable shrinking */
    
    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#sourceLibraryRoot::-webkit-scrollbar { width: 6px; }
#sourceLibraryRoot::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 3px; }

.hidden-by-search {
    display: none !important;
}

.search-input {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Draggable Items */
.tree-content[draggable="true"] {
    cursor: grab;
}

.tree-content[draggable="true"]:active {
    cursor: grabbing;
}

/* Droppable Areas */
.window-content.droppable-active {
    background-color: rgba(59, 130, 246, 0.1);
    border: 2px dashed var(--accent-color);
}

/* Watch List Table Styles */
.watch-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.watch-list th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.watch-list td {
    padding: 0.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.watch-list tr:last-child td {
    border-bottom: none;
}

.watch-val {
    font-family: 'Monaco', 'Consolas', monospace;
    text-align: right;
    color: var(--accent-color);
}
.watch-val.updated {
    color: var(--success-color);
    font-weight: bold;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.remove-btn:hover {
    opacity: 1;
}

