/* UIKit CSS */

/* Codemirror CSS */

/* Color picker */

/* Numara CSS */
* {
  -webkit-backface-visibility: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  backface-visibility: hidden;
  margin: 0;
  outline: none;
  border: none;
  background: none;
  padding: 0;
  resize: none;
  user-select: none;
}

/* UI defaults */
html,
body {
  height: 100%;
  font-size: 12px;
  font-family: 'Open Sans', sans-serif;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 8px;
}

h2 {
  margin: 0 0 15px 0;
}

input {
  font-size: inherit;
  font-family: inherit;
}

input[type='range']::-webkit-slider-runnable-track {
  margin-top: 2px;
  border: none;
  border-radius: 3px;
  background-color: #999999;
  width: 300px;
  height: 1px;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  margin-top: -7px;
  border: none;
  border-radius: 50%;
  background-color: #1e87f0;
  width: 14px;
  height: 14px;
}

input[type='range']:focus::-webkit-slider-runnable-track {
  background-color: #999999;
}

pre {
  font: inherit !important;
}

textarea {
  box-sizing: border-box;
  width: 100%;
  tab-size: 2;
}

text {
  font-size: 0.9rem;
}

.appWrapper {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

/* Windows Header */
.winHeader {
  -webkit-app-region: drag !important;
  display: none;
  position: fixed;
  top: 5px;
  right: 0;
  left: 0;
  height: 30px;
}

.winHeaderTitle {
  float: left;
  margin: 5px 0 0 15px;
  font-weight: 700;
  font-size: 1.1em;
  font-family: 'Numara';
}

.winButtons {
  position: fixed;
  top: 0;
  right: 0;
}

.unmax {
  display: none;
}

.min-btn-win,
.max-btn-win,
.unmax-btn-win,
.close-btn-win {
  -webkit-app-region: no-drag;
  float: right;
  background-position: center;
  background-size: 11px 11px;
  background-repeat: no-repeat;
  width: 46px;
  height: 30px;
}

.close-btn-win:hover {
  background-image: url('data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTIgMTIiIGZpbGw9InJnYigyNTUsIDI1NSwgMjU1KSIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik02LjI3OSA1LjVMMTEgMTAuMjIxbC0uNzc5Ljc3OUw1LjUgNi4yNzkuNzc5IDExIDAgMTAuMjIxIDQuNzIxIDUuNSAwIC43NzkuNzc5IDAgNS41IDQuNzIxIDEwLjIyMSAwIDExIC43NzkgNi4yNzkgNS41eiIgLz48L3N2Zz4=');
  background-color: #ee1111;
}

/* Mac Header */
.macHeader {
  -webkit-app-region: drag !important;
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 40px;
}

.macHeaderTitle {
  padding-top: 10px;
  font-size: 1.1em;
  font-family: 'Numara';
  text-align: center;
}

/* Content */
.mainPanel {
  display: flex;
  position: fixed;
  top: 50px;
  right: 8px;
  bottom: 42px;
  left: 20px;
  align-content: flex-start;
  font-size: 1.15rem;
  line-height: 2.1;
}

.input {
  width: 60%;
  min-width: 120px;
}

.inputArea {
  -webkit-user-select: text;
  user-select: text;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'Consolas', 'Roboto Mono', 'SF Mono', 'Liberation Mono', monospace !important;
  font-size: 1.15rem !important;
  line-height: 2.1 !important;
}

.inputArea::-webkit-scrollbar {
  width: 0px;
  height: 8px;
}

.divider {
  flex: 0 0 auto;
  cursor: ew-resize;
  margin: 0 8px;
  width: 5px;
  height: calc(100% - 8px);
}

.divider::before {
  display: block;
  margin: 0 auto;
  width: 1px;
  height: 100%;
  content: '';
}

.output {
  flex: 1;
  padding: 0;
  min-width: 120px;
  font-weight: 400;
  white-space: nowrap;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', 'Consolas', 'Roboto Mono', 'SF Mono', 'Liberation Mono', monospace !important;
  font-size: 1.45rem !important; /* Matched to input area */
  line-height: 2.1 !important;
}

.inputArea,
.output {
  display: block;
  height: 100%;
  overflow: auto;
  scroll-behavior: smooth;
}

.output > div {
  -webkit-user-select: text;
  display: block;
  width: 100%;
  min-height: 27px;
  height: auto;
  user-select: text;
  line-height: 2.1 !important;
  font-size: 1.25rem !important; /* Matched to input area */
  padding: 2px 0;
  margin: 0;
  box-sizing: border-box;
}

.panelFont {
  font-family: 'Roboto Mono', monospace;
}

.answer {
  -webkit-user-select: text;
  cursor: default;
  margin: 0 8px 0 0;
  border-radius: 5px;
  padding: 4px 8px; /* Slightly increased padding */
  min-height: 32px; /* Increased from 27px */
  height: auto;
  display: inline-block;
  vertical-align: top;
  user-select: text;
  line-height: 1.4; /* Added for better text alignment */
}

.plotButton {
  cursor: pointer;
}

.plotButton > svg {
  width: 1em;
  pointer-events: none;
}

.lineError,
.plotButton {
  margin: 0 12px 0 5px;
}

.lineError:hover {
  text-decoration: underline;
}

.errMsg {
  word-break: break-word;
}

.noRuler {
  border-bottom: 1px solid transparent;
}

.gutterBlock {
  position: fixed;
  bottom: 50px;
  left: 0;
  z-index: 5;
  height: 8px;
}

/* Action item buttons */
.actions {
  position: fixed;
  right: 10px;
  bottom: 10px;
  left: 10px;
  height: 25px;
}

.action,
.noAction {
  cursor: pointer;
}

.noAction,
.action[disabled='true'] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.actionDivider {
  margin: 0 5px;
  margin-top: 2px;
  height: 20px;
}

.leftActions a,
.centerActions a,
.rightActions a {
  margin: 0 5px;
}

.leftActions a:hover,
.sidePanelActions a:hover {
  text-decoration: none;
}

.newPageButton svg,
.newPageButtonSP svg {
  width: 16px !important;
  height: 16px !important;
}

.pageName {
  position: relative;
  top: 2px;
  opacity: 0.9;
  width: calc(100vw - 300px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leftActions a svg,
.centerActions a svg,
.rightActions a svg,
.sidePanelActions a svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
  color: inherit !important;
}

.notificationDot {
  display: none;
  position: fixed;
  right: 10px;
  bottom: 18px;
}

.notificationDot > svg {
  fill: #1e87f0;
  stroke: #1e87f0;
  width: 5px;
  height: 5px;
}

/* Side panel */
.uk-offcanvas-bar {
  padding: 0;
  width: 240px;
}

.sidePanelActions {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 10px 10px 14px 10px;
}

.closeSidePanelButton {
  -webkit-app-region: no-drag !important;
}

.closeSidePanelButton svg {
  width: 18px;
  height: 18px;
}

.uk-offcanvas-close {
  -webkit-app-region: no-drag;
  top: 9px;
  right: 8px;
}

.uk-offcanvas-close svg {
  width: 11px;
  height: 11px;
}

.uk-offcanvas-close svg line {
  stroke-width: 1.5;
}

.uk-dropdown {
  padding: 0px;
  min-width: auto;
}

.pageListHeader {
  height: 40px;
}

.pageList {
  overflow-x: hidden;
  overflow-y: auto;
}

.pageListFooter {
  height: 47px;
}

.pageListSort {
  -webkit-app-region: no-drag;
  cursor: pointer;
  margin: 10px;
}

.pageListSort svg {
  width: 14px;
  height: 14px;
}

.sortListItem {
  -webkit-app-region: no-drag;
  cursor: pointer;
  padding: 5px 10px;
}

.sortListDivider {
  margin: 5px 10px;
}

.pageListItem {
  display: flex;
  position: relative;
  cursor: pointer;
}

.pageListItem > div:first-child {
  padding: 3px 0 3px 10px;
}

.pageListItemTitle {
  padding: 5px 5px 2px 5px;
  width: 180px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-parent-icon svg {
  width: 16px;
  height: 16px;
}

.renamePageButton,
.dupPageButton,
.deletePageButton,
.sortListItem {
  cursor: pointer;
  padding: 5px 10px;
}

/* Inline sheet rename input */
.sheet-rename-input {
  width: calc(100% - 24px);
  padding: 4px 8px;
  margin: 4px 12px;
  border: 1px solid var(--color-stroke-default);
  border-radius: 4px;
  font-size: 0.95rem;
}

/* Dialogs */
.dialogs {
  display: none;
}

.dialog-buttons {
  display: flex;
  align-items: center;
  margin-top: 15px;
}

.dialog-open-body {
  margin-right: -5px;
}

.dialog-open-date {
  padding: 0 5px 5px 5px;
  color: #999999;
  font-size: 0.9rem;
}

.dialogConfirm {
  z-index: 10010;
}

.infoOK {
  margin-left: -20px !important;
}

/* Settings */
.dialog-settings-body {
  margin-right: -8px;
  padding-right: 10px;
  height: calc(100vh - 200px);
  max-height: 600px;
  overflow: scroll;
}

#dialogSettings .uk-overflow-auto {
  padding-right: 10px;
}

#dialogSettings h3 {
  margin: 25px 0 12px 0;
  font-weight: 500;
  font-size: 1rem;
}

#dialogSettings h3:first-of-type {
  margin: 0px 0 12px 0;
}

