/* split.js */
.splitjs-grid {
    display: grid;
    grid-template-columns: 1fr 10px 1fr;
    height: calc(100vh - 40px); /* Full height minus top bar */
    margin-top: 40px;
}

.splitjs-gutter {
    grid-row: 1/-1;
    cursor: col-resize;
    background: url(external/split-vertical.png) no-repeat center center;
}

.splitjs-gutter-1 {
    grid-column: 2;
    background-color: rgb(244, 243, 243);
}

.gutter-row {
    grid-column: 1 / -1;
    cursor: row-resize;
    background: url(./external/split-horizontal.png) no-repeat center center;
    background-size: cover;
    height: 20px; /* Large enough for finger interaction */
}

/*
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
*/

body, html {
    height: 100%;
    overflow: hidden; /* Prevents the extra scrollbar */
    font-family: Inter, Arial, sans-serif;
}

#topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 1000;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

#topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#topbar-logo {
    width: 35px;
    height: 35px;
}

#topbar-text {
    font-size: 20pt;
    font-family: Bebas Neue,sans-serif;
    color: #006B96;
    letter-spacing: 1px;
}

#topbar-center {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 1;
    margin-left: 20px;
}

#topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 5px;
}

.topbar-user {
    font-size: 10pt;
    color: #666;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-link {
    font-size: 10pt;
    color: #666;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.2s;
}

.topbar-user-link:hover {
    color: #006B96;
    text-decoration: underline;
}

.topbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-label {
    font-weight: normal;
    font-size: 16pt;
    color: #333;
    font-family: Bebas Neue, sans-serif;
    letter-spacing: 0.5px;
}

.topbar-project {
    font-weight: normal;
    font-size: 16pt;
    color: #006B96;
    padding: 4px 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-family: Bebas Neue, sans-serif;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.topbar-project:hover {
    background-color: #e0e0e0;
}

.topbar-button {
    display: inline-block;
    padding: 2px 10px 2px 9px;
    margin: 2px;
    border-radius: 12px;
    border: 2px solid #D9D9D9;
    cursor: pointer;
    user-select: none;
    background-color: white;
    font-family: Bebas Neue, sans-serif;
    letter-spacing: 0.5px;
    font-size: 15pt;
    text-decoration: none;
    color: inherit;
}

.topbar-button:hover {
    background-color: #f0f0f0;
}

.topbar-button:active {
    background-color: darkgrey;
    color: white;
}

#hideverything {
    width: 100%;
    height: 100%;
    background-color:rgba(234, 234, 234, 0.8);
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    z-index: 9998;
    backdrop-filter: blur(5px);
    
}

#hideverything .logo {
    margin-top: 120px;
    width: 40px;
}

#hideverything .title {
    font-family: Bebas Neue,sans-serif;
    color: #006B96;
    font-size: 35pt;
}
#hideverything .subtitle {
    font-family: Bebas Neue,sans-serif;
    color: #006B96;
    font-size: 20pt;
}

#hideverything .loadingtext {
    font-family: Bebas Neue,sans-serif;
    color: #006b968b;
    font-size: 20pt;
}

#hideverything .loadingcircle {
    width: 150px;
}
#button-logwindow {
    z-index: 9997;
    position: fixed;
    width: 40px;
    height: 36px;
    right: 24px;
    bottom: 20px;
    background-image: url(button_logwindow.png);
    margin: 0;
    padding: 0;
}

#logwindow {
    position: fixed;
    right: 24px;
    bottom: 20px;
    width: 570px;
    height: 150px;
    margin: 0;
    padding: 20px;
    background-color: #313131;
    color: white;
    font-family: monospace;
    font-size: 10pt;
    text-wrap: nowrap;
    overflow-x: auto;
    overflow-y: auto;
    border-radius: 10px;
    z-index: 9999;
}

#sync-indicator {
    display: none;
    padding: 0;
    margin: 0;
    position: fixed;
    right: 10px;
    top: 8px;
}

#sync-indicator img {
    width: 20px;
}

#main-panel-left {
    padding: 10px 10px 0 10px;
    position:relative;
    overflow-y: auto;
    overflow-x: hidden;
}

#main-panel-right {
    overflow-y: auto;
    overflow-x: hidden;
}

