.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
}

h1 {
    margin: 0;
    font-size: 30px;
}

.main-container {
    display: flex;
    /* flex-direction: column; */
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: hidden;
}
  
/*.graphCanvas {
    border: 1px solid #ccc;
  }*/

  #graphCanvas {
    display: block;
    width: 100%;  /* Make it take 100% of its parent's width */
    height: 100%; /* Make it take 100% of its parent's height */
    /* background-color: #f9f9f9; */
}

.manual-btn {
  background-color: #e0e0e0;
  color: black;
  border: none;
  padding: 2px 16px;
  border-radius: 6px;
  cursor: pointer;
  /* font-weight: bold; */
  font-size: 0.95rem;
  transition: background-color 0.2s;
}

.manual-btn:hover {
  background-color: #d0d0d0;
}

.overlay-wrapper {
  position: relative;
  display: none;    /* display activated in setOverlayCanvas function in overlayCanvas.ts */
  top: 0;
  left: 0; 
  z-index: 10;  /* higher than the main canvas */
  width: 105% /*  238px */;
  height: 150px;
  /* display: inline-block; */
  /* resize: both;            /* enables resize */
  /* overflow: hidden;        /* needed for resize */
  /* border: 2px solid black; */
  contain: layout paint;
    transition: transform 0.2s ease-in-out;
  transform-origin: top left;
}

/* .overlay-wrapper:hover{
    transform: scale(3);
} */

.overlay-wrapper.grow {
  width: 315%;   /* 3× width */
  height: 405px; /* 3× height */
}

.overlay-canvas-container{
  position: relative;
  display: inline-block;
  z-index: 15;
  contain: layout paint;
  transition: transform 0.2s ease-in-out;
  transform-origin: top left;
}

/* .overlay-canvas-container.grow {
  width: 705px;
  height: 375;
}

/* .overlay-canvas-container:hover{
  transform: scale(3);
} */

#overlayCanvas{
    width: 98%;
    height: 83%;
    /* pointer-events: none; /* <--- makes it display-only */
    /* width: 235px;
    height: 125px; */
    background-color: #f9f9f9;
    border: 2px solid black;
    transition: transform 0.2s ease-in-out;
    transform-origin: top left;
}

#overlayCanvas.grow {
  width: 705px;   /* 3× base size */
  height: 375px;
}

/* #overlayCanvas:hover{
  transform: scale(3);
} */

.overlay-btn {
  /* position: absolute; */
  top: 0;
  left: 0;
  /* height: 25px; */
  height: min-content(13%, 25px);

  padding: 2px 6px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #aaa;
  border-radius: 4px;
  cursor: pointer;
  z-index: 20; /* even above the canvas */
}

/* Basic styling for the entire page */
body {
    margin: 0;
    overflow: hidden; /* Prevent body scrollbars */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    justify-content: center;
    /* height: 100vh; /* Make body take full viewport height */
    font-family: sans-serif;
    background-color: #f0f0f0; /* Light grey background for the page */
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Hide horizontal scrollbar if not needed */
}

/* Container for the canvas, where you define its visual size and border */
#canvas-container {
    border: 1px solid #000; /* Black border around the canvas */
    background-color: white; /* White background for the actual drawing area */
    /* Define the visual size of your canvas container */
    /* Example: 80% of viewport width and 70% of viewport height */
    width: 70vw; 
    height: 85vh; 
    
    /* Or fixed pixel sizes: */
    /* width: 1200px; */
    /* height: 500px; */

    position: relative; /* Useful for positioning elements inside if needed later */
    display: inline-block; /*flex; /* Using flex to help center the canvas within this container */
    justify-content: center;
    align-items: center;
}

/*#graph-container {
    width: 100%;
    height: 400px;
    border: 1px solid #000;
    margin-bottom: 20px;
}*/

#left-column {
  display: flex;
  flex-direction: column;
  padding: 10px;
  width: 15vw; 
  height: 85vw;
}