#dialogSettings .settingMod,
#dialogSettings .settingModToggle {
  display: none;
  position: absolute;
  cursor: pointer;
  margin-top: -3px;
  margin-left: -20px;
  color: #dd9359;
}

#dialogSettings .settingMod > svg,
#dialogSettings .settingModToggle > svg {
  width: 24px;
}

#dialogSettings input:disabled + span.slider.round {
  cursor: default;
}

#dialogSettings .range .settingMod {
  margin-left: -54px;
}

.set1 {
  padding-top: 1px;
}

.set3 {
  padding-top: 2px;
}

.precision,
.expLower,
.expUpper {
  background-color: transparent;
  padding: 1px 0 0 0;
  width: 25px;
  text-align: center;
}

.warn-icon {
  display: none;
  margin-left: 5px;
}

.warn-icon svg {
  stroke: #faa05a;
  margin-top: -3px;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.lastUpdated {
  display: inline-block;
  vertical-align: middle;
  margin-right: 3px;
  font-size: 0.9rem;
}

#updateRatesLink[data-enabled='false'] {
  opacity: 0.5;
  pointer-events: none;
}

.customizeThemeButton > svg,
.updateRatesLink > svg {
  width: 20px;
  height: 20px;
}

/* About dialog items */
.dialogAbout {
  text-align: center;
}

