/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Funnel+Display:wght@300..800&display=swap');

:root {
    /* Light theme variables */
    --bg-color: #F7F9FB;
    /* Cleaner, cooler light gray */
    --text-color: #333333;
    --text-color-rgb: 51, 51, 51;
    --node-bg: #ffffff;
    --node-bg-rgb: 255, 255, 255;
    --grid-color: #E5E8EB;
    /* Lower contrast for subtle dots */
    --default-strip-color: #c2f8cb;
    --ui-bg: #ffffff;
    /* White UI for cleaner look */
    --ui-text: #333333;
    --link-color: #007bff;
    --button-hover: #f4f5f7;
    --modal-bg: #ffffff;
    --modal-border: #e0e0e0;
    --modal-shadow: rgba(0, 0, 0, 0.1);
    --primary-btn-bg: #67a772;
    --primary-btn-text: white;
    --secondary-btn-bg: #f0f0f0;
    --secondary-btn-text: #333333;
    --connection-color: #b0b0b0;
    /* Lighter connections */
    --pin-color: #333333;
    --pin-border: transparent;
    /* Remove pin border */
    --pin-contour: transparent;
    /* Remove pin contour */
    --footer-bg: transparent;
    /* Cleaner footer */
    --footer-text: #aeaeae;
    --input-border: #e0e0e0;
    --shadow-color: transparent;
    /* Remove drop shadows */
}

/* Dark theme variables */
body.night-mode {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --text-color-rgb: 255, 255, 255;
    --node-bg: #333333;
    --node-bg-rgb: 51, 51, 51;
    --grid-color: #444444;
    --ui-bg: #333333;
    --ui-text: #ffffff;
    --link-color: #00a8ff;
    --button-hover: #444444;
    --modal-bg: #2a2a2a;
    --modal-border: #444444;
    --modal-shadow: rgba(0, 0, 0, 0.4);
    --secondary-btn-bg: #444444;
    --secondary-btn-text: #e2e2e2;
    --connection-color: #a0a0a0;
    --pin-color: #cccccc;
    /* Lighter pin color for visibility against dark node bg */
    --footer-bg: #2a2a2a;
    --footer-text: #969696;
    --input-border: #444444;
    --shadow-color: rgba(18, 18, 18, 0.238);
}

/* Base Styles */
body,
html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
    background-color: transparent;
    color: var(--text-color);
    font-family: "Funnel Display", sans-serif;
    transition: background-color 0.5s ease;
}

/* Added style for when the main app becomes active */
body.app-active {
    background-color: var(--bg-color);
}

/* Canvas Styles */
#canvas-wrapper {
    display: none;
    /* Hide initially */
    position: absolute;
    top: 0;
    z-index: 1;
    /* Ensure it's below UI controls */
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

#canvas-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 1000%;
    height: 1000%;
    transform-origin: 0 0;
    z-index: 2;
    /* Ensure content is above background */
}

#canvas-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 400%;
    height: 400%;
    background: radial-gradient(var(--grid-color) 1px, transparent 1px),
        radial-gradient(var(--grid-color) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    transform-origin: 0 0;
    z-index: 1;
    /* Keep background behind content */
}

body.panning #canvas {
    cursor: grabbing;
}

body.connecting #canvas {
    cursor: crosshair;
}

/* Node Styles */
.node {
    position: absolute;
    min-width: 150px;
    min-height: 80px;
    padding: 15px;
    border-radius: 20px;

    /* Clean background */
    background: var(--node-bg);

    /* Very subtle border */
    border: 1px solid rgba(var(--text-color-rgb), 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

    cursor: move;
    user-select: none;
    font-family: "Funnel Display", sans-serif;
    max-width: 800px;
    z-index: 10;
    overflow: visible;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Content-only mode - no border, no background */
.node.content-only-mode {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Thin rounded color strip - like a title bar */
.node .strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--default-strip-color);
    border-radius: 20px 20px 0 0;
    /* Only round top corners */
    cursor: move;
    pointer-events: none;
    /* Don't block node dragging, no color palette */
    z-index: 1;
    transition: background-color 0.3s ease;
}

.node.content-only-mode .strip {
    display: none;
}

.node .delete {
    cursor: pointer;
    user-select: none;
    font-size: 1.2em;
    color: #1a1a1a !important;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.node .delete:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body.night-mode .node .delete {
    color: #1a1a1a;
}

body.night-mode .node .delete:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.node .content {
    position: relative;
    z-index: 1;
    /* Above gradient overlay */
    margin-top: 18px;
    /* Space for strip at top */
    padding: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 800px;
    outline: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
}

.node .content[contenteditable="true"] {
    outline: none;
    border: 1px solid transparent;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

.node .content[contenteditable="true"]:focus {
    border: 1px solid rgba(184, 218, 255, 0.5);
}

.node.selected {
    border: 1px solid rgba(0, 123, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
}

body.night-mode .node.selected {
    border: 1px solid rgba(0, 168, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.3);
}

/* Style for placeholder text */
.node .content.is-placeholder {
    color: #aaa;
    /* Light gray color for placeholder */
}

body.night-mode .node .content.is-placeholder {
    color: #666;
    /* Darker gray for placeholder in night mode */
}

/* Pin Styles */
.pin {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--pin-color);
    border: 2px solid var(--node-bg);
    border-radius: 3px;
    /* Slightly rounded square instead of circle */
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    transition: all 0.2s ease;
}

.pin.left {
    left: -8px;
    /* Half outside the node */
}

.pin.right {
    right: -8px;
    /* Half outside the node */
}

.pin:hover {
    transform: translateY(-50%) scale(1.3);
    background-color: #007bff;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}

body.night-mode .pin {
    border-color: var(--node-bg);
}

body.night-mode .pin:hover {
    background-color: #00a8ff;
    box-shadow: 0 0 8px rgba(0, 168, 255, 0.5);
}

/* Connection Styles */
.connection {
    position: absolute;
    pointer-events: stroke;
    z-index: 5;
    /* Keep below pins but above other elements */
}

.connection-container {
    z-index: 5;
}

/* UI Controls */
#night-mode-toggle,
#fullscreen-toggle {
    position: fixed;
    top: 20px;
    z-index: 1600;
    /* Increased z-index to be fully above canvas */
    padding: 8px 12px;
    background-color: var(--ui-bg);
    color: var(--ui-text);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    /* Ensure buttons remain clickable */
    outline: none;
    /* Remove browser outline */
    width: 40px;
    /* Slightly larger width */
    height: 40px;
    /* Slightly larger height */
}

#night-mode-toggle svg,
#fullscreen-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    /* Use current text color */
    stroke-width: 2px;
    fill: none;
    display: block;
}

#night-mode-toggle:hover,
#fullscreen-toggle:hover {
    transform: scale(1.1);
    background-color: var(--button-hover);
}