#ai-warning {
    font-size: 9pt;
    color:rgb(137, 137, 137)
}
#token-usage {
    display: block;
    font-size: 9pt;
    color: #006B96;
    margin-top: 2px;
}
#chatinput-outer {
    bottom: 0;
    left: 0;
    padding: 0 0 7px 0;
    margin-bottom: 0;
    margin-top: 20px;
    margin-left: 0;
    margin-right: 0;
    position: sticky;
    width: 100%;
    bottom: 0px;
    background-color: white;
}

#chatinput {
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 8px;
    font-family: Inter, sans-serif;
    resize: none;
    overflow: hidden;
    width: calc(100% - 20px);
}

#chat-pre-padding {
    height: 85%;
}

#chat-post-padding {
    height: 50px;
}

.right-panel-tab-button {
    display: inline-block;
    padding: 5px;
    margin: 2px;
    border-radius: 12px;
    border: 2px solid #D9D9D9;
    cursor: pointer;
    user-select: none;
    font-family: Bebas Neue, sans-serif;
    font-size: 15pt;
    letter-spacing: 0.5px;
}

.right-panel-tab-button.active {
    background-color: #D9D9D9;
}

.right-panel-tab-button:active {
    background-color: darkgrey;
    color: white;
}

#right-panel-tabs-header {
    position: sticky;
    top: 0;
    background-color: white;
    padding: 2px;
    z-index: 10;
}

#main-panel-right-container {
    padding: 10px;
}

#train-animation {
    white-space: pre;
    font-family: monospace;
    font-size: 14px;
    padding: 10px;
    min-height: 6em;
    color: rgb(42, 42, 42);
    overflow: hidden;
}

@media (max-width: 768px) {
    .splitjs-grid {
        display: grid;
        grid-template-rows: 1fr 30px 1fr;
        grid-template-columns: unset;
        height: calc(100vh - 40px); /* Full height minus top bar */
    }

    .splitjs-gutter {
        grid-row: unset;
        grid-column: 1/-1;
        cursor: row-resize;
        background: url(external/split-horizontal.png) no-repeat center center;
        background-color: rgb(244, 243, 243);
    }

    .splitjs-gutter-1 {
        grid-column: unset;
        grid-row: 2;
    }

    #main-panel-left {
        overflow-y: auto; /* Ensure scrolling for content */
    }

    #main-panel-right {
        overflow-y: auto; /* Ensure scrolling for content */
    }
    #button-logwindow {
        display: none;
    }

    /* Topbar adjustments for mobile */
    #topbar {
        flex-wrap: wrap;
        height: auto;
        min-height: 40px;
        padding: 5px 10px;
    }

    #topbar-center {
        flex: 1 1 100%;
        justify-content: flex-start;
        gap: 15px;
        margin-top: 5px;
        font-size: 9pt;
    }

    .topbar-button {
        padding: 3px 8px;
        font-size: 9pt;
    }

    .topbar-label, .topbar-project {
        font-size: 9pt;
    }
}

#aichat_turns {
    font-size: 10pt;
}


.aichat_query {
    padding: 5px;
    background-color:rgb(239, 239, 239);
    border-radius: 5px;
}
.aichat_response {
    padding: 5px;
    background-color: white;
}

#aichat-stop-button {
    display: inline-block;
    position: absolute;
    right: 10px;
    top: 8px;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12pt;
    user-select: none;
}

.mathjax-tooltip {
    position: fixed;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    z-index: 1;
    visibility: hidden;
}

.mathjax-tooltip mjx-container {
    margin: 0.3em 0 !important;
}

.mathjax-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
    z-index: 1;
}

/* Tooltip that opens downward - arrow points down from the top */
.mathjax-tooltip[data-direction="down"]::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #555 transparent;
}

/* Connection pane options */
.connection-option {
    margin: 15px 0;
    padding: 12px;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
}

.connection-option:hover {
    background-color: #f9f9f9;
    border-color: #006B96;
}

.connection-option input[type="radio"] {
    margin-right: 10px;
    margin-top: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.connection-option label {
    cursor: pointer;
    flex: 1;
}

.connection-option strong {
    font-size: 11pt;
    color: #333;
    display: block;
}

.connection-option .option-description {
    margin: 5px 0 0 0;
    font-size: 9pt;
    color: #666;
}

.connection-option input[type="radio"]:checked + label strong {
    color: #006B96;
}

.api-key-container {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 5px;
}

.api-key-container input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace;
    font-size: 10pt;
    background-color: #f9f9f9;
    cursor: text;
}

.api-key-container input[type="text"]:focus {
    outline: none;
    border-color: #006B96;
}