.dialog-about-header {
  display: inline-block;
  margin: 0 auto;
  font-weight: 600;
}

.dialog-about-header img {
  width: 128px;
}

.dialog-about-title {
  vertical-align: middle;
  margin-left: 5px;
}

.dialogAbout p {
  clear: both;
  margin-top: 5px;
}

.dialog-about-links {
  display: flex;
  flex: auto;
}

.dialog-about-links > div {
  width: 100%;
  line-height: 30px;
}

div:has(> #logsLink) {
  display: none;
}

.dialogAboutAppVersion {
  display: block;
  margin-bottom: 8px;
  text-align: center;
}

.versionCtnr > div {
  margin: 8px 3px 3px 3px;
  text-align: center;
}

.dialogAboutUpdateStatus {
  display: block;
  text-align: center;
}

.notificationLink {
  margin-left: 8px;
  color: #56b6c2;
}

.updateButton {
  display: none;
  margin-top: 10px;
  text-transform: capitalize;
}

.dialogAboutCopyright {
  display: block;
  margin: 15px 0;
}

.defSettingsButton {
  margin-right: 10px;
}

.resetSizeButton {
  position: absolute;
  top: 10px;
  right: 15px;
}

.resetSizeButton {
  position: absolute;
  top: 10px;
  right: 15px;
}

.resetSizeButton > svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Messages */
.msg {
  opacity: 0;
  transition:
    visibility 0.3s linear,
    opacity 0.3s linear;
}

.pr-lh {
  line-height: 22px;
}

.pdt-lh {
  line-height: 20px;
}

.padTop1 {
  padding-top: 1px;
}

.textBox {
  box-sizing: border-box;
  border: 1px solid #cccccc;
  padding: 5px;
  width: 100%;
}

.textBox::placeholder {
  color: rgba(148, 156, 160, 0.6);
}

/* Function Plot */
.function-plot {
  height: calc(100vh - 180px) !important;
  max-height: 800px;
}

.top-right-legend {
  fill: #4682b4;
}

/* Toggle buttons */
.switch {
  display: inline-block;
  position: relative;
  margin-top: 1px;
  width: 28px;
  height: 16px;
}