#night-mode-toggle {
    right: 70px;
}

#fullscreen-toggle {
    right: 20px;
}

/* UI Container to hold all controls */
#ui-controls-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1500;
}

#ui-controls-container>* {
    pointer-events: auto;
    /* Enable interaction for all direct children */
}

/* Menu Button and Dropdown */
#menu-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-btn-bg);
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    z-index: 3001;
    /* Above blur overlay */
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    /* Ensure clickable */
    display: flex;
    /* Added */
    align-items: center;
    /* Added */
    justify-content: center;
    /* Added */
}

#menu-button:hover {
    transform: scale(1.1);
    background-color: #85c790;
}

#dropdown-menu {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: var(--modal-bg);
    border-radius: 15px;
    box-shadow: 0 2px 10px var(--modal-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 3002;
    /* Above menu button and blur */
    pointer-events: auto;
    /* Ensure clickable */
    max-height: 400px;
    /* Prevent excessive height */
    width: 200px;
    /* Fixed width for consistency */
}

#dropdown-menu.show {
    display: flex;
    /* Removed !important */
}

#dropdown-menu button {
    padding: 12px 20px;
    font-size: 14px;
    border: none;
    background-color: var(--modal-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
}

#dropdown-menu button:hover {
    background-color: var(--button-hover);
}

/* File Name Display */
#file-name-display {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: var(--ui-bg);
    color: var(--ui-text);
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1600;
    /* Increased z-index */
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    /* Ensure clickable */
}

/* Footer Band */
#footer-band {
    position: fixed;
    bottom: 0;
    left: 0;
    width: fit-content;
    padding: 10px;
    background-color: var(--footer-bg);
    color: var(--footer-text);
    font-size: 12px;
    text-align: left;
    font-family: "Funnel Display", sans-serif;
    z-index: 1600;
    /* Increased z-index */
    transition: background-color 0.3s ease, color 0.3s ease;
    pointer-events: auto;
    /* Ensure it remains clickable */
}

#footer-band a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

#footer-band a:hover {
    color: var(--primary-btn-bg);
}

/* Link Styles */
.node .content a {
    color: var(--link-color);
    text-decoration: underline;
}

/* Media Content */
.node img {
    pointer-events: none;
    max-width: 100%;
}

.media-resizable {
    position: relative;
    display: inline-block;
}

.resize-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(128, 128, 128, 0.5);
    /* Transparent gray */
    border-radius: 4px;
    cursor: nwse-resize;
    display: none;
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.resize-handle:hover {
    background-color: var(--primary-btn-bg);
    /* Green color from buttons */
    transform: scale(1.2);
}

/* Style the single bottom-right handle */
.resize-handle.bottom-right {
    bottom: 5px;
    right: 5px;
}

/* Rotate the icon */
.resize-handle.bottom-right i {
    transform: rotate(90deg);
}

.media-resizable:hover .resize-handle.bottom-right {
    display: flex;
}

/* Color Options Palette */
.color-options {
    position: absolute;
    top: -55px;
    left: -70px;
    display: flex;
    background-color: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 10px;
    padding: 8px;
    z-index: 1000;
    box-shadow: 0 2px 8px var(--modal-shadow);
}

.color-options .color-swatch {
    width: 25px;
    height: 25px;
    margin: 3px;
    cursor: pointer;
    box-sizing: border-box;
    border-radius: 5px;
    transition: transform 0.2s ease;
}

.color-options .color-swatch:hover {
    transform: scale(1.15);
}