.copy-button {
    padding: 8px 16px;
    background-color: #006B96;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10pt;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.copy-button:hover {
    background-color: #005577;
}

.copy-button:active {
    background-color: #004466;
}

/* Function call bubbles */
.function-call-bubble {
    display: inline-block;
    background-color: #e8f4f8;
    border: 1px solid #b8d4e3;
    border-radius: 12px;
    padding: 2px 8px;
    margin: 2px 4px;
    font-size: 9pt;
    cursor: help;
    position: relative;
    transition: background-color 0.2s;
}

.function-call-bubble.pending {
    background-color: #fff3cd;
    border-color: #ffc107;
}

.function-call-bubble.completed {
    background-color: #d4edda;
    border-color: #28a745;
}

.function-call-bubble .func-icon {
    margin-right: 2px;
}

.function-call-bubble:hover {
    background-color: #cce5ff;
}

/* Tooltip showing human-readable summary (normal mode) */
.function-call-bubble:hover::after {
    content: attr(data-summary);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 8pt;
    white-space: pre-wrap;
    max-width: 300px;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Override tooltip with technical details in developer mode */
body.developer-mode .function-call-bubble:hover::after {
    content: attr(data-function) "(" attr(data-args) ") → " attr(data-result);
}

/* Tooltip arrow */
.function-call-bubble:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    margin-bottom: 0;
}

/* Progress Pane Styles */
#progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.progress-label {
    font-size: 10pt;
    color: #333;
    font-weight: 500;
}

#session-selector {
    flex: 1;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 10pt;
    background-color: white;
    cursor: pointer;
}

#session-selector:focus {
    outline: none;
    border-color: #006B96;
}

.progress-button {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    font-size: 10pt;
    transition: all 0.2s;
}

.progress-button:hover {
    background-color: #f0f0f0;
    border-color: #006B96;
}

.progress-button.danger {
    color: #dc3545;
    border-color: #dc3545;
}

.progress-button.danger:hover {
    background-color: #dc3545;
    color: white;
}

#btn-download-csv {
    margin-top: 15px;
}

/* Iterations Table */
#iterations-table-container {
    overflow-x: auto;
}

#kpi-progress-chart {
    position: relative;
    z-index: 0;
}

#iterations-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
}

#iterations-table th,
#iterations-table td {
    padding: 8px 10px;
    text-align: left;
    border: 1px solid #ddd;
}

#iterations-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

#iterations-table th.group-header {
    background-color: #e0e0e0;
    font-weight: 700;
    text-align: center;
    border-bottom: 2px solid #ccc;
}

#iterations-table th.param-group {
    background-color: #d4ebf3;
}

#iterations-table th.kpi-group {
    background-color: #d4f3d4;
}

#iterations-table th.param-col {
    background-color: #e8f4f8;
}

#iterations-table th.kpi-col {
    background-color: #e8f8e8;
}

#iterations-table td.param-col {
    background-color: #f8fcfd;
}

#iterations-table td.kpi-col {
    background-color: #f8fdf8;
}

#iterations-table tbody tr:hover {
    background-color: #f0f7fa;
}

#iterations-table .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12pt;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#iterations-table .delete-btn:hover {
    background-color: #ffebee;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-wide {
    max-width: 600px;
}

.modal-content h3 {
    margin: 0 0 15px 0;
    color: #006B96;
    font-family: Bebas Neue, sans-serif;
    font-size: 16pt;
    letter-spacing: 0.5px;
}

.modal-content h4 {
    margin: 15px 0 10px 0;
    font-size: 10pt;
    color: #333;
}

.modal-content p {
    margin: 0 0 15px 0;
    font-size: 10pt;
    color: #666;
}

.modal-content input[type="text"],
.modal-content input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 10pt;
    box-sizing: border-box;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="number"]:focus {
    outline: none;
    border-color: #006B96;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    font-size: 10pt;
    transition: all 0.2s;
}

.modal-btn:hover {
    background-color: #f0f0f0;
}

.modal-btn.primary {
    background-color: #006B96;
    color: white;
    border-color: #006B96;
}

.modal-btn.primary:hover {
    background-color: #005577;
}

.modal-btn.danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.modal-btn.danger:hover {
    background-color: #c82333;
}

/* Modal input rows */
.modal-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.modal-input-row label {
    min-width: 120px;
    font-size: 9pt;
    color: #333;
}

.modal-input-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 9pt;
}

.modal-input-row .unit {
    font-size: 8pt;
    color: #666;
    min-width: 50px;
}