/* General Styles */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevents scrollbars */
}

#canvasContainer {
    position: relative;
    
    /* Centering */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    right: 0;
    bottom: 0;
    
    background-color: white;
    
    /* Set a default initial size or make it big enough */
    width: 3000px;
    height: 3000px;

    background-image: radial-gradient(circle, #CCC 1px, transparent 1px);
    background-size: 22px 22px; /* Adjust this to change the size of the grid cells */
}

#diagramArea {
    position: absolute;
    transform-origin: 0 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: pinch-zoom;
}

/* Code Area Styles */
#codeArea {
    position: absolute;
    display: flex;
    flex-direction: column;
    bottom: 10px;
    right: 10px;
    border-radius: 10px;
    width: 95%;
    height: 400px;
    max-width: 100vw;
    max-height: 100vh;
    background-color: white;
    box-shadow: 0 0 23px rgba(117, 117, 117, 0.5);
    border: none;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
    transition: width 0.3s ease, height 0.3s ease; /* Smooth transition for width and height */
}

@media (min-width: 768px) {
    #codeArea {
        width: 600px; /* Initial width */
    }
}

.CodeMirror {
    flex-grow: 1; /* Allow the editor to take up the remaining space */
    height: auto; /* Adjust the height automatically */
}

.CodeMirror-linenumbers {
    padding-right: 1px;
}

.CodeMirror-gutters {
    width: 45px !important;
}

.CodeMirror-errors {
    width: 10px;
}

/* Title Bar Styles */
#codeHeader {
    background-color: #d0d0d0;
    padding: 5px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    flex-shrink: 0; /* Prevent the header from resizing */
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid lightgray;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-weight: bold;
    font-size: 15px;
}

#codeHeader span {
    font-weight: bold;
}

#themePicker {
    width: 30px;
    flex-grow: 0; /* Prevent the picker from growing */
    flex-shrink: 0; /* Prevent the picker from shrinking */
}

#codeHeader > * {
    flex-shrink: 0;
}

#codeHeader > *:not(button) {
    flex-grow: 1;
}

#codeHeader button {
    margin-left: 0px; /* Add some space between buttons */
}

/* Button Styles */
#minimizeButton, #maximizeWidthButton, #maximizeHeightButton, #open, #save, #help, #colors, #zoomOutButton, #zoomInButton {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4em;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding-right: 4px;
    padding-left: 4px;
}

#helpModal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

#closeHelp {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
}

#helpContent {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    height: 50%;
    border-radius: 10px;
}

@media screen and (min-width: 1024px) {
    #helpContent {
        width: 40%;
    }
}

#textContent {
    font-family: Arial, sans-serif;
    overflow-x: auto;
    overflow-y: auto;
    height: 100%;
}

#textContent img {
    max-width: 100%;
    height: auto;
}

#textContent .token.keyword {
    color: purple;
    font-family: monospace;
    font-size: 14px;
    font-weight: bolder;
}

#textContent code, #textContent .token {
    color: black;
    font-family: monospace;
    font-size: 14px;
}

/* Text Area Styles */
#codeInput {
    font-family: monospace;
    width: 100%;
    height: 100%;
    border: none;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    resize: none; /* Disable resizing */
    padding: 5px;
    box-sizing: border-box;
}

#colorLegend {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-around;
    margin-left: 10px;
    margin-right: 10px;
    height: 40px;
}

@media screen and (max-width: 600px) {
    #colorLegend .PreConditionBar, .PolicyBar, .AttackBar, .UnmitigatedAttackBar, .PreEmptiveDefenseBar, .IncidentResponseBar {
        font-size: 8px;
    }
}

#colorLegend .PreConditionBar, .PolicyBar, .AttackBar, .UnmitigatedAttackBar, .PreEmptiveDefenseBar, .IncidentResponseBar {
    flex: 1;
    margin: 8px 10px 0 10px;
    height: 25px;
    border-radius: 50px;
    box-shadow: 0 0 10px rgba(117, 117, 117, 1.0);
}

#colorLegend .PreConditionBar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    color: black;
    background-color: lightgray;
}

#colorLegend .PolicyBar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: black;
    background-color: rgb(162, 205, 90); /* darkolivegreen3 in Graphviz */
}

#colorLegend .AttackBar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    color: white;
    background-color: red;
}

#colorLegend .UnmitigatedAttackBar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    color: red;
    background-color: yellow;
}

#colorLegend .PreEmptiveDefenseBar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    color: white;
    background-color: rgb(179, 0, 179);
}

#colorLegend .IncidentResponseBar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    color: white;
    background-color: blue;
}

/* Resizable Handle Styles */
.resize-handle {
    position: absolute;
    background-color: transparent;
    z-index: 10; /* Ensure they are above other elements */
}

.resize-handle.top {
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    cursor: ns-resize;
}

.resize-handle.left {
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
    cursor: ew-resize;
}

.resize-handle.corner {
    width: 15px;
    height: 15px;
    top: 0;
    left: 0;
    cursor: nwse-resize;
    background-color: transparent; /* To create an inverted L shape */
    border-top: 1px solid transparent;
    border-left: 1px solid transparent;
}

#statusBar {
    position: fixed;
    left: 10px;
    bottom: 10px;
    border-radius: 25px 25px 25px 25px;
    background-color: white; /* Example background color */
    color: #333; /* Example text color */
    text-align: left;
    padding: 5px;
    box-shadow: 0 0 23px rgba(117, 117, 117, 0.5);
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 16px;
}

.no-select {
    user-select: none; /* Standard syntax */
    -webkit-user-select: none; /* WebKit browsers */
    -moz-user-select: none; /* Old versions of Firefox */
    -ms-user-select: none; /* Internet Explorer/Edge */
}