/* Cursor Styles */
.dragging {
    cursor: grabbing !important;
}

.connecting {
    cursor: crosshair !important;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    /* << MODIFICATION: Ensure modals are above most content */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    /* Apply backdrop filter for blur effect */
    backdrop-filter: blur(0px);
    background-color: rgba(0, 0, 0, 0);
    /* Start fully transparent */
    justify-content: center;
    align-items: center;
    /* Add transition for the filter and background */
    transition: backdrop-filter 0.3s ease, background-color 0.3s ease, opacity 0.3s ease;
    /* Ensure pointer events are none when inactive */
    pointer-events: none;
    opacity: 0;
    /* Start fully transparent */
    border-radius: 12px;
}

/* ===== Lock Indicator ===== */
.lock-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

body.night-mode .lock-indicator {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Objects Panel ===== */
/* Apply blur and dimming ONLY to non-welcome active modals */
.modal.active

/*:not(#welcome-modal)*/
    {
    backdrop-filter: blur(4px);
    background-color: rgba(0, 0, 0, 0.15);
    /* Original dimming */
}

/* Apply common active styles to ALL active modals */
.modal.active {
    display: flex;
    /* Make visible and flex */
    opacity: 1;
    /* Fade in */
    pointer-events: auto;
    /* Allow interaction */
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content {
    background-color: var(--modal-bg);
    position: relative;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px var(--modal-shadow);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 15px 20px;
    display: flex;
    /* Changed from space-between to flex-start */
    justify-content: flex-start;
    align-items: center;
    border-bottom: 1px solid var(--modal-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--text-color);
    /* Added margin to push close button to the right */
    margin-right: auto;
    /* Removed padding-left: 0; to allow inheriting parent padding */
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
}

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

/* Removed .back-to-welcome and .back-to-welcome:hover rules */

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 10px 20px;
    /* Keep padding consistent */
    text-align: left;
    /* Align text to the left */
    border-top: 1px solid var(--modal-border);
    font-size: 12px;
    color: var(--footer-text);
}

/* Style the link within the footer */
.modal-footer a {
    color: var(--primary-btn-bg);
    /* Use primary green color */
    text-decoration: none;
    /* Remove underline */
    transition: opacity 0.2s ease;
}

.modal-footer a:hover {
    opacity: 0.8;
    /* Slight fade on hover */
}

/* Welcome Modal Specific */
.welcome-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
    margin-bottom: 15px;
}

.welcome-options button {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.welcome-options button:hover {
    transform: translateY(-2px);
}

.primary-btn {
    background-color: var(--primary-btn-bg);
    color: var(--primary-btn-text);
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
}

.primary-btn:hover {
    background-color: #85c790;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.secondary-btn {
    background-color: var(--secondary-btn-bg);
    color: var(--secondary-btn-text);
    border-radius: 50px;
    padding: 12px 25px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.secondary-btn:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--input-border);
    background-color: var(--node-bg);
    color: var(--text-color);
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-btn-bg);
}

/* Language options */
.language-selector {
    position: fixed;
    top: 20px;
    right: 120px;
    z-index: 1600;
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--ui-bg);
    color: var(--ui-text);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    outline: none;
}

.language-selector .current-language {
    font-size: 14px;
    font-weight: 500;
}

.language-selector:hover {
    transform: scale(1.1);
    background-color: var(--button-hover);
}

.language-options {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: var(--modal-bg);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1601;
    min-width: 120px;
}

.language-options.show {
    display: flex;
    /* Removed !important */
}

.language-option {
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--text-color);
}

.language-option:hover {
    background-color: var(--button-hover);
}

/* Project Tabs */
.project-tabs {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 60%;
    background-color: var(--ui-bg);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 5px;
    transition: all 0.3s ease;
}

.project-tab {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    margin-right: 5px;
    background-color: var(--modal-bg);
    color: var(--text-color);
    border-radius: 8px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    max-width: 200px;
    position: relative;
    transform-origin: center;
}

.project-tab.dragging {
    opacity: 0.5;
    background-color: var(--button-hover);
    cursor: grabbing;
}

.project-tab.drag-over-before {
    /* Optional: Add a visual indicator like a left border */
    box-shadow: inset 3px 0 0 var(--primary-btn-bg);
    transition: box-shadow 0.1s ease-out;
}

.project-tab.drag-over-after {
    /* Optional: Add a visual indicator like a right border */
    box-shadow: inset -3px 0 0 var(--primary-btn-bg);
    transition: box-shadow 0.1s ease-out;
}

.project-tab .project-name {
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 150px;
    flex-grow: 1;
    margin: 0 5px;
    user-select: none;
}