.switch:disabled {
  opacity: 0.5;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switchText {
  display: inline-block;
  vertical-align: text-bottom;
  margin: 0 12px 0 2px;
  line-height: 17px;
}

.subSwitchIcon {
  margin: -5px 5px 0 0;
  width: 14px;
}

.plotTitle {
  margin: 0 0 5px 0;
}

.plotSwitches {
  margin: 0;
}

.slider {
  -webkit-transition: 0.2s;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transition: 0.2s;
  cursor: pointer;
  background-color: #cccccc;
}

.slider:before {
  -webkit-transition: 0.2s;
  position: absolute;
  bottom: 2px;
  left: 2px;
  transition: 0.2s;
  width: 12px;
  height: 12px;
  content: '';
}

.slider.round {
  border-radius: 16px;
}

.slider.round:before {
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #1e87f0;
}

input:checked + .slider:before {
  -webkit-transform: translateX(12px);
  transform: translateX(12px);
}

.scrollTop {
  display: none;
  position: fixed;
  right: 2px;
  bottom: 32px;
  cursor: pointer;
  width: 10px;
}

.tooltipCode {
  margin: 6px 0 3px 0;
}

/* UIkit Overrides */
.uk-text-secondary {
  font-weight: 600 !important;
}

:focus:not([tabindex^='-']),
:focus-visible {
  outline: none;
}

.uk-offcanvas-bar-animation {
  transition: left 0.2s ease-out;
}

.uk-modal {
  padding: 0 30px !important;
}

.uk-modal-full {
  padding-right: 20px;
  padding-left: 20px;
}

.uk-modal-dialog {
  transition: 0s linear;
  border-radius: 3px;
  max-width: calc(100vw - 60px) !important;
}

.uk-modal-body {
  padding: 12px 15px;
}

.uk-modal-title,
.errTitle {
  font-weight: 600;
  font-size: 1rem;
}

.modal .uk-modal-dialog .uk-modal-title {
  cursor: move;
}

.uk-modal-footer {
  padding: 15px;
}

.uk-grid {
  margin-left: -30px !important;
}

.uk-grid > * {
  padding-left: 30px !important;
}

.uk-grid + .uk-grid {
  margin-top: 10px;
}

.uk-grid-small {
  margin: 0 25px 0 0;
}

.uk-select {
  transition: 0s ease-in-out;
}

.uk-select:not([multiple]):not([size]) {
  margin-top: 1px;
  border-width: 0 0 1px 0;
  height: auto;
}

.uk-switcher {
  margin: 0 !important;
}

.uk-tab {
  margin: 0px -20px;
}

.uk-tab > * {
  padding-left: 0px;
}

.uk-tab > *:first-child {
  padding-left: 20px;
}

.uk-tab::before {
  border: none;
}

.uk-tab > * > a {
  display: inline-block;
  margin-right: 0px;
  padding: 0 15px 5px 15px;
  font-weight: 600;
  font-size: 1rem;
  text-transform: none;
}

.uk-button {
  transition: 0s ease-in-out;
  margin-left: 3px;
  border-radius: 3px;
  padding: 0 10px;
  line-height: 28px;
}

.uk-button:enabled:active {
  transform: scale(0.98);
}

.uk-button-default,
.uk-button-default:hover {
  cursor: pointer;
  color: inherit;
}

.uk-input {
  height: 24px;
}

.uk-label {
  font-size: 1rem;
}

.uk-width-small {
  width: 280px;
}

.uk-width-medium {
  width: 350px;
}

#dialogSettings > .uk-width-medium {
  width: 420px;
  min-width: 400px;
}

.uk-width-large {
  width: 600px;
}

.uk-width-xlarge {
  width: 800px;
}

.uk-width-2xlarge {
  width: 1200px;
}

.uk-overflow-auto {
  min-height: 175px;
  max-height: calc(100vh - 250px);
}

.uk-range {
  padding-top: 2px;
  min-height: 1.6em;
}

.uk-tooltip {
  z-index: 1000000;
  max-width: 60vw !important;
  word-break: break-word;
}

.uk-tooltip > * {
  width: 100% !important;
}

.uk-notification {
  margin-top: 30px;
  margin-bottom: 30px;
}

.uk-notification-top-left,
.uk-notification-bottom-left {
  left: 25px;
}

.uk-notification-top-right,
.uk-notification-bottom-right {
  right: 25px;
}

.uk-notification-message {
  padding: 8px 35px 8px 10px;
  font-size: 1rem;
}

.uk-notification-close {
  display: block;
  top: 11px;
  right: 10px;
}

.uk-notification-close svg {
  width: 10px;
  height: 10px;
}

.uk-offcanvas-overlay:before {
  background: rgba(0, 0, 0, 0.5);
}

@media (max-width: 639px) {
  .uk-notification {
    right: 25px;
    left: 25px;
  }
}

@media (min-width: 640px) {
  .uk-notification {
    width: 590px;
  }

  .uk-notification-bottom-center,
  .uk-notification-top-center {
    margin-left: -295px;
  }
}

/* CodeMirror Overrides */
.cm-s-numara {
  background: none !important;
  height: 100% !important;
  font-family: 'Roboto Mono' !important;
}

.cm-s-numara .CodeMirror-gutters {
  border: none !important;
  background: none !important;
}

.cm-s-numara .CodeMirror-lines {
  padding: 0 !important;
}

.CodeMirror-cursor {
  border: none !important;
}

