/* Basic Setup */

.video-preview-container {
    position: relative;
    width: 100%;
    background-color: #000;
    /* Maintain a 16:9 aspect ratio for the container */
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
}

.video-preview-container video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* This ensures the video fits without being cropped or stretched */
}

#node-video-buttons-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10; /* Ensure overlay is on top */
    pointer-events: none; /* Allow clicks to pass through to the video below */
}

/* Button Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes slideInTop {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOutTop {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

@keyframes slideInBottom {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOutBottom {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

.video-overlay-button {
    /* responsive default size */
    font-size: clamp(14px, 3.5vw, 40px);
    white-space: pre-wrap;
    line-height: normal;
    pointer-events: auto;
    cursor: grab;
    animation-fill-mode: forwards;
    position: absolute;
    left: 0;
    top: 0;

    transition: none;
    will-change: transform, opacity;
    transform-origin: center;
}

/* Animation Classes */
.anim-fade-in {
    animation-name: fadeIn;
}

.anim-fade-out {
    animation-name: fadeOut;
}

.anim-slide-left {
    animation-name: slideInLeft;
}

.anim-slide-out-left {
    animation-name: slideOutLeft;
}

.anim-slide-right {
    animation-name: slideInRight;
}

.anim-slide-out-right {
    animation-name: slideOutRight;
}

.anim-slide-top {
    animation-name: slideInTop;
}

.anim-slide-out-top {
    animation-name: slideOutTop;
}

.anim-slide-bottom {
    animation-name: slideInBottom;
}

.anim-slide-out-bottom {
    animation-name: slideOutBottom;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border: 1px solid #000;
    z-index: 20;
    pointer-events: auto;
}
.resize-handle.tl { top: -4px; left: -4px; cursor: nwse-resize; }
.resize-handle.tr { top: -4px; right: -4px; cursor: nesw-resize; }
.resize-handle.bl { bottom: -4px; left: -4px; cursor: nesw-resize; }
.resize-handle.br { bottom: -4px; right: -4px; cursor: nwse-resize; }

:root {
    --background-light: #f4f4f9;
    --text-light: #333;
    --primary-light: #6200ee;
    --primary-variant-light: #3700b3;
    --secondary-light: #03dac6;
    --card-bg-light: #fff;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);

    --background-dark: #121212;
    --text-dark: #e0e0e0;
    --primary-dark: #bb86fc;
    --primary-variant-dark: #3700b3;
    --secondary-dark: #03dac6;
    --card-bg-dark: #1e1e1e;
    --shadow-dark: 0 4px 8px rgba(0,0,0,0.25);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 2rem;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode {
    background-color: var(--background-light);
    color: var(--text-light);
}

body.dark-mode {
    background-color: var(--background-dark);
    color: var(--text-dark);
}

#app {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--primary-light);
}
body.dark-mode input:checked + .slider {
    background-color: var(--primary-dark);
}
input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Dashboard */
#dashboard h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}
body.dark-mode #dashboard h2 {
    border-bottom-color: #444;
}

.projects-grid{
    display:flex;
    flex-direction:column;
    gap:8px;
}
.project-card{
    display:flex;
    align-items:center;
    gap:20px;
    padding:12px 16px;
    border:1px solid var(--border-color, #ddd);
    border-radius:6px;
    transition:background 0.15s;
}
.project-card:hover{background:var(--hover-bg,#f7f7f7);}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.project-card {
    padding: 1.5rem;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

body.light-mode .project-card {
    background-color: var(--card-bg-light);
    box-shadow: var(--shadow-light);
}

body.dark-mode .project-card {
    background-color: var(--card-bg-dark);
    box-shadow: var(--shadow-dark);
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-card h3 {
    margin-top: 0;
}

#nodes-container {
    position: relative; /* Essential for positioning draggable nodes */
    width: 100%;
    height: 100%;
    min-height: 500px; /* Ensure container has a size */
    z-index: 1; /* Nodes above SVG container */
}

.card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap; /* Ensure buttons wrap on smaller cards */
}

.project-grid p {
    opacity: 0.7;
}

/* Buttons */
button,
.button { /* Adding .button class for non-button elements styled as buttons */
    display: inline-block;
    padding: 0.6em 1.2em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 6px;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.1s ease-in-out;
}

button:focus,
.button:focus {
    outline: 0;
    /* Example focus shadow, you might want to use theme variables */
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb, 0, 123, 255), 0.25);
}

