/* CSS rules for CodeMirror */

/* Setter font og fontsize for koden */
.CodeMirror * {
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 14px;
}

.CodeMirror {
    height: auto !important;
    border-radius: 1.4rem !important;
}

/* Spesiell highlighting på utvalgte fraser i kommentarer */
.cm-todo {
    color: red !important;
    font-weight: bold !important;
}

.cm-fiksmeg {
    color: rgb(255, 0, 0) !important;
    font-weight: bold !important;
}

.cm-note {
    color: red !important;
    font-weight: bold !important;
}

.cm-fyllinn {
    color: red !important;
    font-weight: bold !important;
}

.cm-ignorer {
    color: red !important;
    font-weight: bold !important;
}

.cm-ikkerør {
    color: red !important;
    font-weight: bold !important;
}

.cm-fokus {
    color: rgb(0, 102, 128) !important;
    font-weight: bold !important;
}

.cm-forklaring {
    color: rgb(0, 102, 128) !important;
    font-weight: bold !important;
}

.cm-merk {
    color: red !important;
    font-weight: bold !important;
}

.cm-question {
    color: red !important;
    font-weight: bold !important;
}

/* Lager en border rundt kodeboksen for å utheve den */

[data-mode="light"] .CodeMirror {
    border: 1px solid black; /* Add a black border */
}

@media (prefers-color-scheme: light) {
    .CodeMirror {
        border: 1px solid black; /* Add a black border */
    }
}

[data-mode="dark"] .CodeMirror {
    border: 1px solid white; /* Add a black border */
}

@media (prefers-color-scheme: dark) {
    .CodeMirror {
        border: 1px solid white; /* Add a black border */
    }
}

.CodeMirror-linenumbers {
    padding-right: 10px; /* Adjust this value to change the space between line numbers and code */
}

/* Highlighting for error messages */
.error-message {
    white-space: pre-wrap;
}

.error-type {
    color: red;
    font-weight: bold !important;
}

.error-line {
    color: red;
    background-color: rgba(0, 161, 248, 0.305);
    font-weight: bold !important;
}

/* General button styles — pill shape to match answer-2 / solution-2 */
.ic-container .button {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    background: transparent;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin: 4px 2px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ic-container .button:focus {
    outline: none;
}

.ic-container .button svg {
    vertical-align: middle;
    width: 1.1em;
    height: 1.1em;
}

/* Run button — green */
.ic-container .button-run {
    border: 1.5px solid rgba(34, 197, 94, 0.5);
    color: inherit;
    background: transparent;
}

[data-mode=light] .ic-container .button-run {
    color: #166534;
    border-color: rgba(34, 197, 94, 0.5);
}

[data-mode=light] .ic-container .button-run:hover {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.75);
}

@media (prefers-color-scheme: light) {
    .ic-container .button-run {
        color: #166534;
        border-color: rgba(34, 197, 94, 0.5);
    }

    .ic-container .button-run:hover {
        background: rgba(34, 197, 94, 0.08);
        border-color: rgba(34, 197, 94, 0.75);
    }
}

[data-mode=dark] .ic-container .button-run {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.4);
}

[data-mode=dark] .ic-container .button-run:hover {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.65);
}

@media (prefers-color-scheme: dark) {
    .ic-container .button-run {
        color: #86efac;
        border-color: rgba(34, 197, 94, 0.4);
    }

    .ic-container .button-run:hover {
        background: rgba(34, 197, 94, 0.12);
        border-color: rgba(34, 197, 94, 0.65);
    }
}

/* Reset button — amber */
.ic-container .button-reset {
    border: 1.5px solid rgba(234, 179, 8, 0.5);
    color: inherit;
    background: transparent;
}

[data-mode=light] .ic-container .button-reset {
    color: #92400e;
    border-color: rgba(234, 179, 8, 0.5);
}

[data-mode=light] .ic-container .button-reset:hover {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.75);
}

@media (prefers-color-scheme: light) {
    .ic-container .button-reset {
        color: #92400e;
        border-color: rgba(234, 179, 8, 0.5);
    }

    .ic-container .button-reset:hover {
        background: rgba(234, 179, 8, 0.08);
        border-color: rgba(234, 179, 8, 0.75);
    }
}

[data-mode=dark] .ic-container .button-reset {
    color: #fde68a;
    border-color: rgba(234, 179, 8, 0.4);
}

[data-mode=dark] .ic-container .button-reset:hover {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.65);
}

@media (prefers-color-scheme: dark) {
    .ic-container .button-reset {
        color: #fde68a;
        border-color: rgba(234, 179, 8, 0.4);
    }

    .ic-container .button-reset:hover {
        background: rgba(234, 179, 8, 0.12);
        border-color: rgba(234, 179, 8, 0.65);
    }
}