.CodeMirror-cursor:before {
  position: absolute;
  top: calc(12% + 1px);
  width: 1px;
  height: calc(76% - 1px);
  content: '';
}

.cm-s-numara .CodeMirror-vscrollbar {
  display: none !important;
}

.cm-s-numara .CodeMirror-hscrollbar,
.cm-s-numara .CodeMirror-gutter-filler {
  display: block !important;
  width: auto;
  height: 8px !important;
}

.cm-s-numara .CodeMirror-hscrollbar {
  right: 8px !important;
}

.cm-s-numara .CodeMirror-linenumber {
  padding: 0 10px 0 0 !important;
}

.cm-s-numara .CodeMirror-sizer {
  padding-right: 0 !important;
  padding-bottom: 8px !important;
}

.cm-s-numara .CodeMirror-search-hint {
  display: none !important;
}

.cm-s-numara .CodeMirror-dialog input {
  font-family: inherit !important;
}

.cm-s-numara button {
  color: #1e87f0 !important;
  font-size: inherit !important;
}

.cm-s-numara button:hover {
  cursor: pointer !important;
  color: #5286b9 !important;
  font-size: inherit !important;
}

.cm-searching {
  background-color: rgba(255, 250, 82, 0.5) !important;
}

.cm-s-numara .CodeMirror-search-label {
  font-size: 1rem !important;
}

.cm-s-numara .CodeMirror-search-label {
  font-size: 1rem !important;
}

#dialogUdfu .CodeMirror {
  padding: 5px;
  height: calc(100vh - 235px);
  max-height: 600px;
  font-size: 1.1em;
}

.CodeMirror-hints {
  font-family: 'Roboto Mono', monospace;
}

.cm-operator::before {
  display: inline-block;
  width: 0;
  content: ' ';
}

/* Color picker */
.colorPickerContainer {
  margin-right: -8px;
  padding-right: 10px;
  height: calc(100vh - 200px);
  max-height: 420px;
  overflow: scroll;
}

.colorPickerContainer .uk-first-column {
  margin-top: 2px;
}

.colorInput {
  cursor: pointer;
  box-sizing: border-box;
  padding: 2px 5px;
  width: 80px;
  height: 20px;
}

.clr-picker {
  border-radius: 3px;
  width: 160px;
}

.clr-gradient {
  margin-bottom: 10px;
  height: 80px;
}

.clr-hue,
.clr-alpha {
  margin: 5px 15px;
  width: calc(100% - 30px);
}

.clr-preview {
  margin: 10px auto 10px 10px;
  width: 25px;
  height: 25px;
}

input.clr-color {
  margin: 10px auto 10px auto;
  height: 25px;
  font-size: 13px;
  font-family: inherit;
}

.clr-field button {
  width: 20px;
}

.clr-field button:after {
  box-shadow: none;
}

.clr-custom-reset {
  order: 2;
  cursor: pointer;
  margin: auto 10px auto 5px;
}

.clr-custom-reset > svg {
  width: 16px;
  height: 16px;
}

/* Print style */
.printArea {
  display: none;
}

@media print {
  .appWrapper,
  .uk-open,
  .uk-tooltip {
    display: none !important;
  }

  .printArea {
    display: block;
  }

  .printTitle {
    padding-bottom: 10px;
    font-size: 1.1em;
    font-family: 'Numara';
    text-align: center;
  }

  .printPage {
    border-collapse: collapse;
    width: 100%;
    font-family: 'Roboto Mono', monospace;
  }

  .printPage tr td {
    vertical-align: top;
    padding-top: 3px;
    padding-right: 10px;
    padding-bottom: 3px;
  }

  .printLineNumCol {
    width: 1px;
    color: #ccc !important;
  }

  .printAnswerLeft {
    border-left: 1px solid #eaeaea;
  }

  .printAnswerRight {
    text-align: right;
  }

  .printPagele tr td:nth-child(1) {
    padding-right: 10px;
  }

  .printPage tr td:last-child {
    padding-left: 10px;
  }

  .printRulers tr td {
    border-bottom: 1px solid #eaeaea;
  }

  .scrollTop {
    display: none !important;
  }
}

@page {
  margin: 15mm 10mm;
}

/* Constrain sheet name in dropdown items to prevent long names from pushing actions */
.sheet-item {
  display: flex;
  align-items: center;
}
.sheet-item .sheet-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-item .sheet-actions {
  flex: 0 0 auto;
  margin-left: 8px;
  display: flex;
  gap: 4px;
}

/* Constrain toolbar sheet menu button (anchor left) */
#sheets-menu-button {
  flex: 0 0 auto;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pyodide-status {
  pointer-events: none;
}