button:hover:not(:disabled),
.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:active:not(:disabled),
.button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

button:disabled,
.button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Light Mode Button Hover Shadow */
body.light-mode button:hover:not(:disabled),
body.light-mode .button:hover:not(:disabled) {
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

/* Dark Mode Button Hover Shadow */
body.dark-mode button:hover:not(:disabled),
body.dark-mode .button:hover:not(:disabled) {
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

/* Primary Buttons (e.g., New Project) */
.primary-btn {
    color: #fff; /* Default text color for primary buttons */
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}
body.light-mode .primary-btn {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}
body.light-mode .primary-btn:hover:not(:disabled) {
    background-color: var(--primary-variant-light);
    border-color: var(--primary-variant-light);
}
body.dark-mode .primary-btn {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #121212; /* High contrast text for dark mode primary */
}
body.dark-mode .primary-btn:hover:not(:disabled) {
    background-color: #a970f5; /* Slightly adjusted hover for dark primary */
    border-color: #a970f5;
}

/* Secondary/Default Buttons */


body.light-mode .secondary-btn,
body.light-mode .header-action-btn:not(.danger),
body.light-mode .card-actions .edit-project-btn,
body.light-mode #back-to-dashboard-btn {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #ced4da;
}
body.light-mode .secondary-btn:hover:not(:disabled),
body.light-mode .header-action-btn:not(.danger):hover:not(:disabled),
body.light-mode .card-actions .edit-project-btn:hover:not(:disabled),
body.light-mode #back-to-dashboard-btn:hover:not(:disabled) {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

body.dark-mode .secondary-btn,
body.dark-mode .header-action-btn:not(.danger),
body.dark-mode .card-actions .edit-project-btn,
body.dark-mode #back-to-dashboard-btn {
    color: #e9ecef;
    background-color: #343a40;
    border-color: #495057;
}
body.dark-mode .secondary-btn:hover:not(:disabled),
body.dark-mode .header-action-btn:not(.danger):hover:not(:disabled),
body.dark-mode .card-actions .edit-project-btn:hover:not(:disabled),
body.dark-mode #back-to-dashboard-btn:hover:not(:disabled) {
    background-color: #495057;
    border-color: #5a6268;
}

/* Danger Buttons (Delete buttons) */
.danger,
.danger-btn {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}
body.light-mode .danger,
body.light-mode .danger-btn {
    background-color: #dc3545;
    border-color: #dc3545;
}
body.light-mode .danger:hover:not(:disabled),
body.light-mode .danger-btn:hover:not(:disabled) {
    background-color: #c82333;
    border-color: #bd2130;
}
body.dark-mode .danger,
body.dark-mode .danger-btn {
    background-color: #e63946; /* Brighter red for dark mode */
    border-color: #e63946;
}
body.dark-mode .danger:hover:not(:disabled),
body.dark-mode .danger-btn:hover:not(:disabled) {
    background-color: #d02c3a;
    border-color: #c12835;
}

/* Ensure specificity for header action buttons that are also danger buttons */


/* Preview Overlay Close Button */
#close-preview-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 30px;
  font-weight: bold;
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1002;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#close-preview-btn:hover {
  color: #ddd;
}

/* Form Range Slider Style */
.form-range {
    width: 100%;
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-range:focus {
    outline: 0;
}

.form-range::-webkit-slider-thumb {
    width: 1rem;
    height: 1rem;
    margin-top: -0.35rem; /* Centers thumb on track */
    background-color: var(--primary-light);
    border: 0;
    border-radius: 1rem;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
body.dark-mode .form-range::-webkit-slider-thumb {
    background-color: var(--primary-dark);
}

.form-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.25rem;
    cursor: pointer;
    background-color: #dee2e6;
    border-radius: 1rem;
}
body.dark-mode .form-range::-webkit-slider-runnable-track {
    background-color: #495057;
}

#node-video-preview-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    width: 85%; /* Slightly smaller than 100% */
    margin: 0 auto; /* Center in the available space */
    max-width: 1000px; /* Prevent it from getting too large */
}

