/* ── Loading screen ─────────────────────────────────────────────────────── */
body.is-loading {
    overflow: hidden;
}

#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(150deg, rgb(50, 55, 100) 0%, rgb(96, 103, 156) 60%, rgb(120, 128, 185) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
}

.loading-logo {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 2px;
}

.loading-subtitle {
    font-size: 14px;
    opacity: 0.7;
    letter-spacing: 1px;
    margin-top: -10px;
}

.loading-status {
    font-size: 13px;
    animation: loading-pulse 1.4s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}

/* CodeMirror styles */
/* Larger tooltip text for Modicalc */
:root {
    --info-tooltip-font-size: 15px;
}

/* ── Animation widget (animation-widget / standalone-animation-widget) ──── */
/* Toolbar buttons shared with Modiator diagram tools */
.diagramToolButton {
    z-index: 100;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    cursor: pointer;
    border-radius: 7px;
    font-size: 33px;
    text-align: center;
    padding-top: 4px;
    padding-left: 3px;
    padding-right: 3px;
    margin-bottom: 3px;
    transition: 0.1s;
}

.diagramToolButton:hover {
    background-color: white;
}

.diagramToolButton:disabled {
    background-color: rgba(200, 205, 239, 0.8);
    cursor: default;
    pointer-events: none;
}

.diagramToolButton.selected {
    background-color: rgb(131, 139, 197);
    color: white;
}

.diagramToolsPanel.active {
    opacity: 1;
    pointer-events: all;
}

/* Progress bar panel */
.animationToolPanel {
    background-color: rgb(245, 245, 245);
    cursor: auto;
}

.animationUpperPanel {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
}

.animationButtonPanel {
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding: 5px;
}

.animationButton {
    padding: 5px;
    cursor: pointer;
    background-color: rgb(231, 231, 231);
    margin: 5px;
    width: 25px;
    height: 25px;
    border-radius: 5px;
    text-align: center;
    transition: background-color 0.1s;
}

.animationButton:hover {
    background-color: rgb(209, 215, 255);
}

.animationProgressBarDiv {
    padding: 10px;
}

.animationProgressBar {
    width: 100%;
    height: 20px;
    border-radius: 2px;
    background-color: rgb(231, 231, 231);
    cursor: pointer;
}

.animationProgressMarker {
    border-radius: 2px;
    background-color: rgb(131, 139, 197);
    height: 100%;
}

.animationTimeDisplay {
    align-self: flex-end;
    padding: 10px;
    padding-bottom: 0px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    min-width: 7.5ch;
    text-align: right;
    white-space: nowrap;
}

.animationSpeedSelect {
    align-self: flex-end;
    padding-left: 10px;
}

.animationCanvas {
    display: block;
}

/* Change keywords in Modelica to bold and green */
.cm-keyword {
font-weight: bold;
color: green;
}

/* Change comments to italic and gray */
.cm-comment {
font-style: italic;
color: #888888;
}

/* Strings in dark red */
.cm-string {
color: darkred;
}

/* Numbers in dark blue */
.cm-number {
color: darkblue;
}

/* Variables in teal */
.cm-variable {
color: teal;
}

/*CodeMirror styles end */

/* Material icons */
.material-symbols-outlined {
    font-size: 20px;
}

body{
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    background: #f0f2f8;
    margin: 0;
}

.header{
    background: linear-gradient(135deg, rgb(50, 55, 100) 0%, rgb(96, 103, 156) 60%, rgb(120, 128, 185) 100%);
    padding: 16px 24px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(50, 55, 100, 0.45);
}

#headerTitle {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.iconButton{
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    max-height: 40px;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    gap: 6px;
}

.iconButton:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Group the header buttons together */
.headerButtons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Accent variant — slightly brighter so it stands out */
.iconButton--accent {
    background-color: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
}

.iconButton--accent:hover {
    background-color: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.7);
}

.buttonText {
    margin-left: 0;
}

/* Sub-panel flyout for hierarchical model selector */
.hierSelectSubPanel {
    /* borders only when visible to prevent 1px residue at height:0 */
}

.hierSelectSubPanel.active {
    border-left: 3px solid rgb(98, 103, 158);
    border-top: 1px solid rgb(98, 103, 158);
}

.customSelectOptions{
    
    position: absolute;
    background-color: rgb(247, 248, 255);
    z-index: 100;
    font-size: 13px;
    min-width: 50px;
    box-shadow: 2px 4px 4px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    height: 0px;
    transition: 0.1s;
    transition-property: height;
}

.customSelectOptions.active{
    height: min-content; /* fallback for browsers that do not support calc-size */
    height: calc-size(min-content, size);
}

.customSelectOption
{
    padding: 5px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: rgb(255, 255, 255);
    transition: 0.1s;
}

.customSelectOption:nth-of-type(even){
    background-color: rgb(240, 240, 240);
}

.customSelectOption:hover{
    background-color: rgb(209, 215, 255);
}

.customSelectOptionSelected{
    font-weight: bold;
    background-color: rgb(220, 222, 255);
}

.customSelectSelect{
    z-index: 120;
    margin: 5px;
    margin-bottom: 0px;
    border-radius: 2px;
    padding: 2px;
    border: 0px;
    background-color: rgb(231, 231, 231);
    cursor: pointer;
    width: min-content;
    min-width: 40px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.1s;
    user-select: none;
}

.customSelectSelect:hover{
    background-color: rgb(209, 215, 255);
}

.customSelectSelect:focus{
    outline-color: black;
}

.customSelectSelect.disabled{
    opacity: 0.5;
    pointer-events: none;
}

