/* App initial loading indicator */
.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  min-height: 100vh;
  color: #555;
}

.app-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #2196f3;
  border-radius: 50%;
  animation: app-loading-spin 0.8s linear infinite;
}

.app-loading-text {
  margin: 0;
  font-size: 1rem;
}

.app-loading-error {
  margin: 1rem;
  color: #c00;
}

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 1rem;
  background: #f8f9fa;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.login-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
}

.login-form label {
  font-weight: 500;
  font-size: 0.9rem;
}

.login-form input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.login-error {
  margin: 0;
  font-size: 0.9rem;
  color: #c00;
  display: none;
}

.login-form button[type="submit"] {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: #2196f3;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.login-form button[type="submit"]:hover:not(:disabled) {
  background: #1976d2;
}

.login-form button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@keyframes app-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Data pane loading indicator (e.g. when switching table) */
.data-pane-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  min-height: 120px;
  color: #555;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 8px;
}

.data-pane-loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid #e0e0e0;
  border-top-color: #2196f3;
  border-radius: 50%;
  animation: app-loading-spin 0.8s linear infinite;
}

.data-pane-loading-text {
  margin: 0;
  font-size: 0.95rem;
}

@keyframes elongate-right {
  0% {
    transform: translateX(0) scaleX(1);
  }
  20% {
    transform: translateX(13px) scaleX(1.5);
  }
  100% {
    transform: translateX(26px) scaleX(1);
  }
}

@keyframes elongate-left {
  0% {
    transform: translateX(26px) scaleX(1);
  }
  20% {
    transform: translateX(13px) scaleX(1.5);
  }
  100% {
    transform: translateX(0) scaleX(1);
  }
}

@keyframes bounce-right {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(26px);
  }
  40% {
    transform: translateX(20px); /* Adjust this value to control the bounce */
  }
  60% {
    transform: translateX(23px); /* Adjust this value to control the bounce */
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

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

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: background-color 0.6s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: transform 0.6s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: #2196f3;
}