#node-video-preview {
    width: 100%; /* Fill the container width */
    height: auto; /* Maintain aspect ratio automatically */
    aspect-ratio: 16/9; /* Force 16:9 aspect ratio */
    object-fit: contain; /* Ensure no cropping */
}

/* Node Editor Panel */
#node-editor-panel {
    background-color: rgba(0,0,0,0.9);
    background-color: #2f2f2f; /* Darker gray background */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-dark, #000);
    opacity:0.95;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#node-editor-panel.hidden {
    display: none !important;
}

.panel-container {
    width: 100vw;
    height: 100vh;


    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.light-mode .panel-container {
    background-color: var(--background-light, #222);
    color: #ffffff;
}


body.dark-mode .panel-container {
    background-color: var(--background-dark, #000);
    color: #ffffff;
}


.panel-header {
    color:#fff;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

/* Styles for embed container buttons */
.video-overlay-button.embed-container {
    overflow: auto; /* Make content scrollable if it overflows */
    padding: 0; /* Remove padding to allow content to fill the space */
    display: block; /* Override flex display for embeds */
    background-color: transparent; /* Optional: make button background see-through */
    border: 1px solid #888; /* Optional: add a border to frame the content */
}

/* Ensure iframes (common for embeds) fill the button container */
.video-overlay-button.embed-container > iframe {
    width: 100%;
    height: 100%;
    border: none; /* Remove default iframe border */
}

/* Style separator for button editor sections */
hr.style-separator {
    border: none;
    border-top: 1px solid #444; /* Darker line for dark mode, adjust as needed */
    margin: 1rem 0;
    width: 100%;
}

body.light-mode hr.style-separator {
    border-top: 1px solid #ddd; /* Lighter line for light mode */
}

.shadow-options {
    display: grid; /* Use grid for alignment */
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Responsive columns */
    gap: 10px; /* Spacing between items */
    width: 100%; /* Take full width */
    padding-top: 10px;
}

.form-group.full-width {
    grid-column: 1 / -1; /* Make element span all columns */
    display: flex;
    align-items: center; /* Vertically align label and checkbox */
}

.checkbox-label {
    margin-right: 10px; /* Space between label and checkbox */
}

.form-check-input {
    /* Style checkbox if needed, often browser default is fine or needs specific styling */
    width: auto; /* Override any global input width if necessary */
    margin-top: 0; /* Align with label */
}

.panel-content {
    color:#fff;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px; /* Flexible main content, fixed sidebar */
    gap: 20px;
    padding: 20px;
    height: calc(100% - 60px); /* Adjust for header height */
    overflow-y: auto; /* Make the entire panel scrollable */
}

.node-main-content {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between video and timeline */
    min-width: 0; /* Allow the container to shrink below its intrinsic width */
    min-height: 0; /* Allow the container to shrink below its intrinsic height */
}


.button-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-left: 1px solid var(--border-color);
    padding-left: 20px;
}

/* Timeline Scrubber */
.timeline-container {
    margin-top: 10px;
}

#timeline-scrubber {
    position: relative;
    width: 100%;
    /* height: 20px; */ /* Allow height to be determined by content */
    cursor: pointer;
}

body.light-mode #timeline-scrubber {
    background-color: #e0e0e0;
}

body.dark-mode #timeline-scrubber {
    background-color: #333;
}

#timeline-playhead {
    position: absolute;
    top: -5px;
    left: 0;
    width: 4px;
    height: 30px;
    background-color: #e53935;
    pointer-events: none;
    z-index: 2;
}

#timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.timeline-marker {
    position: absolute;
    top: 0;
    width: 6px;
    height: 20px;
    transform: translateX(-3px);
    cursor: pointer;
}