.project-tab .tab-edit {
    margin-right: 5px;
    font-size: 14px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.project-tab .tab-edit:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.project-tab.active .tab-edit:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.project-tab .tab-close {
    margin-left: 8px;
    font-size: 16px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.project-tab .tab-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.project-tab.active .tab-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.project-tab.active {
    background-color: var(--primary-btn-bg);
    color: white;
    font-weight: 500;
}

.project-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.project-tab.new-tab {
    width: 36px;
    min-width: 36px;
    justify-content: center;
    font-size: 18px;
    background-color: var(--secondary-btn-bg);
    cursor: pointer;
}

.project-tab.new-tab:hover {
    background-color: var(--primary-btn-bg);
    color: white;
}

/* Debug Styles */
#debug-indicator {
    position: fixed;
    bottom: 10px;
    left: 10px;
    padding: 5px 10px;
    background: rgba(255, 0, 0, 0.7);
    color: white;
    border-radius: 5px;
    font-size: 12px;
    z-index: 2000;
    pointer-events: none;
    animation: pulse 2s infinite;
}

.group {
    position: absolute;
    pointer-events: all;
    cursor: move;
    border: 2px solid;
    border-radius: 16px;
    /* Increased from default for softer corners */
    background-color: transparent;
    transition: all 0.2s ease;
    z-index: 0;
    /* Behind nodes */
    user-select: none;
}

#cursor-marker {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: red;
    transform: translate(-5px, -5px);
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

#canvas-center-marker {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: blue;
    transform: translate(-5px, -5px);
    z-index: 999;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(0, 0, 255, 0.5);
}

#debug-coords {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 2000;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

/* Disable text selection globally */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Only enable text selection for editable content */
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Editing mode for nodes */
.node.editing {
    cursor: default !important;
}

.node.editing .content {
    cursor: text !important;
    min-height: 50px;
    min-width: 100px;
}

.node.editing .strip {
    cursor: default !important;
}

/* History Buttons */
.history-buttons {
    position: fixed;
    bottom: 20px;
    right: 85px;
    /* Position to the left of the menu button */
    display: flex;
    gap: 10px;
    z-index: 1600;
}

.history-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--ui-bg);
    color: var(--ui-text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
    outline: none;
    padding: 0;
}

.history-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.history-button:hover:not(.disabled) {
    transform: scale(1.1);
    background-color: var(--button-hover);
}

.history-button.disabled {
    opacity: 0.5;
    cursor: default;
}

/* Node Type Switcher Styles (Like Color Palette) */
.node-type-options {
    position: absolute;
    background-color: var(--modal-bg);
    /* Use modal background */
    border: 1px solid var(--modal-border);
    border-radius: 8px;
    /* Slightly rounded corners */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    padding: 5px;
    /* Padding around options */
    display: flex;
    /* Arrange options horizontally */
    gap: 5px;
    /* Space between options */
    z-index: 110;
    /* Remove min-width */
}

.node-type-option {
    /* Reset previous styles */
    padding: 0;
    font-size: 14px;
    background-color: transparent;

    /* Style like color swatches */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    /* Circular buttons */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    /* Add border for active state */
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.node-type-option i {
    /* Style the icon inside */
    font-size: 14px;
    color: var(--text-color);
    /* Use theme text color */
}

.node-type-option:hover {
    transform: scale(1.15);
    background-color: transparent;
    /* No background change on hover */
    border-color: var(--primary-btn-bg);
    /* Highlight border on hover */
}

.node-type-option.active {
    border-color: var(--primary-btn-bg);
    /* Use primary green for active border */
    background-color: rgba(103, 167, 114, 0.2);
    /* Faint green background for active */
    font-weight: normal;
    /* Remove bold */
    color: inherit;
    /* Reset color */
}

.node-type-option.active i {
    color: var(--primary-btn-bg);
    /* Make icon green when active */
}

/* Dark mode adjustments */
body.night-mode .node-type-options {
    background-color: #2a2a2a;
    border-color: #444;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

body.night-mode .node-type-option i {
    color: #e2e2e2;
    /* Light icon color */
}

body.night-mode .node-type-option:hover {
    border-color: var(--primary-btn-bg);
}

body.night-mode .node-type-option.active {
    border-color: var(--primary-btn-bg);
    background-color: rgba(103, 167, 114, 0.2);
}

body.night-mode .node-type-option.active i {
    color: var(--primary-btn-bg);
}

/* Checklist Node Styles */
.node-checklist {
    min-width: 200px;
    min-height: 100px;
}

.node-checklist .content {
    padding-bottom: 35px;
    outline: none;
}

.node-checklist .checklist-items {
    list-style: none;
    padding: 0 5px 0 10px;
    margin: 5px 0;
    max-height: 200px;
    overflow-y: auto;
}

.node-checklist .checklist-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    padding: 2px 0;
    position: relative;
}

.node-checklist .checklist-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color, #999);
    border-radius: 3px;
    position: relative;
    top: 1px;
    transition: background-color 0.2s, border-color 0.2s;
}

