@font-face {
    font-family: 'Futura PT Demi';
    src: url('../../styles/fonts/FuturaPTDemi/font.woff') format('woff');
    font-weight: 600;
    font-style: normal;
}

body {
    padding: 0;
    margin: 2%;
}
.column {
    float: left;
}

.left {
    width: 30%;
    max-width:250px;
}

.right {
    width: 70%;
}

#graphicView {
    margin-top: 55px;
    text-align: center;
}

.row:after {
    content: "";
    display: table;
    clear: both;
}

.slidecontainer {
    margin-top: 10px;
}

.slider-div {
    float:left;
    margin-right: 50px;
    margin-top: 20px;
}

.buttons > .button {
    float:left;
    margin-top:20px
}

/* Canvas size constraints */
canvas {
    max-width: 100% !important;
    max-height: 90vh !important;
    height: auto !important;
    width: auto !important;
}

#graphicView canvas {
    max-width: 100%;
    max-height: calc(100vh - 150px);
    object-fit: contain;
}

/* Top navigation */

/* Add a black background color to the top navigation */
.topnav {
    background-color: #333;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    height: 50px;
}

/* QRI Logo */
.qri-logo-link {
    float: left;
    padding: 0;
    background-color: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
}

.heart-psychophysics-title {
    font-family: 'Futura PT Demi', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: #f2f2f2;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    text-decoration: none;
}

.qri-logo {
    width: 50px;
    height: 50px;
    padding: 0;
    margin: 0;
    display: block;
}

/* Style the links inside the navigation bar */
.topnav a:not(.qri-logo-link) {
    float: right;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
    background-color: #161618;
}

/* Change the color of links on hover */
.topnav a:not(.qri-logo-link):hover {
    background-color: #ddd;
    color: black;
}

.topnav .qri-logo-link:hover {
    opacity: 0.8;
}

table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}

dialog {
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
}

/* Code Editor Panel */
.code-editor-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 500px;
    height: 100vh;
    background: #2d2d2d;
    color: #f8f8f2;
    z-index: 2000;
    display: none;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.code-editor-panel.open {
    display: flex;
}

.code-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1e1e1e;
    border-bottom: 1px solid #444;
}

.code-editor-header h3 {
    margin: 0;
    font-size: 16px;
    color: #f8f8f2;
}

.toggle-editor-btn {
    background: transparent;
    border: none;
    color: #f8f8f2;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 4px;
}

.toggle-editor-btn:hover {
    background: #444;
}

.code-editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
}

#codeEditorFileName {
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
    color: #f8f8f2;
}

.auto-preview-label {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #aaa;
    cursor: pointer;
}

.auto-preview-label input {
    margin-right: 6px;
    cursor: pointer;
}

#codeEditorTextarea {
    width: 100%;
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #555;
    padding: 8px;
    box-sizing: border-box;
    background: #1e1e1e;
    color: #f8f8f2;
    resize: none;
}

.CodeMirror {
    flex: 1;
    height: auto !important;
    border: 1px solid #555;
    font-size: 12px;
}

.CodeMirror-focused {
    border-color: #888;
}

.code-editor-content button {
    padding: 8px 16px;
    margin: 0 4px 0 0;
    cursor: pointer;
    background-color: #444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
}

.code-editor-content button:hover {
    background-color: #555;
}

#codeEditorStatus {
    margin-left: auto;
    padding: 8px;
    color: #888;
    font-size: 11px;
    font-style: italic;
}

#codeEditorError {
    padding: 8px;
    background-color: #4a1e1e;
    border: 1px solid #ff6666;
    border-radius: 4px;
    color: #ff9999;
    font-size: 12px;
}

/* Adjust layout when editor is open */
body.code-editor-open {
    margin-left: 500px;
    margin-top: 0;
    margin-bottom: 0;
    margin-right: 0;
    padding: 0;
    transition: margin-left 0.3s ease;
}

body.code-editor-open #graphicView {
    margin-left: 0;
}

body.code-editor-open #controlView {
    margin-left: 0;
}

body.code-editor-open .topnav {
    margin-left: 0;
    margin-top: 0;
    margin-right: 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 8px;
    padding-bottom: 8px;
}

body.code-editor-open .row:first-child {
    margin-left: 0;
    margin-top: 0;
    margin-right: 0;
    padding: 0;
}

body.code-editor-open .row:first-child .topnav {
    margin-left: 0;
    margin-top: 0;
    margin-right: 0;
}

#savedParamsTable button {
    margin: 4px;
}

.hidden {
    display: none;
}

/* Control bar (moved from header to control panel) */
.control-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    body {
        margin: 0;
    }
    
    /* Stack columns vertically on mobile with canvas first */
    #mainContainer, .row {
        display: flex;
        flex-direction: column;
    }
    
    .column {
        float: none;
        width: 100% !important;
        max-width: none;
    }
    
    .left {
        width: 100% !important;
        max-width: none;
        padding: 10px;
        order: 2; /* Move controls after canvas */
    }
    
    .right {
        width: 100% !important;
        order: 1; /* Move canvas first */
    }
    
    #graphicView {
        margin-top: 10px;
        padding: 0 5px;
    }
    
    /* Constrain canvas on mobile */
    #graphicView canvas {
        max-width: 100vw !important;
        max-height: 60vh !important;
        width: auto !important;
        height: auto !important;
    }
    
    /* Footer at end of page */
    footer {
        margin-top: 20px !important;
        padding: 15px 10px !important;
        background-color: #1a1a1a !important;
        text-align: center !important;
        font-size: 11px !important;
        line-height: 1.5 !important;
    }
    
    /* Simpler topnav on mobile - just logo and link */
    .topnav {
        flex-wrap: nowrap;
        height: auto;
        padding: 8px;
        justify-content: space-between;
    }
    
    .qri-logo-link {
        flex: 0 0 auto;
        justify-content: flex-start;
    }
    
    .heart-psychophysics-title {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }
    
    .topnav a:not(.qri-logo-link) {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Control bar in control panel on mobile */
    .control-bar {
        gap: 6px;
        padding: 8px;
        margin-top: 15px;
    }
    
    .control-bar .bar-button {
        flex: 0 1 calc(50% - 6px);
        min-width: 0;
        font-size: 12px;
        padding: 8px 10px;
    }
    
    /* Adjust sliders for mobile */
    .slider-div {
        float: none;
        margin-right: 0;
        width: 100%;
    }
    
    /* Code editor takes full width on mobile */
    .code-editor-panel {
        width: 100%;
    }
    
    body.code-editor-open {
        margin-left: 0;
    }
    
    /* Adjust dialogs for mobile */
    dialog {
        width: 95vw;
        max-width: 95vw;
    }
}

@media screen and (max-width: 480px) {
    /* Extra small screens */
    .qri-logo {
        width: 35px;
        height: 35px;
    }
    
    .heart-psychophysics-title {
        font-size: 0.7rem;
    }
    
    .topnav a:not(.qri-logo-link) {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .control-bar .bar-button {
        flex: 0 1 100%;
    }
    
    #graphicView canvas {
        max-height: 50vh !important;
    }
    
    footer {
        font-size: 10px !important;
        padding: 12px 8px !important;
        line-height: 1.4 !important;
    }
}