input:checked + .slider-round:before {
  transform: translateX(26px);
  animation: elongate-right 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

input:not(:checked) + .slider-round:before {
  transform: translateX(0);
  animation: elongate-left 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.slider-round.bounce:before {
  animation: bounce-right 0.4s ease; /* Match the duration of the bounce to transition duration */
}

/* ==================== Base Styles ==================== */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #212529;
  background-color: #f8f9fa;
}

* {
  box-sizing: border-box;
}

/* Utility classes */
.fill-width {
  width: 100%;
}

.fill-height {
  height: 100%;
}

/* ==================== Layout & Spacing ==================== */

/* Button panel */
.button-panel {
  position: sticky;
  top: 0;
  z-index: 2000; /* Above cell dividers (1500) so they don't show through when scrolling */
  background-color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #000;
  padding: 8px;
  margin-bottom: 12px;
}

.button-panel-spacer {
  width: 30px;
}

.button-panel-logout {
  padding: 4px 10px;
  font-size: 0.9rem;
  color: #555;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.button-panel-logout:hover {
  background: #f8f9fa;
  border-color: #999;
}

/* Selections list */
.selections-list {
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 5px;
  user-select: none;
}

.selections-list .value {
  display: inline-block;
  min-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  cursor: pointer;
  padding: 2px 4px;
  color: #000;
  user-select: none;
}

.selections-list .value.selected {
  background-color: lightblue;
}

/* Database window - main container */
.database-window {
  display: flex;
  width: 100%;
  height: 100%;
  border: 1px solid #ccc;
  padding: 20px;
  max-width: 100%;
  box-sizing: border-box;
}

.left-side {
  display: flex;
  flex-direction: column;
  width: 80%;
  height: 100%;
  border: 1px solid #ccc;
  margin-right: 16px;
  overflow-y: auto;
}

.right-side {
  display: flex;
  width: 20%;
  height: 100%;
  border: 1px solid #ccc;
}

/* Data pane hierarchy - Level 0 (root) */
.data-pane {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: min-content;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: visible;
}

/* Referencing data panes (nested levels) - keep padding but no border */
.referencing-data-pane {
  padding: 10px;
  overflow-y: auto;
}

/* Data pane content - contains field-pane and results-list with colored left border */
.data-pane-content {
  border-radius: 4px;
}

.root-data-pane .data-pane-content {
  border-left: 4px solid #0d6efd; /* Root level - Blue */
}

.referencing-data-pane .data-pane-content {
  border-left: 4px solid #20c997; /* Level 1 - Green */
}

/* Level 2 - Purple */
.referencing-data-pane .referencing-data-pane .data-pane-content {
  border-left-color: #6f42c1;
}

/* Level 3 - Orange */
.referencing-data-pane .referencing-data-pane .referencing-data-pane .data-pane-content {
  border-left-color: #fd7e14;
}

/* Level 4+ - Gray */
.referencing-data-pane .referencing-data-pane .referencing-data-pane .referencing-data-pane .data-pane-content {
  border-left-color: #6c757d;
}

/* Data panes nested inside related results panes should align with their siblings */
.related-results-lists-pane .data-pane {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

/* Field pane wrapper with disclosure (collapsible) */
.field-pane-wrapper {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.field-pane-disclosure-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: #e9ecef;
  font: inherit;
  text-align: left;
  cursor: pointer;
  list-style: none;
}

.field-pane-disclosure-header:hover {
  background: #dee2e6;
}

.field-pane-disclosure-header:focus {
  outline: 2px solid #80bdff;
  outline-offset: 2px;
}

.field-pane-disclosure-triangle {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  margin-right: 2px;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.field-pane-wrapper:not(.collapsed) .field-pane-disclosure-triangle {
  transform: rotate(0deg);
}

.field-pane-disclosure-label {
  font-weight: 600;
  font-size: 14px;
}

.field-pane-content {
  overflow: hidden;
}

.field-pane-wrapper.collapsed .field-pane-content {
  display: none;
}

/* Field pane */
.field-pane {
  background-color: #f8f9fa;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 12px;
  width: 100%;
  overflow: scroll;
}

/* Nested field panes */
.field-pane.nested {
  overflow: hidden;
}

.nested-field-pane-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nested-field-pane-label {
  font-weight: 600;
  font-size: 0.95em;
  color: inherit;
}

/* Field panes inside referencing data panes should align with related results lists */
.referencing-data-pane .data-pane-content > .field-pane-wrapper {
  margin-left: 12px;
  margin-top: 8px;
}

.referencing-data-pane .data-pane-content > .ancestor-placeholder {
  margin-left: 12px;
  margin-top: 8px;
}

/* Field panes inside referencing data panes - no special border, uses parent color */

/* Fields container inside field pane */
.field-pane-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 5px;
  width: 100%;
  min-width: 0;
}

.field-pane .field {
  min-width: 180px;
}

/* Individual field labels */
.field-pane .field label {
  display: block;
}

/* Selected field highlighting */
.field-pane .selected {
  background-color: lightblue;
}

/* Note: FieldPane uses HeaderBar/HeaderBox, not traditional form fields */
.field-pane input,
.field-pane select,
.field-pane textarea {
  padding: 4px 8px;
  border: 1px solid #ced4da;
  border-radius: 3px;
  font-size: 13px;
}

.field-pane input:focus,
.field-pane select:focus,
.field-pane textarea:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Ancestor placeholder - shown when a FieldPane would display redundant data */
.ancestor-placeholder {
  padding: 20px;
  margin: 10px 0;
  background-color: #f8f9fa;
  border: 1px dashed #dee2e6;
  border-radius: 4px;
  color: #6c757d;
  font-style: italic;
  text-align: center;
  font-size: 18px;
}

/* Results list container */
.results-list-container {
  background-color: #ffffff;
  border: 1px solid #000;
  border-radius: 4px;
  padding-bottom: 12px;
  overflow-x: scroll;
  overflow-y: hidden;
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  line-height: 0;
  /* Hide scrollbar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.results-list-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Label container (table name) */
.label-container {
  width: 100%;
  height: 30px;
  padding: 0 12px;
  background-color: #f8f9fa;
  border: 1px solid #000;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  box-sizing: border-box;
}

.table-name-label {
  font-weight: bold;
  font-family: Arial;
  color: #212529;
  font-size: 16px;
  line-height: 1.2;
  text-align: left;
  border-bottom: 1px solid #000;
  box-sizing: border-box;
  cursor: pointer;
  margin-right: 10px;
  flex-shrink: 0;
}

/* Buttons - Modern style */
.btn,
.new-button,
.duplicate-button,
.delete-button {
  height: 26px;
  padding: 4px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
}

.btn:hover,
.new-button:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b3fa0 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.btn:active,
.new-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.delete-button {
  background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
  box-shadow: 0 2px 6px rgba(238, 9, 121, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.delete-button:hover {
  background: linear-gradient(135deg, #d6086d 0%, #e65f00 100%);
  box-shadow: 0 4px 12px rgba(238, 9, 121, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.delete-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(238, 9, 121, 0.3);
}

.duplicate-button {
  background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
  box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.duplicate-button:hover {
  background: linear-gradient(135deg, #138496 0%, #0e6674 100%);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.duplicate-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(23, 162, 184, 0.3);
}

/* New button color variations by nesting level */
/* Root level - Blue (matches root data-pane-content border) */
.root-data-pane .new-button {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.root-data-pane .new-button:hover {
  background: linear-gradient(135deg, #0b5ed7 0%, #0a53be 100%);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.root-data-pane .new-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(13, 110, 253, 0.3);
}

/* Level 1 - Green (matches related-results-lists-pane border) */
.referencing-data-pane .new-button {
  background: linear-gradient(135deg, #20c997 0%, #17a589 100%);
  box-shadow: 0 2px 6px rgba(32, 201, 151, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.referencing-data-pane .new-button:hover {
  background: linear-gradient(135deg, #1cb386 0%, #148f75 100%);
  box-shadow: 0 4px 12px rgba(32, 201, 151, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.referencing-data-pane .new-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(32, 201, 151, 0.3);
}

/* Level 2 - Purple */
.referencing-data-pane .referencing-data-pane .new-button {
  background: linear-gradient(135deg, #6f42c1 0%, #5a31a0 100%);
  box-shadow: 0 2px 6px rgba(111, 66, 193, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.referencing-data-pane .referencing-data-pane .new-button:hover {
  background: linear-gradient(135deg, #5e38a8 0%, #4a2885 100%);
  box-shadow: 0 4px 12px rgba(111, 66, 193, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.referencing-data-pane .referencing-data-pane .new-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(111, 66, 193, 0.3);
}

/* Level 3 - Orange */
.referencing-data-pane .referencing-data-pane .referencing-data-pane .new-button {
  background: linear-gradient(135deg, #fd7e14 0%, #e86800 100%);
  box-shadow: 0 2px 6px rgba(253, 126, 20, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.referencing-data-pane .referencing-data-pane .referencing-data-pane .new-button:hover {
  background: linear-gradient(135deg, #e67012 0%, #d25f00 100%);
  box-shadow: 0 4px 12px rgba(253, 126, 20, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.referencing-data-pane .referencing-data-pane .referencing-data-pane .new-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(253, 126, 20, 0.3);
}

/* Level 4+ - Gray */
.referencing-data-pane .referencing-data-pane .referencing-data-pane .referencing-data-pane .new-button {
  background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
  box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.referencing-data-pane .referencing-data-pane .referencing-data-pane .referencing-data-pane .new-button:hover {
  background: linear-gradient(135deg, #5a6268 0%, #484e53 100%);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.referencing-data-pane .referencing-data-pane .referencing-data-pane .referencing-data-pane .new-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(108, 117, 125, 0.3);
}

/* Hidden header bar */
.hidden-header-bar {
  opacity: 0;
}

/* Scrolling header bar container */
.scrolling-header-bar-container {
  padding: 0;
  margin: 0;
  border: none;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  display: inline-block;
  /* Hide scrollbar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.scrolling-header-bar-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Header box */
.header-box {
  box-shadow: inset 0px 0px 10px 4px rgba(155, 155, 155, 0.5);
  background: white;
  user-select: none;
  overflow: hidden;
  height: 24px;
  position: absolute;
  top: 0px;
  z-index: 1;
  display: flex;
  align-items: center;
  outline: none;
}

.header-box .priority-display {
  display: none;
  z-index: 5;
  position: absolute;
  right: 0;
  white-space: nowrap;
  margin-right: 7px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.header-box .sizer {
  width: 4px;
  height: 100%;
  background: gray;
  box-shadow: inset 0px 0px 1px 1px rgba(155, 155, 155, 0.3);
  cursor: ew-resize;
  position: absolute;
  z-index: 10;
}

.header-box span {
  display: inline-block;
  padding: 0 5px;
  white-space: nowrap;
}

.header-box .focus-rect {
  position: absolute;
  top: 1px;
  left: 1px;
  right: 5px;
  bottom: 1px;
  border: 2px solid #555;
}

/* Header bar */
.header-bar-container {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  overflow-x: auto;
  overflow-y: hidden;
}

.header-bar {
  display: inline-block;
  position: relative;
  height: 24px;
  margin: 0px;
  padding: 0px;
  box-sizing: border-box;
}

.header-bar .spacer {
  width: 0px;
  height: 100%;
  position: absolute;
  top: 0px;
  background-color: transparent;
}

/* Grid container */
.grid-container {
  overflow: auto;
  max-height: 400px;
}

/* Database table grid */
.database-table-grid {
  min-width: 0px;
  overflow: visible;
  display: inline-block;
  position: relative;
  margin: 0px;
  padding: 0px;
  box-sizing: border-box;
}

.database-table-grid .cell-wrapper {
  min-width: 0px;
  position: relative;
  margin: 0px;
  padding: 0px;
  box-sizing: border-box;
}

.database-table-grid .cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: absolute;
  top: 0px;
  box-sizing: border-box;
  padding: 2px 5px;
}

.database-table-grid .cell.selected {
  background-color: lightblue;
}

/* Inline cell editor (spreadsheet-style edit) */
.database-table-grid .cell-editor {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 2px 5px;
  border: 1px solid #666;
  box-sizing: border-box;
  font: inherit;
}

.database-table-grid .cell-editor-checkbox {
  width: auto;
  height: auto;
  margin: auto;
  vertical-align: middle;
}

/* Scrolling grid container */
.scrolling-grid-container {
  padding: 0;
  margin: 0;
  border: none;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  display: inline-block;
  /* Hide scrollbar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.scrolling-grid-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Horizontal scrollbar */
.horizontal-scrollbar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  display: inline-block;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

/* Related results lists pane - no colored border, uses parent referencing-data-pane color */
.related-results-lists-pane {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  background-color: #f8f9fa;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  margin-left: 0;
  margin-top: 8px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.related-results-lists-scroll-area {
  width: 100%;
  height: auto;
  min-height: min-content;
  overflow: visible;
}

/* Background color variations by nesting level */
/* Level 2 */
.referencing-data-pane .referencing-data-pane .related-results-lists-pane {
  background-color: #f1f3f5;
}

/* Level 3 */
.referencing-data-pane .referencing-data-pane .referencing-data-pane .related-results-lists-pane {
  background-color: #e9ecef;
}

/* Level 4+ */
.referencing-data-pane .referencing-data-pane .referencing-data-pane .referencing-data-pane .related-results-lists-pane {
  background-color: #dee2e6;
}

/* Horizontal scrollbar */
.horizontal-scrollbar {
  height: 12px;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

/* JSON Field Input Styles */
.json-field-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.json-textarea {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  padding: 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  resize: both;
  min-height: 150px;
  min-width: 300px;
  background-color: #f8f9fa;
  color: #212529;
}

.json-textarea:focus {
  outline: none;
  border-color: #80bdff;
  background-color: #fff;
}

.json-textarea:disabled {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.json-error-highlight {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.json-error {
  color: #dc3545;
  font-size: 12px;
  padding: 4px 8px;
  background-color: #fff5f5;
  border: 1px solid #dc3545;
  border-radius: 4px;
}

.format-json-button {
  align-self: flex-start;
  padding: 6px 12px;
  font-size: 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.format-json-button:hover {
  background-color: #0056b3;
}

.format-json-button:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

/* JSON Schema Editor Styles */
.json-schema-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.json-schema-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px;
  background-color: #f8f9fa;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.json-schema-form.json-error-highlight {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.json-schema-object {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.json-schema-object-label {
  font-weight: 600;
  font-size: 14px;
  color: #495057;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #dee2e6;
}

.json-schema-object-properties {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 16px;
}

.json-schema-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.json-schema-field label {
  font-size: 13px;
  font-weight: 500;
  color: #495057;
}

.json-schema-field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.json-schema-field-checkbox label {
  margin: 0;
}

.json-schema-input,
.json-schema-select {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 3px;
  font-size: 13px;
  background-color: white;
}

.json-schema-input:focus,
.json-schema-select:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.json-schema-input:disabled,
.json-schema-select:disabled {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.json-schema-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.json-schema-checkbox:disabled {
  cursor: not-allowed;
}

/* JSON Schema Array Styles */
.json-schema-array {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.json-schema-array-label {
  font-size: 13px;
  font-weight: 500;
  color: #495057;
  margin-bottom: 4px;
}

.json-schema-array-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  min-height: 40px;
}

.json-schema-array-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.json-schema-array-item input {
  flex: 1;
}

.json-schema-array-add {
  align-self: flex-start;
  padding: 4px 12px;
  font-size: 12px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.json-schema-array-add:hover {
  background-color: #218838;
}

.json-schema-array-add:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.json-schema-array-remove {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  font-weight: bold;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.json-schema-array-remove:hover {
  background-color: #c82333;
}

.json-schema-array-remove:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

/* ==================== Dialog Styles ==================== */

/* Dialog overlay - full-screen backdrop */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Dialog container - the actual dialog box */
.dialog-container {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 32px;
  min-width: 400px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Dialog message container. pre-wrap preserves \n as line breaks while wrapping long lines. */
.dialog-message {
  color: #212529;
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
  padding: 16px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #0d6efd;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  white-space: pre-wrap;
}

/* Dialog message for warnings/errors */
.dialog-message.warning {
  border-left-color: #fd7e14;
  background-color: #fff5f0;
}

.dialog-message.error {
  border-left-color: #dc3545;
  background-color: #fff5f5;
}

/* Dialog buttons container */
.dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

/* Dialog button base styles */
.dialog-button {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
  min-width: 100px;
  letter-spacing: 0.3px;
}

.dialog-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.dialog-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dialog-button:focus {
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* Primary button (OK, Yes) */
.dialog-button-primary {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  color: #ffffff;
}

.dialog-button-primary:hover {
  background: linear-gradient(135deg, #0b5ed7 0%, #0a53be 100%);
}

/* Secondary button (Cancel, No) */
.dialog-button-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
  color: #ffffff;
}

.dialog-button-secondary:hover {
  background: linear-gradient(135deg, #5a6268 0%, #484e53 100%);
}

/* Destructive button (Delete, Remove) */
.dialog-button-destructive {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: #ffffff;
}

.dialog-button-destructive:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
}

/* Success button (Confirm, Save) */
.dialog-button-success {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
  color: #ffffff;
}

.dialog-button-success:hover {
  background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
}

/* Dialog title (for dialogs with titles) */
.dialog-title {
  font-size: 20px;
  font-weight: 700;
  color: #212529;
  text-align: center;
  margin: 0;
  padding-bottom: 16px;
  border-bottom: 2px solid #e9ecef;
}