.node-checklist .checklist-item input[type="checkbox"]:checked {
    background-color: var(--primary-btn-bg, #67a772);
    border-color: var(--primary-btn-bg, #67a772);
}

.node-checklist .checklist-item input[type="checkbox"]:checked::after {
    content: '\2713';
    font-size: 12px;
    color: var(--primary-btn-text, #fff);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

body.night-mode .node-checklist .checklist-item input[type="checkbox"]:checked::after {
    color: var(--primary-btn-text, #fff);
}

.node-checklist .checklist-item span {
    flex-grow: 1;
    outline: none;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.node-checklist .checklist-item span[contenteditable="true"] {
    background-color: rgba(0, 0, 0, 0.05);
}

body.night-mode .node-checklist .checklist-item span[contenteditable="true"] {
    background-color: rgba(255, 255, 255, 0.1);
}

.node-checklist .checklist-item.completed span {
    text-decoration: line-through;
    color: grey;
}

.node-checklist .checklist-item .remove-item {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    margin-left: 5px;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.node-checklist .checklist-item:hover .remove-item {
    opacity: 1;
}

.node-checklist .checklist-item .remove-item:hover {
    color: red;
}

.node-checklist .add-checklist-item {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: var(--button-bg-color);
    color: var(--button-text-color);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.node-checklist .add-checklist-item:hover {
    background-color: var(--hover-bg-color);
}

body.night-mode .node-checklist .checklist-item input[type="checkbox"] {
    border-color: #666;
}

body.night-mode .node-checklist .checklist-item input[type="checkbox"]:checked {
    background-color: #7FDEFF;
    border-color: #7FDEFF;
}

body.night-mode .node-checklist .checklist-item input[type="checkbox"]:checked::after {
    color: #1a1a1a;
}

body.night-mode .node-checklist .checklist-item.completed span {
    color: #777;
}

body.night-mode .node-checklist .checklist-item .remove-item {
    color: #666;
}

body.night-mode .node-checklist .checklist-item .remove-item:hover {
    color: #ff6b6b;
}

body.night-mode .node-checklist .add-checklist-item {
    background-color: #444;
    color: #ddd;
    border-color: #666;
}

body.night-mode .node-checklist .add-checklist-item:hover {
    background-color: #555;
}

/* Timer Node Styles */
.node-timer {
    min-width: 260px;
    min-height: 140px;
}

.node-timer .content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding-bottom: 5px;
}

.timer-display {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 10px 5px;
    flex-grow: 1;
    position: relative;
}

.timer-display .time-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.timer-display .time-segment .value {
    font-size: 2.2em;
    font-weight: bold;
    line-height: 1.1;
    color: var(--text-color);
}

.timer-display .time-segment .label {
    font-size: 0.7em;
    text-transform: uppercase;
    color: grey;
    margin-top: 2px;
}

.timer-expired {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    font-weight: bold;
    color: #dc3545;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
    text-align: center;
    z-index: 1;
}

body.night-mode .timer-expired {
    color: #ff6b6b;
    background-color: rgba(0, 0, 0, 0.8);
}

.timer-controls {
    padding: 5px 10px;
    border-top: 1px solid var(--border-color, #eee);
    margin-top: 10px;
}

.set-time-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.set-time-area label {
    font-size: 0.9em;
    color: grey;
}

.set-time-area input[type="datetime-local"] {
    padding: 5px;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 3px;
    font-size: 0.9em;
    background-color: var(--input-bg, #fff);
    color: var(--input-text, #333);
}

body.night-mode .set-time-area input[type="datetime-local"] {
    background-color: #444;
    color: #ddd;
    border-color: #666;
}

.set-time-area .set-time-btn,
.running-controls button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s, opacity 0.2s;
}

.set-time-area .set-time-btn {
    background-color: var(--primary-btn-bg, #67a772);
    color: var(--primary-btn-text, #fff);
}

.set-time-area .set-time-btn:hover {
    opacity: 0.9;
}

.running-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.running-controls .pause-resume-btn {
    background-color: #ffc107;
    color: #333;
}

.running-controls .pause-resume-btn:hover {
    opacity: 0.9;
}

.running-controls .pause-resume-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.running-controls .change-time-btn {
    background-color: var(--secondary-btn-bg, #ccc);
    color: var(--secondary-btn-text, #333);
}

.running-controls .change-time-btn:hover {
    opacity: 0.9;
}

body.night-mode .running-controls .pause-resume-btn {
    background-color: #e0a800;
    color: #fff;
}

body.night-mode .running-controls .change-time-btn {
    background-color: #555;
    color: #ddd;
}

/* Add any other necessary styles */

/* Background Video Styles */
#background-video {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -1;
    /* << MODIFICATION: Ensure it's behind everything */
    object-fit: cover;
    /* Cover the entire viewport */
    opacity: 0.8;
    /* Slightly transparent */
}

/* Fade out video when app becomes active */
body.app-active #background-video {
    opacity: 0;
}

/* Added cover image styles */
.cover-image {
    width: 100%;
    height: auto;
    display: block;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

/* Welcome Screen Language Selector Clone Styles */
.welcome-lang-clone {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
    background-color: #333333;
    color: #ffffff;
    border: 1px solid #555555;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    z-index: 2010;
    pointer-events: auto;
}

.welcome-lang-clone:hover {
    background-color: #444444;
    transform: scale(1.1);
}

.welcome-lang-clone .language-options {
    background-color: #2a2a2a;
    border-color: #444444;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    top: 50px;
    left: 0;
    right: auto;
}

.welcome-lang-clone .language-option {
    color: #e2e2e2;
}

.welcome-lang-clone .language-option:hover {
    background-color: #444444;
}

/* Make original language selector only visible when app is active */
#language-selector {
    /* visibility: hidden; */
}

body.app-active #language-selector {
    /* visibility: visible; */
}

/* Simplified strip */
.node .strip {
    height: 10px;
    border-radius: 8px 8px 0 0;
    cursor: grab;
    position: relative;
    /* Removed flexbox and button styles */
}

/* Removed .delete, .node-type-switch, .node-visibility-toggle styles */

/* Unified Hover effect - applied to all strip buttons */
/* These styles are now obsolete as the buttons are removed */
/* .node .strip .delete:hover,
.node .strip .node-type-switch:hover,
.node .strip .node-visibility-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
} */

/* Google Sign-In Button */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    /* White background */
    color: #757575;
    /* Google gray text */
    border: 1px solid #dadce0;
    border-radius: 8px;
    /* Match other buttons */
    padding: 12px 20px;
    /* Match other buttons */
    font-size: 16px;
    /* Match other buttons */
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.google-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
}

.google-btn:active {
    background-color: #ededed;
}

.divider {
    border: none;
    height: 1px;
    background-color: #e0e0e0;
    /* Light gray separator */
    margin: 15px 0;
}

body.night-mode .divider {
    background-color: #444;
    /* Darker separator for night mode */
}

/* Adjust Welcome Modal Content for potential scrolling */
#welcome-modal .modal-content {
    /* max-height: 80vh; /* Adjusted in JS when needed */
    /* overflow-y: auto; /* Adjusted in JS when needed */
    transition: max-height 0.3s ease;
    /* Smooth height transition */
}

/* Re-add Drive Dashboard Styles */
#drive-dashboard {
    margin-top: 15px;
}

.drive-title {
    text-align: left;
    margin-left: 10px;
    /* Optional: Add some left margin for better spacing */
    color: var(--text-color);
    font-size: 18px;
}

.drive-list-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--modal-border);
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: var(--bg-color);
}

body.night-mode .drive-list-container {
    background-color: #2f2f2f;
}

.drive-file-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--modal-border);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.drive-file-item:last-child {
    border-bottom: none;
}

.drive-file-item:hover {
    background-color: var(--button-hover);
}

.drive-file-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    object-fit: contain;
}

.drive-file-name {
    flex-grow: 1;
    color: var(--text-color);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.drive-file-modified {
    font-size: 0.8em;
    color: grey;
    white-space: nowrap;
}

.drive-loading,
.drive-empty {
    text-align: center;
    padding: 20px;
    color: grey;
}

.drive-dashboard-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
}

/* Re-add Style for Drive icon in tabs */
.tab-drive-icon {
    margin-left: 5px;
    color: #757575;
    font-size: 0.9em;
}

body.night-mode .tab-drive-icon {
    color: #aaa;
}

/* Re-add Welcome Modal Content adjustment */
#welcome-modal .modal-content {
    transition: max-height 0.3s ease;
}

/* Re-add Saving indicator for tabs */
.project-tab.saving .project-name::after {
    /* content: ' (Saving...)'; */
    content: '';
    font-style: italic;
    color: grey;
    margin-left: 4px;
}

/* Re-add Loading indicator for dashboard */
#drive-dashboard.loading .drive-list-container {
    opacity: 0.5;
    pointer-events: none;
}

#drive-dashboard-title {
    text-align: left;
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--text-color);
}