/* Styling for the control buttons */
#controls {
    /* margin-top: 0px;*/ 
    display: grid;
    grid-template-columns: 1fr 1fr; /* two equal-width columns */
    gap: 5px; /* spacing between buttons */
    align-items: center;
    justify-content: center;
    justify-items: stretch;           /* make items stretch equally */
    /* width: 100%;
    box-sizing: border-box;
    /* flex-direction: column;*/ 
}

 #controls button,
#controls .export-dropdown,
#controls .info,
#controls input[type="file"] {
  width: 100%;  /* make elements stretch inside their grid cell */
  box-sizing: border-box;
}

#controls .info {
  text-align: center;
  grid-column: span 2; /* make Zoom info stretch across both columns */
}

/* .export-dropdown {
  position: relative;
} */

#controls button {
    padding: 5px 1px;
    font-size: 1em;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #e0e0e0;
    transition: background-color 0.2s ease;
    width: 70%;
    align-self: center;
    justify-self: center;
}

#controls button:hover {
    background-color: #d0d0d0;
}

#controls button:active {
    background-color: #c0c0c0;
}

.info {
  align-self: center;
  justify-self: center;
}

.upload-btn {
  display: block;
  padding: 5px 1px;
  font-size: 1em;
  font-family: sans-serif;
  cursor: pointer;
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  justify-self: center;
  text-align: center;
  width: 70%;
}

.upload-btn:hover {
  background-color: #d0d0d0;
}

/* #controls button {
    margin-right: 10px;
} */
.mode-container {
    display: flex;
    gap: 10px;
    /* margin-bottom: 10px; */
}

.mode-button {
    /* height: 50px; /* Adjust to your desired height */
    padding: 10px 20px;
    border: none;
    background-color: #ddd;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    color: #555;
    transition: background-color 0.2s ease;
}

.mode-button:hover {
    background-color: #ccc;
}

.mode-button.active {
    background-color: hsl(323, 70%, 53%);
    color: white;
}
  
.palette-container {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    width: 13vw;
    height: 85vw;
  }
  
  .palette {
    padding: 6px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    background: #fff;
    font-size: 12px;
    width: 175px; /* adjust width as needed */
  }
  
  .palette h3 {
    margin: 0 0 6px 0;
    font-size: 14px;
  }
  
  .palette label {
    margin-top: 4px;
    display: block;
    font-size: 11px;
  }
  
  .palette input,
  .palette select,
  .palette button {
    margin-top: 2px;
    margin-bottom: 6px;
    padding: 2px 4px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  

.palette.disabled {
    opacity: 0.5;
    pointer-events: none; /* Optional: prevents interaction */
}

.palette-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
  }
  
  .palette-row label {
    /* margin-right: 8px; */
    white-space: nowrap;
    flex: 1;
    font-size: 13px;
    width: 40%;
  }
  
  .palette-row input,
  .palette-row select {
    flex: 2;
    padding: 2px 4px;
    font-size: 12px;
    /* width: 30%; */
  }

.palette-header {
    display: flex; /* Allows H3 and icon to be on the same line */
    justify-content: space-between; /* Pushes H3 to left, icon to right */
    align-items: center; /* Vertically centers them */
    cursor: pointer; /* Indicates it's clickable */
    padding: 5px 0;
}

.palette-header h3 {
    margin: 0; /* Remove default margin from h3 */
    font-size: 1.2em; /* Adjust font size if needed */
}

.collapse-icon {
    transition: transform 0.3s ease-in-out; /* Smooth rotation */
    font-size: 1.2em; /* Adjust icon size */
}

/* Style for when the palette is collapsed (arrow points right) */
.palette.collapsed .collapse-icon {
    transform: rotate(180deg); /* Rotate to point left/up */
}

/* Initially hide the content */
.palette-content {
    max-height: 500px; /* A sufficiently large initial height */
    /* overflow: hidden; /* Hide content that exceeds max-height */
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out; /* Smooth transition */
    opacity: 1; /* Initially visible */
}