/* Cancel button — red */
.ic-container .button-cancel {
    border: 1.5px solid rgba(239, 68, 68, 0.5);
    color: inherit;
    background: transparent;
}

[data-mode=light] .ic-container .button-cancel {
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.5);
}

[data-mode=light] .ic-container .button-cancel:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.75);
}

@media (prefers-color-scheme: light) {
    .ic-container .button-cancel {
        color: #991b1b;
        border-color: rgba(239, 68, 68, 0.5);
    }

    .ic-container .button-cancel:hover {
        background: rgba(239, 68, 68, 0.08);
        border-color: rgba(239, 68, 68, 0.75);
    }
}

[data-mode=dark] .ic-container .button-cancel {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

[data-mode=dark] .ic-container .button-cancel:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.65);
}

@media (prefers-color-scheme: dark) {
    .ic-container .button-cancel {
        color: #fca5a5;
        border-color: rgba(239, 68, 68, 0.4);
    }

    .ic-container .button-cancel:hover {
        background: rgba(239, 68, 68, 0.12);
        border-color: rgba(239, 68, 68, 0.65);
    }
}

.pythonoutput {
    max-height: 600px;
    overflow-y: auto;
}

.pythonoutput:empty::before {

    content: attr(data-placeholder);

    color: #7d8590;

    opacity: 0.55;

    font-style: italic;

    pointer-events: none;
}

html[data-mode="light"] .pythonoutput:empty::before {

    color: #9ca3af;

}

html[data-mode="dark"] .pythonoutput:empty::before {

    color: #6e7681;

}

/* Dynamically highlight error lines in editor */
.cm-highlight {
    background-color: rgba(255, 0, 0, 0.2); /* Light red background */
}

/* Change the background and text color of the highlighted selection */
.CodeMirror-selected {
    background-color: #0196bc41 !important;
}

/* Prediction containers */

/* Style for the prediction input container */
.prediction-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

.prediction-container label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.prediction-container textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 1.4rem;
    resize: vertical;
    font-family: Arial, sans-serif;
    font-size: 14px;
    background: inherit;
}

.button-lock-prediction {
    margin-top: 10px;
    background-color: #007bff; /* Blue background */
    color: #fff; /* White text */
}

.button-lock-prediction:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

.button-lock-prediction:active {
    background-color: #004080; /* Even darker blue on click */
    box-shadow: 0 5px #666; /* Shadow effect */
    transform: translateY(4px); /* Move button down */
}

/* Style for the prediction and output display container */
/* Base styles for the prediction and output display container */
.prediction-output-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 20px;
}

.prediction-display,
.output-display {
    flex: 1;
}

.prediction-display h3,
.output-display h3 {
    font-size: 18px;
    border-bottom: 2px solid;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.prediction-display pre,
.output-display pre {
    padding: 10px;
    border-radius: 4px;
    overflow: auto;
    max-height: 300px;
    border: 1px solid;
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 14px;
}

/* Light mode styles */
[data-mode="light"] .prediction-display h3,
[data-mode="light"] .output-display h3 {
    color: #333333;
    border-color: #cccccc;
}

[data-mode="light"] .prediction-display pre,
[data-mode="light"] .output-display pre {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #cccccc;
}

/* Dark mode styles */
[data-mode="dark"] .prediction-display h3,
[data-mode="dark"] .output-display h3 {
    color: #f1f1f1;
    border-color: #444444;
}

[data-mode="dark"] .prediction-display pre,
[data-mode="dark"] .output-display pre {
    background-color: #2b2b2b;
    color: #e1e1e1;
    border-color: #444444;
}

/* Auto mode styles based on system preference */
@media (prefers-color-scheme: dark) {
    [data-mode="auto"] .prediction-display h3,
    [data-mode="auto"] .output-display h3 {
        color: #f1f1f1;
        border-color: #444444;
    }
    [data-mode="auto"] .prediction-display pre,
    [data-mode="auto"] .output-display pre {
        background-color: #2b2b2b;
        color: #e1e1e1;
        border-color: #444444;
    }
}

@media (prefers-color-scheme: light) {
    [data-mode="auto"] .prediction-display h3,
    [data-mode="auto"] .output-display h3 {
        color: #333333;
        border-color: #cccccc;
    }
    [data-mode="auto"] .prediction-display pre,
    [data-mode="auto"] .output-display pre {
        background-color: #f8f9fa;
        color: #212529;
        border-color: #cccccc;
    }
}

/* General styles for the prediction container */
.prediction-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

.prediction-container textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 1.2rem !important;
    resize: vertical;
    font-family: Arial, sans-serif;
    font-size: 16px;
    border: 1px solid;
    background-color: inherit; /* Inherit background for consistency */
    color: inherit; /* Inherit text color */
}

/* Light mode styles for the prediction textarea */
[data-mode="light"] .prediction-container textarea {
    background-color: #ffffff;
    color: #212529;
    border-color: #cccccc;
}