/* --- Drive Status Indicator Styles --- */
#drive-status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    margin-right: 5px;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.2s ease;
    cursor: default;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    vertical-align: middle;
}

#drive-status-indicator:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#drive-status-indicator .status-icon {
    margin-right: 0;
    font-size: 18px;
    /* Match history button icon size closer */
    line-height: 1;
    /* Ensure icon is centered vertically */
    display: flex;
    /* Center icon if needed */
    align-items: center;
    /* Center icon if needed */
    justify-content: center;
    /* Center icon if needed */
}

#drive-status-indicator .status-text {
    display: none;
    /* Hide the text */
}

/* Status-specific styles (adjust background and icon color) */
#drive-status-indicator.status-offline {
    background-color: #6c757d;
    color: white;
}

#drive-status-indicator.status-pending {
    background-color: #ffc107;
    color: #333;
}

#drive-status-indicator.status-saving {
    background-color: #007bff;
    color: white;
}

#drive-status-indicator.status-saving .status-icon i {
    animation: fa-fade 1.5s infinite;
}

#drive-status-indicator.status-synced {
    background-color: #28a745;
    color: white;
}

#drive-status-indicator.status-error {
    background-color: #dc3545;
    color: white;
}

/* Night mode adjustments */
body.night-mode #drive-status-indicator {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.night-mode #drive-status-indicator:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

body.night-mode #drive-status-indicator.status-offline {
    background-color: #495057;
}

body.night-mode #drive-status-indicator.status-pending {
    background-color: #e9b400;
    color: #111;
}

body.night-mode #drive-status-indicator.status-saving {
    background-color: #0056b3;
}

body.night-mode #drive-status-indicator.status-synced {
    background-color: #1e7e34;
}

body.night-mode #drive-status-indicator.status-error {
    background-color: #b02a37;
}

/* Node Type Switcher Styles (copied from language selector for consistency) */
/* Ensure any actual existing styles below this point are preserved */