body.light-mode .timeline-marker {
    background-color: var(--primary-light);
}

body.dark-mode .timeline-marker {
    background-color: var(--primary-dark);
}

#add-button-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
}

/* Button Editor List */
#buttons-list {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px;
}

.button-item {
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

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

.button-item.selected {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
    color: var(--primary-color-contrast);
}

body.dark-mode .button-item.selected {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Preview Overlay */
#preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#preview-overlay.hidden {
    display: none !important;
}

#preview-video {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
}

#preview-buttons-container {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 1001;
}

.preview-button {
    padding: 0.75rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--primary-dark);
    background-color: rgba(0, 0, 0, 0.5);
    color: var(--primary-dark);
    transition: all 0.2s ease;
}

.preview-button:hover {
    background-color: var(--primary-dark);
    color: #000;
}

#close-preview-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
}

/* Editor View */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

#visual-flow-editor {
    position: relative;
    width: 100%;
    height: 70vh;
    border-radius: 8px;
    overflow: hidden; /* Changed from auto to hidden to contain absolute nodes */
    border: 1px solid #ddd;
}

body.light-mode #visual-flow-editor {
    background-color: var(--background-light);
}

body.dark-mode #visual-flow-editor {
    background-color: #000;
    border-color: #333;
}



.video-node {
    position: absolute;
    border-radius: 8px;
    padding: 1rem;
    width: 220px;
    cursor: move;
    user-select: none;
    transition: box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.25);
    transition: border-color 0.2s;
}

body.dark-mode .video-node {
    border: 1px solid rgba(255,255,255,0.25);
}

.video-node.selected {
    border-color: var(--primary-light);
}

body.dark-mode .video-node.selected {
    border-color: var(--primary-dark);
}

.video-node:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

body.dark-mode .video-node:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

.video-node h4,
.node-thumbnail-placeholder {
    pointer-events: none; /* Prevent h4 from interfering with drag */
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-thumbnail-placeholder {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.9rem;
}

body.light-mode .node-thumbnail-placeholder {
    background-color: #e0e0e0;
    color: #666;
}

body.dark-mode .node-thumbnail-placeholder {
    background-color: #333;
    color: #999;
}

.node-selected {
    border: 2px solid #007bff !important; /* Blue border for selected node, !important to override existing */
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5); /* Optional: add a glow */
}

.video-overlay-button {
    cursor: pointer; /* Default pointer cursor */
}

.video-overlay-button:active {
    cursor: grabbing; /* Cursor for when the button is being clicked/dragged */
}

.video-overlay-button:hover {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    /* transform: scale(1.02); */
}

#connections-svg {
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:2; /* Above nodes container, but SVG itself is pointer-events:none */
    pointer-events: none; /* SVG container doesn't block clicks to nodes */
}

#connections-svg path {
    pointer-events:stroke; /* Paths themselves are clickable */
    cursor:pointer;
    stroke-width:6px; /* Match JS, easier to click */
    fill:none;
    transition:stroke 0.2s;
}

/* End action dropdown width */
#node-end-target-node,
#node-end-target-url{
    width:100%;
    margin-top:8px;
}

.node-input,.node-output{
    z-index:3;
    position:absolute;
    width:10px;height:10px;border-radius:50%;background:var(--primary-light);cursor:crosshair;
    transform:translate(-50%,-50%);
}
body.dark-mode .node-input,body.dark-mode .node-output{background:var(--primary-dark);}
.node-input{left:-5px;top:50%;}
.node-output{right:-5px;top:50%;}
.node-input.hover,.node-output.hover{box-shadow:0 0 0 3px rgba(0,0,0,0.2);} 

/* connection path clickable */
.connection{cursor:pointer;pointer-events:stroke;}


/* Preview Overlay */
#preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#preview-overlay.hidden {
    display: none !important;
}

#preview-video {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
}

#preview-buttons-container {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 1001;
}

.preview-button {
    padding: 0.75rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--primary-dark);
    background-color: rgba(0, 0, 0, 0.5);
    color: var(--primary-dark);
    transition: all 0.2s ease;
}