/* When the palette is collapsed, set content height to 0 and make it invisible */
.palette.collapsed .palette-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Optional: Add some padding/margin to palette-row for better spacing */
.palette-row {
    margin-bottom: 8px;
}

.palette-row:last-of-type {
    margin-bottom: 0;
}
  
  .shape-options {
    display: flex;
    flex-direction: row;
    gap: 5px;
  }
  
  .shape-button {
    width: 32px;
    height: 32px;
    font-size: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: background 0.2s;
  }
  
  .shape-button.active {
    background: lightblue;
    border-color: blue;
  }
  
  #toggle-dashed {
     /*margin-top: 2px; */
    padding: 3px 5px;
    font-size: 12px;
  }

  #toggle-dashed.active {
    background:  lightblue;
    border-color: blue;
  }

  /* NEW: Styles for the button group wrapper */
.edge-style-buttons {
    display: flex; /* Makes the buttons inside it align horizontally */
    flex-grow: 1; /* Allows this container to take up remaining space */
    gap: 8px; /* Adds space between the buttons */
}

/* NEW: Styles for the individual buttons (continuous and dashed) */
.edge-style-button {
    flex-grow: 1; /* Makes buttons grow equally to fill available space */
    flex-basis: 0; /* Ensures equal distribution even with varying content */
    height: 28px; /* Fixed height for consistent look */
    padding: 3px 5px;
    font-size: 12px; /* Set font size even if content is a span, for consistency */
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease; /* Smooth transition for active state */
    
    /* Center the line-preview span inside the button */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Hide any potential default text if button has content */
}

.edge-style-button:hover {
    background-color: #e0e0e0;
}

/* NEW: Active state styling */
.edge-style-button.active {
    background-color: lightblue;
    border-color: blue;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); /* Subtle blue glow */
}

/* NEW: Styling for the line previews inside the buttons */
/* Ensure the .line-preview has basic properties */
.line-preview {
    width: 80%; /* Adjust width of the line within its button */
    height: 2px; /* Thickness of the line */
    display: block; /* Make it a block element */
    background-color: black; /* Default solid color for continuous */
    border-radius: 1px; /* Slightly rounded ends for the line */
}

/* Specific styling for the dashed line */
.line-dashed {
    /* Important: Reset background-color to transparent to allow dashes to show */
    background-color: transparent; 

    /* Create the dashed effect using a linear gradient */
    /* Black for the dash, transparent for the gap */
    background-image: linear-gradient(to right, black 50%, transparent 50%);
    
    /* Define the size of one complete dash-and-gap segment */
    /* 6px total width for a segment (3px black + 3px transparent) */
    /* 2px height for the line thickness (same as line-preview height) */
    background-size: 6px 2px; 
    
    /* Ensure the pattern repeats horizontally across the span */
    background-repeat: repeat-x; 
    
    /* Optional: Remove border-radius if you prefer sharp dash ends */
    border-radius: 0; 
}

  #vertex-palette .palette-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }
  
  #vertex-palette .palette-row input[type="text"] {
    flex: 1;
    min-width: 50px;
    box-sizing: border-box;
    padding: 4px;
    font-size: 12px;
  }
  
  #vertex-palette .palette-row button {
    padding: 3px 3px;
    font-size: 12px;
    white-space: nowrap;
    /*flex-shrink: 0;*/
  }

/* #output {
    flex-shrink: 0; /* Prevents it from shrinking below its content size */
    /* You might also use min-height: fit-content; or similar 
} */

.label-value-pair {
    display: flex; /* Use flexbox for alignment */
    align-items: baseline; /* Align text baselines */
    margin-bottom: 5px; /* Adjust vertical spacing if needed */
}

.label-part {
    width: 220px; /* Adjust this width as needed */
    display: inline-block; /* Ensure width is respected */
    text-align: right; /* Align the label text to the right */
    margin-right: 10px; /* Add some space between label and value */
}