/* Specific override for Welcome Modal close button */
.welcome-close-override {
    display: none;
    /* Initially hidden */
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #aaa;
    /* Adjust color as needed */
    cursor: pointer;
    z-index: 2500;
    /* << MODIFICATION: Further increased z-index */
}

.welcome-close-override:hover,
.welcome-close-override:focus {
    color: #333;
    /* Darker color on hover */
    text-decoration: none;
}

/* Node resize handle */
.node-resize-handle {
    position: absolute;
    bottom: -1rem;
    right: -1rem;
    width: 28px;
    height: 28px;
    cursor: nwse-resize;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    border-radius: 0 0 8px 0;
}

.node:hover .node-resize-handle {
    opacity: 0.8;
    /* Increased opacity for better visibility */
}

.node-resize-handle:hover {
    opacity: 1 !important;
    transform: scale(1.1);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
    /* Add subtle shadow for depth */
}

body.night-mode .node-resize-handle path {
    stroke: #4CAF50;
    /* Tekrar yeşil yapalım */
}

body.resizing-node {
    cursor: nwse-resize !important;
    user-select: none;
    transition: none !important;
    /* Disable transitions when resizing */
}

body.resizing-node .node {
    transition: none !important;
    /* Disable transitions when resizing */
}

/* Disable the old media-resizable classes */
.media-resizable {
    position: relative;
    display: inline-block !important;
    resize: none !important;
    /* Remove any special styling */
}