/* Dark mode styles for the prediction textarea */
[data-mode="dark"] .prediction-container textarea {
    background-color: #0b0b0b;
    color: #e1e1e1;
    border-color: #444444;
}

/* Auto mode styles for the prediction textarea */
@media (prefers-color-scheme: dark) {
    [data-mode="auto"] .prediction-container textarea {
        background-color: #0b0b0b;
        color: #e1e1e1;
        border-color: #444444;
    }
}

@media (prefers-color-scheme: light) {
    [data-mode="auto"] .prediction-container textarea {
        background-color: #ffffff;
        color: #212529;
        border-color: #cccccc;
    }
}

/* Style for the placeholder text */
.prediction-container textarea::placeholder {
    font-size: 16px;
    color: #6c757d;
}

/* Placeholder styles for light mode */
[data-mode="light"] .prediction-container textarea::placeholder {
    color: #6c757d;
}

/* Placeholder styles for dark mode */
[data-mode="dark"] .prediction-container textarea::placeholder {
    color: #bbbbbb;
}

/* Placeholder styles for auto mode */
@media (prefers-color-scheme: dark) {
    [data-mode="auto"] .prediction-container textarea::placeholder {
        color: #bbbbbb;
    }
}

@media (prefers-color-scheme: light) {
    [data-mode="auto"] .prediction-container textarea::placeholder {
        color: #6c757d;
    }
}

/* Style for the lock prediction button */
.button-lock-prediction {
    margin-top: 10px;
    background-color: #007bff; /* Blue background */
    color: #fff; /* White text */
    border: none;
    padding: 8px 16px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
}

/* Button hover and active states */
.button-lock-prediction:hover {
    background-color: #0056b3;
}

.button-lock-prediction:active {
    background-color: #004080;
}

/* Adjust button styles for dark mode */
[data-mode="dark"] .button-lock-prediction {
    background-color: #1a73e8;
    color: #fff;
}

[data-mode="dark"] .button-lock-prediction:hover {
    background-color: #135aba;
}

[data-mode="dark"] .button-lock-prediction:active {
    background-color: #0d3d80;
}

/* Adjust button styles for auto mode */
@media (prefers-color-scheme: dark) {
    [data-mode="auto"] .button-lock-prediction {
        background-color: #1a73e8;
        color: #fff;
    }
    [data-mode="auto"] .button-lock-prediction:hover {
        background-color: #135aba;
    }
    [data-mode="auto"] .button-lock-prediction:active {
        background-color: #0d3d80;
    }
}

@media (prefers-color-scheme: light) {
    [data-mode="auto"] .button-lock-prediction {
        background-color: #007bff;
        color: #fff;
    }
    [data-mode="auto"] .button-lock-prediction:hover {
        background-color: #0056b3;
    }
    [data-mode="auto"] .button-lock-prediction:active {
        background-color: #004080;
    }
}

/* Step by step styles */

/* Style for the step controls */
.step-controls {
    margin-top: 10px;
}

.step-controls .button {
    margin-right: 5px;
}

/* Style for the visualization panel */
.visualization-panel {
    margin-top: 20px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

.visualization-panel pre {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    overflow: auto;
    max-height: 300px;

    border: 1px solid #ccc;
}

/* Highlight current line in editor */
.CodeMirror .current-line {
    background-color: #ffffcc !important;
}




/* Turtle */

/* A top-level container for the entire turtle environment */
.turtle-env {
    display: flex;
    flex-wrap: wrap;   /* Allows wrapping on narrow screens */
    width: 100%;
    gap: 0;            /* Adjust gap if you want space between columns */
  }
  
  /* Left column: the code editor, run button, output */
  .turtle-env .turtle-left {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    /* Optional: Add a background or border if desired
       background: #fafafa;
       border: 1px solid #ccc;
    */
  }
  
  /* The hidden <textarea> that CodeMirror replaces */
  .turtle-env .turtle-editor-textarea {
    display: none; /* CodeMirror will take over */
  }
  
  
  /* The output <pre> area */
  .turtle-env .turtle-output {
    border: 1px solid #ccc;
    padding: 8px;
    min-height: 2em;
    white-space: pre-wrap;
    /* Optional: background color or font */
    font-family: monospace;
    background: #f8f8f8;
  }
  
  /* Right column: container for the turtle 'canvas' <div> */
  .turtle-env .turtle-right {
    flex: 1;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  /* The turtle <div> itself */
  .turtle-env .turtle-canvas {
    border: 1px solid #ccc;
    width: 90%;      /* or any other fixed or relative width */
    height: 400px;   /* you can override or make dynamic */
    margin-top: 0;
    /* Optional: background color if desired */
    /* background: #fff; */
    background: #007bff;
  }
  





.CodeMirror-hint-active,
.CodeMirror-hint:hover {
  background: #d68b00 !important;
  color: #fff;
}