.preview-button:hover {
    background-color: var(--primary-dark);
    color: #000;
}

#close-preview-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
}

body.light-mode #connections-svg path {
    stroke: #a0a0a0;
}

body.dark-mode #connections-svg path {
    stroke: #555;
}

#connections-svg path:hover {
    stroke: #e53935;
}

/* Exported Player Styles */
.player-container {
    position: relative;
    width: 100%;
    max-width: 1280px; /* Or any desired max-width */
    margin: auto;
    aspect-ratio: 16 / 9;
    background-color: #000;
}

#player-video {
    width: 100%;
    height: 100%;
}

#player-buttons-container {
    position: absolute;
    bottom: 15%; /* Position higher to avoid controls */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 2147483647; /* Max z-index */
}

.player-button {
    padding: 0.75rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #FFFFFF;
    background-color: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    transition: all 0.2s ease;
}

.player-button:hover {
    background-color: #FFFFFF;
    color: #000000;
}

/* --- Visual Button Editor Styles --- */
.video-preview-container {
    position: relative; /* This is crucial for the overlay */
}

.video-buttons-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to go through to the video */
}

#timeline-scrubber {
    position: relative;
}

#timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to pass through to the scrubber */
}

.timeline-button-bar {
    position: absolute;
    pointer-events: auto; /* Allow clicks on the bars themselves */
    z-index: 5; /* Ensure bars are above other elements in the same stacking context */
    height: 100%; /* Fill the height of timeline-markers */
    background-color: #3498db; /* Blue */
    border-radius: 2px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: white;
    font-size: 10px; /* Small font for the bar */
    text-align: center;
    white-space: nowrap;
    /* text-overflow: ellipsis; Applied to inner span */
    pointer-events: none; /* So they don't interfere with scrubber clicks */
    opacity: 0.75; /* Slight transparency */
}

.timeline-button-bar span { /* For text content within the bar */
    padding: 0 3px;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* Ensure text stays on one line */
}

@keyframes pulseScale {
    0%,100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes pulseOverlay {
    0%,100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

.interactive-button-preview {
    position: absolute;
    cursor: move;
    pointer-events: all; /* Make the buttons themselves clickable */
    transform: translate(-50%, -50%);
    border: 2px dashed var(--primary-color);
    padding: 10px 20px;
    background-color: rgba(0, 123, 255, 0.5);
    color: white;
    border-radius: 5px;
    font-size: 16px;
    white-space: nowrap;
    transition: transform 0.2s ease;
}

.interactive-button-preview:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.video-overlay-button,
.interactive-button {
    transition: transform 0.3s cubic-bezier(0.25,0.8,0.25,1) !important;
}

.video-overlay-button:hover,
.interactive-button:hover {
    transform: scale(1.1) !important;
}

.interactive-button-preview.dragging {
    opacity: 0.7;
    border-style: solid;
    z-index: 1000; /* Ensure dragging button is on top */
}

.button-item .style-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.button-item .style-group {
    display: flex;
    flex-direction: column;
}

.button-item .style-group label {
    font-size: 0.8em;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.button-item .style-group input[type="color"] {
    width: 40px;
    height: 25px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.button-item .style-group input {
    max-width: 80px;
}

/* Entrance Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.anim-fade { animation: fadeIn 0.5s ease forwards; }

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity:0; }
    to { transform: translateX(0); opacity:1; }
}
.anim-slide-left { animation: slideInLeft 0.5s ease forwards; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity:0; }
    to { transform: translateX(0); opacity:1; }
}
.anim-slide-right { animation: slideInRight 0.5s ease forwards; }

@keyframes slideInTop {
    from { transform: translateY(-100%); opacity:0; }
    to { transform: translateY(0); opacity:1; }
}
.anim-slide-top { animation: slideInTop 0.5s ease forwards; }

@keyframes slideInBottom {
    from { transform: translateY(100%); opacity:0; }
    to { transform: translateY(0); opacity:1; }
}
.anim-slide-bottom { animation: slideInBottom 0.5s ease forwards; }

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}