.ticked-label-part {
  width: 198px; /* width = label-part width minus tick-box width*/
  display: inline-block;
  text-align: right;
  margin-right: 10px;
}

/* .value-part{
  width: 15px;
  text-align: right;
}*/

/*
#vertex-show-labels,
label[for="vertex-show-labels"] {
  display: inline-block;
  vertical-align: middle; } /* align them nicely */

.show-label-checkbox {
  display: flex;
  /* align-items: baseline; /* keeps checkbox and label aligned vertically */
  gap: 5px;            /* optional spacing */
  white-space: nowrap;
  /* flex-grow: 1; */
}

.show-label-checkbox input[type="checkbox"]
{
    width: 10%;
    vertical-align: middle;
    margin: 0; /* reset default browser margins */
    /* align-items: center;    /* Vertically align items in the center */
}

.show-label-checkbox label {
    /* flex-grow: 1; /* Allow the label to take up remaining space */
    /* align-items: center;    /* Vertically align items in the center */
    width: 90%;
    font-size: 13px;
}

.tickbox-label-pair {
    display: flex;
    gap: 5px;
    /* align-items: center; /* Vertically align items in the center */
}

.tickbox-label-pair input[type="checkbox"] {
    /* margin-right: 5px; /* Add some space between checkbox and label */
    width: 10%;
    vertical-align: middle;
    margin: 0;
    /* margin-top: 7px;
    /* flex-shrink: 0; /* Prevent checkbox from shrinking */
}

.tickbox-label-pair label {
    /* flex-grow: 1; /* Allow the label to take up remaining space */
    white-space: nowrap; /* Still a good idea to prevent wrapping */
    font-size: 13px;
    width: 90%;
}

.context-menu {
    display: none; /* Initially hide the menu */
    position: absolute; /* Position it relative to the viewport */
    background-color: #fff; /* White background */
    border: 1px solid #ccc; /* Light gray border */
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow */
    z-index: 1000; /* Ensure it's on top of other elements */
    padding: 5px 0; /* Vertical padding */
    border-radius: 4px; /* Slightly rounded corners */
}

.context-menu ul {
    list-style: none; /* Remove bullet points */
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 8px 15px; /* Padding for each menu item */
    cursor: pointer; /* Indicate it's clickable */
    font-family: sans-serif; /* Readable font */
    font-size: 14px;
    color: #333; /* Dark gray text */
}

.context-menu li:hover {
    background-color: #f0f0f0; /* Light gray background on hover */
}

.cont-menu {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #aaa;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 5px 0;
  list-style: none;
  z-index: 1000;
}
.cont-menu li {
  padding: 6px 14px;
  cursor: pointer;
}
.cont-menu li:hover {
  background: #eee;
}

/* export button that appears with the selection rectangle  */
.export-btn-selection-rectangle {
  padding: 4px 8px;
  font-size: 12px;
  background: #ffffffcc;
  border: 1px solid #888;
  border-radius: 4px;
  cursor: pointer;
  z-index: 9999;
}

/* Styles for the Modal */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top (higher than most content) */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    /* Use flexbox to center the modal-content */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be a fixed width like 300px, or percentage */
    max-width: 500px; /* Max width for larger screens */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-radius: 8px;
    position: relative; /* Needed for positioning the close button */
}

.close-button {
    color: #aaa;
    float: right; /* Positions it to the top-right */
    font-size: 28px;
    font-weight: bold;
    position: absolute; /* Absolute position relative to modal-content */
    top: 10px;
    right: 15px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-content label {
    display: block; /* Make labels take their own line */
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.modal-content input[type="text"] {
    width: calc(100% - 20px); /* Adjust width to account for padding */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box; /* Include padding in width */
}

.modal-content input[type="text"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.modal-content input[type="text"]:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

.modal-actions {
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 10px; /* Space between buttons */
    margin-top: 15px;
    /* text-align: right; */
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.info-tooltip {
  position: absolute;
  background: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12px;
  max-width: 250px;
  z-index: 1000;
  pointer-events: auto;
  user-select: text; /* ✅ allow selecting and copying */
  white-space: normal;
  display: none;
}


.parameter {
  margin-left: 20px;
  margin-bottom: 10px;
}

#saveLabelButton {
    background-color: #28a745; /* Green for Save */
    color: white;
}

#saveLabelButton:hover {
    background-color: #218838;
}

#saveLabelButton:disabled {
    background-color: #90ee90; /* Lighter green when disabled */
    cursor: not-allowed;
}

#cancelLabelButton { /* Assuming you'll have a cancel button */
    background-color: #6c757d; /* Gray for Cancel */
    color: white;
}