.resize-handle {
    display: none !important;
    /* Force hide old resize handles */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.media-resizable:hover .resize-handle {
    display: none !important;
    /* Force hide old resize handles on hover */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Ensure media elements scale correctly with node */
.node .content img,
.node .content iframe {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Content-only mode styles */
.node.content-only-mode {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.node.content-only-mode .strip,
.node.content-only-mode .pin {
    opacity: 0;
    visibility: hidden;
    /* Removed transition completely for instant toggle */
    transition: none;
}

.node.content-only-mode:not(.selected):hover .strip,
.node.content-only-mode:not(.selected):hover .pin {
    opacity: 0.5;
    visibility: visible;
}

.node.content-only-mode:hover .strip,
.node.content-only-mode:hover .pin {
    opacity: 0.5;
    visibility: visible;
    transition: opacity 0.1s ease;
    /* Fast transition only on hover */
}

.node.content-only-mode .node-resize-handle {
    opacity: 0;
    visibility: hidden;
}

.node.content-only-mode:not(.selected):hover .node-resize-handle {
    opacity: 0.3;
    visibility: visible;
}

/* NEW: Selection style for content-only nodes */
/* NEW: Selection style for content-only nodes */
.node.content-only-mode.selected .content {
    outline: 2px dashed var(--primary-btn-bg, #67a772);
    background-color: rgba(103, 167, 114, 0.1);
    border-radius: 5px;
    box-shadow: 0 0 0 4px rgba(103, 167, 114, 0.1);
}

body.night-mode .node.content-only-mode.selected .content {
    outline-color: var(--primary-btn-bg, #67a772);
    background-color: rgba(103, 167, 114, 0.15);
}

/* Night mode adjustments - ONLY FOR UNSELECTED NODES */
body.night-mode .node.content-only-mode:not(.selected):hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    /* Lighter, cheaper background */
    box-shadow: none !important;
    /* Remove expensive shadow */
}

body.night-mode .node.content-only-mode:not(.selected):hover .strip,
body.night-mode .node.content-only-mode:not(.selected):hover .pin {
    opacity: 0.6;
}

body.night-mode .node.content-only-mode:not(.selected):hover .node-resize-handle {
    opacity: 0.4;
}

/* Action Bar (Island) Styles */
.action-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 3001;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 200px;
    justify-content: center;
}

body.night-mode .action-bar {
    background: rgba(30, 30, 30, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.action-bar-item {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.2em;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
}

.action-bar-item:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

body.night-mode .action-bar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.action-bar-item.primary {
    background: var(--primary-btn-bg);
    color: var(--primary-btn-text);
    box-shadow: 0 4px 12px rgba(103, 167, 114, 0.3);
}

.action-bar-item.primary:hover,
body.night-mode .action-bar-item.primary:hover {
    background: #85c490;
    /* Lighter green for visibility */
    transform: translateY(-2px) scale(1.05);
}

.action-bar-separator {
    width: 1px;
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 4px;
}

body.night-mode .action-bar-separator {
    background: rgba(255, 255, 255, 0.1);
}

.selection-count {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    min-width: 80px;
    text-align: center;
}

/* Tooltip for Action Bar Items */
.action-bar-item::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    margin-bottom: 8px;
}

.action-bar-item:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

body.night-mode .action-bar-item::after {
    background: rgba(255, 255, 255, 0.9);
    color: black;
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3001;
    /* Fix: Above blur overlay */
}





/* Command Palette (Spotlight) Styles */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    z-index: 4000;
}

.command-palette {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 4001;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
}

body.night-mode .command-palette {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cp-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.night-mode .cp-input-wrapper {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.cp-search-icon {
    font-size: 1.2em;
    color: #999;
    margin-right: 12px;
}

.cp-input {
    flex-grow: 1;
    border: none;
    background: none;
    font-size: 1.2em;
    color: var(--text-color);
    outline: none;
}

.cp-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.cp-category-header {
    padding: 8px 20px;
    font-size: 0.8em;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cp-result-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.1s;
}

.cp-result-item.selected,
.cp-result-item:hover {
    background-color: var(--primary-btn-bg);
    /* Use primary color for selection */
    color: white;
}

.cp-result-item.selected .cp-item-desc,
.cp-result-item:hover .cp-item-desc,
.cp-result-item.selected .cp-item-icon,
.cp-result-item:hover .cp-item-icon {
    color: rgba(255, 255, 255, 0.8);
}

.cp-item-icon {
    width: 30px;
    font-size: 1.1em;
    color: #666;
    display: flex;
    justify-content: center;
}

.cp-item-details {
    margin-left: 12px;
}

.cp-item-label {
    font-weight: 500;
    font-size: 1em;
}

.cp-item-desc {
    font-size: 0.8em;
    color: #888;
    margin-top: 2px;
}

.cp-no-results {
    padding: 20px;
    text-align: center;
    color: #999;
}

/* Fix for Content-Only Node Selection */
.node.content-only-mode {
    pointer-events: auto !important;
}

/* Make it easier to see where to click on hover */
.node.content-only-mode:hover {
    outline: 1px dashed rgba(0, 0, 0, 0.2);
    background-color: rgba(255, 255, 255, 0.1) !important;
}

body.night-mode .node.content-only-mode:hover {
    outline: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Bottom Blur Overlay */
.bottom-blur-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    /* Increased height for smoother fade */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
    z-index: 90;
    /* Below UI controls (z-index ~100-2000) but above canvas */
    mask-image: linear-gradient(to bottom, transparent, transparent 10%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent, transparent 10%, black 100%);
}

body.night-mode .bottom-blur-overlay {
    /* No background needed, just blur */
}

/* ===== Node Groups ===== */
.group {
    position: absolute;
    border: 2px dashed rgba(0, 0, 0, 0.2);
    border-radius: 32px;
    /* Significantly increased for very noticeable rounded corners */
    background: rgba(255, 255, 255, 0.05);
    pointer-events: all;
    cursor: move;
    z-index: 1;
    /* Behind nodes (which are z-index 10+) */
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.group:hover {
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.group.selected {
    border-color: #007bff;
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

/* Locked group indicator */
.group.locked {
    border-style: dashed !important;
    opacity: 0.85;
}

.group-label {
    position: absolute;
    top: 10px;
    left: 16px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
}

/* Night mode group styles */
body.night-mode .group {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.15);
}

body.night-mode .group:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.25);
}

body.night-mode .group.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

/* Objects Panel */
.objects-panel-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    /* Center align like action bar, or keep left but match style */
    /* User asked for bottom left, but "like action bar". Let's keep left but ensure same vertical alignment */
    left: 30px;
    z-index: 3001;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.objects-toggle-btn {
    /* Match .action-bar styles exactly */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 24px;
    /* Increased padding */
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    /* Increased gap */
    font-size: 1.2em;
    /* Increased font size */
    color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 200px;
    /* Ensure sufficient width */
    justify-content: space-between;
    min-height: 56px;
    /* Match Action Bar height */
}

.objects-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
}

body.night-mode .objects-toggle-btn {
    background: rgba(30, 30, 30, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: var(--text-color);
}

.objects-list {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 10px;
    width: 400px;
    /* Increased width */
    max-height: 0;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
    transform: translateY(20px);
}

body.night-mode .objects-list {
    background: rgba(30, 30, 30, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

.objects-panel-container.open .objects-list {
    max-height: 400px;
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.object-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
    color: var(--text-color);
}

.object-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.night-mode .object-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.object-item.selected {
    background: rgba(133, 196, 144, 0.2);
    border: 1px solid rgba(133, 196, 144, 0.5);
}

.item-icon {
    margin-right: 12px;
    width: 24px;
    text-align: center;
    opacity: 0.8;
    font-size: 1.1em;
}

.item-thumbnail {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1em;
    font-weight: 500;
}

.item-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    /* Ensure buttons are clickable */
    pointer-events: auto;
}

.object-item:hover .item-actions {
    opacity: 1;
}

.group-toggle-icon {
    transition: transform 0.2s;
}

.group-toggle-icon:hover {
    color: var(--primary-btn-bg, #67a772);
}

.action-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    padding: 6px;
    /* Increased padding */
    color: var(--text-color);
    opacity: 0.8;
    border-radius: 6px;
    font-size: 1em;
    /* Increased icon size */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

body.night-mode .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.group-nodes-container {
    padding-left: 20px;
    border-left: 2px solid rgba(0, 0, 0, 0.05);
    margin-left: 10px;
    margin-bottom: 4px;
}

body.night-mode .group-nodes-container {
    border-left-color: rgba(255, 255, 255, 0.1);
}

.objects-empty {
    padding: 20px;
    text-align: center;
    opacity: 0.5;
    font-size: 0.9em;
}