.customSelectText{
    margin: 5px;
    display: inline-block;
    white-space: nowrap;
}

.modelTextDiv{
    padding: 16px;
    background: #f0f2f8;
}

.modelSelectDiv{
    padding: 6px 4px 10px;
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 2px;
}

.nextModelButton {
    margin: 5px;
    margin-bottom: 0px;
    width: 28px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    background-color: rgb(231, 231, 231);
    border: 0px;
    border-radius: 2px;
    color: inherit;
    transition: 0.1s;
    flex-shrink: 0;
}

.nextModelButton:hover {
    background-color: rgb(209, 215, 255);
}

.codeMirrorWrapper{
    padding: 12px;
    background-color: #fafbff;
    border: 1px solid rgb(180, 185, 220);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 1px 3px rgba(96, 103, 156, 0.1);
    display: flex;
    flex-direction: column;
}

/* Let the CodeMirror editor fill the wrapper height */
.codeMirrorWrapper .CodeMirror {
    flex: 1;
    height: 100%;
    resize: none !important;
}

.codeMirrorWrapper .CodeMirror-scroll,
.codeMirrorWrapper textarea {
    resize: none !important;
}

.simulationDiv{
    padding: 10px 14px;
    background: linear-gradient(to bottom, rgb(209, 215, 255), rgb(195, 202, 248));
    border: 1px solid rgb(180, 185, 220);
    border-top: none;
    border-radius: 0 0 8px 8px;
    height: 44px;
    display: flex;
    flex-direction: row;
    align-items: center;
    box-shadow: 0 2px 4px rgba(96, 103, 156, 0.1);
}

.simulateButton {
    height: min-content;
    cursor: pointer;
    padding-top: 3px;
}

.simulateButtonIcon{
    color: green;
    transition: 0.2s;
    font-size: 36px;
    margin-right: 1px;
}

.simulateButtonIcon:hover{
    color: darkgreen;
    margin-right: 0px;
    font-size: 38px;

}

.simulateButtonIcon.small{
    color: rgb(57, 68, 158);
    font-size: 20px;
    margin-right: 6px;
}

.simulateButtonIcon.small:hover{
    color: rgb(9, 20, 102);
    margin-right: 5px;
    font-size: 22px;
}

.simulateButtonIcon.small.disabled{
    opacity: 0.3;
}

.stopTimeLabel{
    font-size: 12px;
}
.inputField{
    margin: 4px;
    padding: 5px 8px;
    margin-left: 10px;
    border: 1px solid rgb(180, 185, 220);
    border-radius: 6px;
    background-color: rgb(235, 238, 255);
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-size: 13px;
    transition: border-color 0.15s;
}

.inputField:focus {
    outline: none;
    border-color: rgb(96, 103, 156);
    background-color: #fff;
}

#error{
    margin: 0 16px 8px;
    padding: 10px 14px;
    border: 1px solid #fca5a5;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    background-color: #fff5f5;
    color: #7f1d1d;
    font-size: 13px;
}

.dialogContainer{
    margin-top: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: left;
    min-width: 200px;
    background: white;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid rgb(209, 215, 240);
    box-shadow: 0 1px 4px rgba(96, 103, 156, 0.1);
}

.dialogTitle{
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    margin-top: 5px;
    text-align: left;

}

#dialog{
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.row {
    margin-left: 5px;
    margin-top: 5px;
}

.resultContainer {
    margin: 12px 16px 16px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-start;
    gap: 12px;
}

.plotContainer{
    min-width: 300px;
    max-width: 800px;
    border: 1px solid rgb(131, 139, 197);
    padding: 10px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 4px rgba(96, 103, 156, 0.12);
}

/* ── Documentation panel ─────────────────────────────────────────────────── */
#documentation {
    background: white;
    border: 1px solid rgb(180, 185, 220);
    border-left: 3px solid rgb(131, 139, 197);
    border-radius: 8px 8px 0 0;
    padding: 14px 16px 0;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 1px 4px rgba(96, 103, 156, 0.08);
    display: flex;
    flex-direction: column;
}

/* ── Tables inside documentation ─────────────────────────────────────────── */
#documentation table {
    border-collapse: collapse;
    margin: 8px 0;
}

#documentation th,
#documentation td {
    padding: 6px 12px;
    text-align: left;
}

/* ── Documentation collapse ─────────────────────────────────────────────── */
.doc-content {
    flex: 1;
    padding-bottom: 14px;
}

.doc-content.doc-collapsed {
    max-height: var(--doc-max-height, 300px);
    overflow: hidden;
    position: relative;
    padding-bottom: 0;
}

.doc-content.doc-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), white);
    pointer-events: none;
}

.doc-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 7px 0;
    border: none;
    border-top: 1px solid rgb(209, 215, 240);
    background: rgb(248, 249, 255);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: rgb(80, 88, 150);
    transition: background-color 0.15s;
    flex-shrink: 0;
}

.doc-toggle-btn:hover {
    background: rgb(235, 237, 255);
    color: rgb(50, 58, 130);
}

/* ── Floating panels (animation / diagram) ───────────────────────────────── */
#animationPanel, #diagramPanel {
    border: 1px solid rgb(131, 139, 197);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(96, 103, 156, 0.12);
    background: white;
}

/* Force 3D/diagram panels onto their own row in the results flex container */
.result-row-break {
    flex-basis: 100%;
    height: 0;
}

/* ── Version footer ──────────────────────────────────────────────────────── */
.version-footer {
    text-align: center;
    padding: 12px;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid rgb(209, 215, 240);
    margin-top: 4px;
    background: #f0f2f8;
}