#cancelLabelButton:hover {
    background-color: #5a6268;
}

/* In your CSS file */

.crossingColors {
    display: flex; /* Makes the div a flex container */
    justify-content: space-between; /* Pushes the first item (label) to the start and the last item (input) to the end */
    align-items: center; /* Vertically aligns items in the middle */
    margin-bottom: 15px; /* Adds some space below this section, adjust as needed */
    /* You might have other styles for this div, keep them */
}

.crossingColors label {
    /* If you had 'display: block;' or 'margin-bottom' previously, you might want to adjust them */
    margin-bottom: 0; /* Ensure no extra space pushes input down */
    padding-right: 10px; /* Optional: adds a little space between label and input */
    flex-shrink: 0; /* Prevent the label from shrinking if space is tight */
}

.crossingColors input[type="color"] {
    /* You might want to constrain the size of the color input */
    width: 50px; /* Adjust width as desired */
    height: 30px; /* Adjust height as desired */
    padding: 0; /* Color inputs often look better with no internal padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

/* your-styles.css */

/* Custom Alert Container */
.custom-alert {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place relative to the viewport */
    top: 20px; /* Distance from the top of the viewport */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust to truly center */
    z-index: 2000; /* High z-index to ensure it's on top of everything */
    padding: 15px 20px;
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* Soft shadow */
    font-family: 'Inter', sans-serif; /* Consistent font */
    color: white;
    font-size: 14px;
    opacity: 0; /* Start invisible for fade-in effect */
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out; /* Smooth transitions */
    min-width: 250px;
    max-width: 90%;
    text-align: center;
    box-sizing: border-box; /* Include padding in width */
}

/* Alert type: Warning (you can add more types like success, info, error) */
.custom-alert.warning {
    background-color: #ffc107; /* Orange/Yellow for warning */
    color: #343a40; /* Dark text for contrast */
}

/* Alert type: Error */
.custom-alert.error {
    background-color: #dc3545; /* Red for error */
    color: white;
}

/* Alert type: Success */
.custom-alert.success {
    background-color: #28a745; /* Green for success */
    color: white;
}

/* When the alert is active (visible) */
.custom-alert.active {
    display: block; /* Make it visible */
    opacity: 1; /* Fade in */
    transform: translateX(-50%) translateY(0); /* Ensure it's in final position */
}

.custom-alert-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

/* Close button for the alert */
.custom-alert-close {
    background: none;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: inherit; /* Inherit color from parent (.custom-alert) */
    cursor: pointer;
    line-height: 1; /* Align 'x' properly */
    padding: 0 5px;
    transition: color 0.2s ease;
}

.custom-alert-close:hover {
    color: #333; /* Darker color on hover */
}

.export-dropdown {
  position: relative;
  display: flex;
  width: 100%;
  justify-content: center;
}

/* .export-btn {
  background-color: #4CAF50;
  color: white;
  padding: 8px 12px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  border-radius: 6px;
} */

.export-menu {
  display: none;
  position: absolute;
  background-color: white;
  min-width: 160px;
  box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
  border-radius: 6px;
  z-index: 1;
}

.export-menu a {
  color: black;
  padding: 10px 14px;
  text-decoration: none;
  display: block;
}

.export-menu a:hover {
  background-color: #f1f1f1;
}

.export-dropdown:hover .export-menu {
  display: block;
}
