/* ==========================================================================
   Catalog Explorer — Preview Page Styles
   Mirrors the Segoe UI / Fluent design from the Power BI catalog dialog
   (catalogDialog.ts inline styles) for a consistent cross-product look.
   ========================================================================== */

/* ---------- Hero ---------- */
.hero.hero--catalog {
  background: linear-gradient(rgba(12,60,120,.75),rgba(12,60,120,.75)), url('/images/cataloghero.png') center/cover no-repeat;
  color: #fff;
  text-align: center;
  padding: 48px 24px 36px;
}
.hero.hero--catalog h1 {
  font: 700 32px/1.2 'Segoe UI', wf_segoe-ui_normal, helvetica, arial, sans-serif;
  margin: 0 0 12px;
  color: #fff;
}
.hero.hero--catalog p {
  font: 400 16px/1.6 'Segoe UI', wf_segoe-ui_normal, helvetica, arial, sans-serif;
  max-width: 740px;
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.92);
}

/* ---------- Page wrapper ---------- */
.catalog-page {
  max-width: none;
  margin: 0 auto;
  padding: 24px 20px 0;
}

/* ---------- App container ---------- */
.catalog-app {
  font-family: 'Segoe UI', wf_segoe-ui_normal, helvetica, arial, sans-serif;
  color: #323130;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  /* Fill viewport below the fixed header, minus top padding */
  height: calc(100vh - var(--site-header-height, 100px) - 24px);
}

/* ---------- Filter bar — mirrors createFiltersContainer() ---------- */
.catalog-filters {
  margin-bottom: 8px;
  flex-shrink: 0;
}
.catalog-filter-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.catalog-filter-row label {
  width: 70px;
  font-weight: 500;
  font-size: 14px;
  flex-shrink: 0;
}
.catalog-filter-row input[type="text"],
.catalog-filter-row select {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #8a8886;
  border-radius: 4px;
  background: #fff;
  color: #323130;
  outline: none;
  transition: border-color .1s;
  font-family: inherit;
}
.catalog-filter-row input[type="text"]:focus {
  border-color: #0078d4;
}
.catalog-filter-row select {
  cursor: pointer;
}

/* Tags dropdown — mirrors createTagsDropdown() */
.catalog-tags-dropdown {
  flex: 1;
  position: relative;
}
.catalog-tags-dropdown input {
  width: 100%;
  box-sizing: border-box;
}
.catalog-tags-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #8a8886;
  border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, .1);
}
.catalog-tags-list.open {
  display: block;
}
.catalog-tags-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #323130;
}
.catalog-tags-option:hover {
  background: #f3f2f1;
}

/* Regions searchable dropdown — mirrors tags dropdown */
.catalog-regions-dropdown {
  flex: 1;
  position: relative;
}
.catalog-regions-dropdown input {
  width: 100%;
  box-sizing: border-box;
}
.catalog-regions-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #8a8886;
  border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, .1);
}
.catalog-regions-list.open {
  display: block;
}
.catalog-regions-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #323130;
}
.catalog-regions-option:hover {
  background: #f3f2f1;
}

/* Selected tags / regions chips — mirrors createChip() */
.catalog-selected-tags,
.catalog-selected-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: 70px;
  margin-bottom: 10px;
}
.catalog-selected-tags:empty,
.catalog-selected-regions:empty {
  display: none;
}
.catalog-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  background: #e1dfdd;
  color: #323130;
  border-radius: 16px;
}
.catalog-chip button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  color: #323130;
  padding: 0;
  margin-left: 6px;
  line-height: 1;
}

/* ---------- Main split — mirrors createAddLayerMainContainer() ---------- */
.catalog-main {
  display: flex;
  flex-direction: row;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

/* Map panel — mirrors createAddLayerMapContainer() */
.catalog-map-panel {
  flex: 1;
  min-width: 400px;
  display: flex;
  flex-direction: column;
}
.catalog-map {
  flex: 1;
  min-height: 200px;
  border-radius: 4px;
  border: 1px solid #edebe9;
  background: #faf9f8;
  position: relative;
  overflow: hidden;
}

/* Layer info panel — shown below map when a search result is selected */
.catalog-info-panel {
  display: none;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #edebe9;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: #323130;
  overflow: hidden;
}
.catalog-info-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
}
.catalog-info-panel__header:hover {
  background: #f3f2f1;
}
.catalog-info-panel__title {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-info-panel__chevron {
  font-size: 14px;
  color: #605e5c;
  flex-shrink: 0;
  margin-left: 8px;
  transition: transform 0.2s;
}
.catalog-info-panel__body {
  padding: 0 14px 12px 14px;
  max-height: 170px;
  overflow-y: auto;
}
.catalog-info-panel__badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.catalog-info-panel__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.catalog-info-panel__badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.catalog-info-panel__resource-icons {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.catalog-info-panel__resource-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
}
.catalog-info-panel__resource-icon:hover {
  background-color: rgba(0, 0, 0, 0.08);
}
.catalog-info-panel__desc {
  margin-bottom: 6px;
  color: #605e5c;
}
.catalog-info-panel__field {
  margin-bottom: 4px;
}
.catalog-info-panel__field strong {
  font-weight: 600;
}
.catalog-info-panel__field a {
  color: #0078d4;
  text-decoration: none;
}
.catalog-info-panel__field a:hover {
  text-decoration: underline;
}
.catalog-info-panel__resources {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}
.catalog-info-panel__resource-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  color: #323130;
  transition: background-color 0.15s;
}
.catalog-info-panel__resource-row:hover {
  background-color: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}
.catalog-info-panel__resource-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.catalog-info-panel__resource-row-name {
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-info-panel__resource-row-badge {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Right panel — mirrors createAddLayerRightPanel() */
.catalog-right-panel {
  flex: 0 0 600px;
  min-width: 350px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* View containers (browse / preview) — fill the right panel and scroll internally */
.catalog-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Results wrapper — mirrors createAddLayerResultsWrapper() ---------- */
.catalog-results-header {
  font-size: 13px;
  color: #605e5c;
  padding-bottom: 8px;
  flex-shrink: 0;
}
.catalog-results {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #edebe9;
  border-radius: 4px;
  min-height: 0;
}
.catalog-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.catalog-results thead {
  background: #faf9f8;
  position: sticky;
  top: 0;
  z-index: 2;
}
.catalog-results th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: #605e5c;
  border-bottom: 1px solid #edebe9;
}
.catalog-results th:first-child {
  width: 20px;
  padding: 12px 4px;
}
.catalog-results td {
  padding: 12px 10px;
  border-bottom: 1px solid #edebe9;
}
.catalog-results td:first-child {
  padding: 12px 4px;
  text-align: center;
  width: 15px;
}
.catalog-results tr {
  cursor: pointer;
  transition: background-color .1s;
}
.catalog-results tbody tr:hover {
  background: #f3f2f1;
}
.catalog-results tbody tr.selected {
  background: #e6f2fb;
}

/* Access type indicator — matches createResultsTableRow() */
.catalog-access-icon {
  cursor: help;
}
.catalog-access-icon--basic {
  color: #107c10;
  font-weight: bold;
}

/* Layer group badge — matches createResultsTableRow() groupBadge */
.catalog-group-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  background: #e8f4f0;
  color: #117865;
  border-radius: 4px;
  border: 1px solid #117865;
  cursor: help;
}

/* Preview badge for commercial layers */
.catalog-preview-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  background: #fff4ce;
  color: #8a6d3b;
  border-radius: 4px;
  border: 1px solid #ffb900;
}

/* ---------- Bottom buttons bar — mirrors createAddLayerButtonsContainer() ---------- */
.catalog-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-shrink: 0;
}
.catalog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 8px 16px;
  font: 600 14px/1 'Segoe UI', wf_segoe-ui_normal, helvetica, arial, sans-serif;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background-color .1s;
}
.catalog-btn--primary {
  background: #117865;
  color: #fff;
}
.catalog-btn--primary:hover {
  background: #0e5f51;
}
.catalog-btn--primary:disabled {
  background: #f3f2f1;
  color: #a19f9d;
  cursor: not-allowed;
}
.catalog-btn--secondary {
  background: #fff;
  color: #323130;
  border: 1px solid #8a8886;
}
.catalog-btn--secondary:hover {
  background: #f3f2f1;
}

/* ---------- Preview view ---------- */

/* Layer title — matches showConfigureLayerForm() layerTitle */
.catalog-preview-title {
  font-size: 18px;
  font-weight: 600;
  padding-bottom: 15px;
}

/* Layer meta info */
.catalog-layer-meta {
  font-size: 13px;
  color: #605e5c;
  margin-bottom: 12px;
  line-height: 1.6;
}
.catalog-layer-meta p {
  margin: 0 0 4px;
}

/* Config container — mirrors layerConfigContainer style */
.catalog-config-panel {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #edebe9;
  border-radius: 4px;
  padding: 15px;
}

/* CTA box */
.catalog-config-cta {
  margin-top: 15px;
  padding: 14px 18px;
  background: #f0faf8;
  border: 1px solid #b7e4d8;
  border-radius: 4px;
  font-size: 14px;
  color: #323130;
  flex-shrink: 0;
}
.catalog-config-cta p {
  margin: 0;
}
.catalog-config-cta a {
  color: #117865;
  font-weight: 600;
  text-decoration: none;
}
.catalog-config-cta a:hover {
  text-decoration: underline;
}

/* ---------- Collapsible sections — mirrors createCollapsibleSection() ---------- */
.catalog-section {
  margin-bottom: 8px;
  border: 1px solid #edebe9;
  border-radius: 4px;
  overflow: hidden;
}
.catalog-section-header {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: #f3f2f1;
  cursor: pointer;
  user-select: none;
}
.catalog-section-header .chevron {
  margin-right: 10px;
  font-size: 12px;
  display: inline-block;
  transition: transform .2s;
}
.catalog-section-header .chevron.collapsed {
  /* default: pointing right */
}
.catalog-section-header .chevron.expanded {
  transform: rotate(90deg);
}
.catalog-section-header .section-title {
  font-size: 14px;
  font-weight: 600;
}
.catalog-section-body {
  padding: 15px;
}
.catalog-section-body.collapsed {
  display: none;
}

/* ---------- Form controls inside sections ---------- */
.catalog-form-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.catalog-form-row label {
  width: 130px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}
.catalog-form-row select,
.catalog-form-row input[type="text"],
.catalog-form-row input[type="number"] {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #8a8886;
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  color: #323130;
}
.catalog-form-row input[type="color"] {
  width: 60px;
  height: 32px;
  padding: 2px;
  border: 1px solid #8a8886;
  border-radius: 4px;
  cursor: pointer;
}
.catalog-form-row input[type="range"] {
  flex: 1;
  accent-color: #117865;
}

/* Gradient preview bar */
.catalog-gradient-preview {
  height: 16px;
  border-radius: 4px;
  border: 1px solid #edebe9;
  margin-bottom: 8px;
}

/* ---------- Info row — mirrors createInfoRow() ---------- */
.catalog-info-row {
  display: flex;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.6;
}
.catalog-info-row dt {
  width: 100px;
  font-weight: 600;
  flex-shrink: 0;
  color: #323130;
}
.catalog-info-row dd {
  margin: 0;
  color: #605e5c;
}
.catalog-info-row a {
  color: #117865;
  text-decoration: none;
}
.catalog-info-row a:hover {
  text-decoration: underline;
}

/* ---------- Spinner — mirrors showInitializingOverlay() ---------- */
.catalog-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
}
.catalog-spinner-ring {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f2f1;
  border-top-color: #117865;
  border-radius: 50%;
  animation: catalogSpin 1s linear infinite;
}
.catalog-spinner-text {
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}
.catalog-spinner-sub {
  font-size: 13px;
  color: #605e5c;
}
@keyframes catalogSpin {
  to { transform: rotate(360deg); }
}

/* ---------- "Can't find" — mirrors createCantFindMessage() ---------- */
.catalog-cant-find {
  margin-top: 15px;
  font-size: 14px;
  color: #323130;
  flex-shrink: 0;
}
.catalog-cant-find a {
  color: #117865;
  font-weight: 600;
  text-decoration: none;
}
.catalog-cant-find a:hover {
  text-decoration: underline;
}

/* ---------- No results ---------- */
.catalog-no-results {
  padding: 20px;
  text-align: center;
  color: #605e5c;
}

/* ---------- Scroll indicator ---------- */
.catalog-scroll-end {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: #a19f9d;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .catalog-app {
    height: auto;
    min-height: calc(100vh - var(--site-header-height, 100px) - 24px);
  }
  .catalog-main {
    flex-direction: column;
  }
  .catalog-map-panel {
    min-width: 0;
    min-height: 350px;
  }
  .catalog-map {
    min-height: 350px;
  }
  .catalog-right-panel {
    min-width: 0;
  }
}

/* ---------- Gradient stop markers ---------- */
.gradient-stop-marker:hover {
  z-index: 10;
}
.gradient-stop-marker:active {
  z-index: 20;
}

/* Color input appearance reset */
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

/* Palette dropdown scrollbar */
#paletteDropdownList::-webkit-scrollbar {
  width: 6px;
}
#paletteDropdownList::-webkit-scrollbar-thumb {
  background: #c8c6c4;
  border-radius: 3px;
}

/* ===========================================================================================
   Commercial Layer Modal
   =========================================================================================== */
.commercial-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: commercialFadeIn 0.2s ease;
}
@keyframes commercialFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.commercial-modal {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  width: 600px;
  max-width: 92vw;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: commercialSlideUp 0.25s ease;
  font-family: 'Segoe UI', wf_segoe-ui_normal, helvetica, arial, sans-serif;
}
@keyframes commercialSlideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.commercial-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #edebe9;
}
.commercial-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #323130;
  flex: 1;
  line-height: 1.3;
}
.commercial-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #0078d4;
  background: #e6f2ff;
  border: 1px solid #0078d4;
  border-radius: 4px;
  white-space: nowrap;
}
.commercial-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #605e5c;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.commercial-modal-close:hover {
  background: #f3f2f1;
  color: #323130;
}
.commercial-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 24px;
}
.commercial-modal-body::-webkit-scrollbar { width: 6px; }
.commercial-modal-body::-webkit-scrollbar-thumb { background: #c8c6c4; border-radius: 3px; }
.commercial-preview-image {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #edebe9;
  margin-bottom: 16px;
}
.commercial-description {
  font-size: 13px;
  color: #605e5c;
  line-height: 1.6;
  margin-bottom: 16px;
}
.commercial-meta-section {
  margin-top: 14px;
}
.commercial-meta-label {
  font-weight: 600;
  font-size: 13px;
  color: #323130;
  margin-bottom: 4px;
}
.commercial-meta-value {
  font-size: 13px;
  color: #605e5c;
  line-height: 1.5;
}
.commercial-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.commercial-tag {
  padding: 4px 8px;
  font-size: 11px;
  background: #f3f2f1;
  color: #605e5c;
  border-radius: 4px;
}
.commercial-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #8a8886;
  font-size: 12px;
}
.commercial-divider::before,
.commercial-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #edebe9;
}
.commercial-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.commercial-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s;
  text-align: center;
}
.commercial-btn:hover { filter: brightness(0.92); }
.commercial-btn--visit {
  background: #0078d4;
  color: #ffffff;
}
.commercial-btn--contact {
  background: #117865;
  color: #ffffff;
}
.commercial-modal-footer {
  padding: 12px 24px 16px;
  border-top: 1px solid #edebe9;
  display: flex;
  justify-content: flex-end;
}
.commercial-btn--close {
  background: #ffffff;
  color: #323130;
  border: 1px solid #8a8886;
}
.commercial-btn--close:hover {
  background: #f3f2f1;
  filter: none;
}

/* ---------- Admin: JSON Editor Pane ---------- */
.catalog-json-editor {
  flex: 0 0 420px;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  border: 1px solid #edebe9;
  border-radius: 4px;
  background: #1e1e1e;
  overflow: hidden;
  position: relative;
}

.catalog-json-editor__resize {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}

.catalog-json-editor__resize::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  border-radius: 2px;
  background: rgba(255,255,255,.15);
  transition: background .15s;
}

.catalog-json-editor__resize:hover::after {
  background: rgba(255,255,255,.4);
  height: 60px;
}

.catalog-json-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #252526;
  color: #cccccc;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid #3c3c3c;
  flex-shrink: 0;
}

.catalog-json-editor__status {
  font-size: 12px;
  font-weight: 400;
}

.catalog-json-editor__wrap-btn {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: #969696;
  background: transparent;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
}

.catalog-json-editor__wrap-btn:hover {
  color: #ddd;
  border-color: #888;
}

.catalog-json-editor__wrap-btn.active {
  color: #fff;
  background: #0078d4;
  border-color: #0078d4;
}

.catalog-json-editor__update-from-ui-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #0078d4;
  border: 1px solid #006cbe;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.catalog-json-editor__update-from-ui-btn:hover:not(:disabled) {
  background: #006cbe;
}

.catalog-json-editor__update-from-ui-btn:disabled {
  opacity: .5;
  cursor: default;
}

.catalog-json-editor__save-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #117865;
  border: 1px solid #0e5f51;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.catalog-json-editor__save-btn:hover:not(:disabled) {
  background: #0e5f51;
}

.catalog-json-editor__save-btn:disabled {
  opacity: .5;
  cursor: default;
}

.catalog-json-editor__save-btn.saving {
  color: #ccc;
  background: #555;
  border-color: #666;
}

.catalog-json-editor__delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #a1260d;
  border: 1px solid #8b1e0a;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.catalog-json-editor__delete-btn:hover:not(:disabled) {
  background: #8b1e0a;
}

.catalog-json-editor__delete-btn:disabled {
  opacity: .5;
  cursor: default;
}

.catalog-json-editor__delete-btn.deleting {
  color: #ccc;
  background: #555;
  border-color: #666;
}

.catalog-json-editor__preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #6e6e6e;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.catalog-json-editor__preview-btn:hover {
  background: #555;
}

.catalog-json-editor__preview-btn.active {
  color: #fff;
  background: #d48a11;
  border-color: #b8760e;
}

.catalog-json-editor__preview-btn.active:hover {
  background: #b8760e;
}

/* Code wrapper — positions highlight layer behind textarea */
.catalog-json-editor__code-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

/* Shared font/spacing for both layers */
.catalog-json-editor__textarea,
.catalog-json-editor__highlight {
  font: 13px/1.5 'Cascadia Code', 'Fira Code', 'Consolas', 'Courier New', monospace;
  tab-size: 2;
  white-space: pre;
  padding: 12px;
  margin: 0;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* Highlight layer — renders coloured spans */
.catalog-json-editor__highlight {
  overflow: auto;
  background: #1e1e1e;
  color: #d4d4d4;
  pointer-events: none;
  z-index: 1;
  /* Make scrollbar invisible but preserve its width so the text area
     matches the textarea's available width (fixes cursor mismatch). */
  scrollbar-color: transparent transparent; /* Firefox */
}
.catalog-json-editor__highlight::-webkit-scrollbar {
  background: transparent;
}
.catalog-json-editor__highlight::-webkit-scrollbar-thumb {
  background: transparent;
}

/* Textarea layer — transparent text, visible caret */
.catalog-json-editor__textarea {
  overflow: auto;
  background: transparent;
  color: transparent;
  caret-color: #d4d4d4;
  outline: none;
  resize: none;
  z-index: 2;
}

.catalog-json-editor__textarea::selection {
  background: rgba(38, 79, 120, 0.7);
  color: transparent;
}

.catalog-json-editor__textarea::-moz-selection {
  background: rgba(38, 79, 120, 0.7);
  color: transparent;
}

/* VS Code Dark+ token colours */
.jh-k { color: #9cdcfe; }       /* keys — light blue */
.jh-s { color: #ce9178; }       /* string values — orange/salmon */
.jh-n { color: #b5cea8; }       /* numbers — light green */
.jh-b { color: #569cd6; }       /* booleans & null — blue */
.jh-p { color: #d4d4d4; }       /* punctuation — grey */

/* 3‑pane layout when editing */
.catalog-main--editing {
  gap: 12px;
}

.catalog-main--editing .catalog-map-panel {
  min-width: 300px;
}

.catalog-main--editing .catalog-right-panel {
  flex: 0 0 500px;
  min-width: 300px;
}

/* ---------- Admin: AI Chat Bar in JSON Editor (Copilot-style) ---------- */
.catalog-json-editor__chat {
  padding: 8px 10px;
  background: #1e1e1e;
  border-top: 1px solid #3c3c3c;
  flex-shrink: 0;
}

.catalog-json-editor__chat-wrap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px 4px 4px 12px;
  background: #2d2d2d;
  border: 1px solid #3c3c3c;
  border-radius: 20px;
  transition: border-color .15s;
}

.catalog-json-editor__chat-wrap:focus-within {
  border-color: #0078d4;
}

.catalog-json-editor__chat-input {
  flex: 1;
  padding: 5px 0;
  font: 14px/1.45 'Segoe UI', sans-serif;
  color: #e8e8e8;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  min-height: 0;
  max-height: 120px;
}

.catalog-json-editor__chat-input::placeholder {
  color: #808080;
}

.catalog-json-editor__chat-input:disabled {
  opacity: .5;
}

/* Loading spinner inside send button */
.catalog-json-editor__chat-send .catalog-spin {
  animation: catalogSpin 0.8s linear infinite;
}

.catalog-json-editor__chat-send,
.catalog-json-editor__chat-undo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, opacity .15s;
}

.catalog-json-editor__chat-send {
  color: #fff;
  background: #0078d4;
}

.catalog-json-editor__chat-send:hover:not(:disabled) {
  background: #106ebe;
}

.catalog-json-editor__chat-send:disabled {
  opacity: .35;
  cursor: default;
}

.catalog-json-editor__chat-undo {
  color: #969696;
  background: transparent;
}

.catalog-json-editor__chat-undo:hover:not(:disabled) {
  color: #d4d4d4;
  background: #3c3c3c;
}

.catalog-json-editor__chat-undo:disabled {
  opacity: .25;
  cursor: default;
}

/* ---------- Pane resize handle (between map and config) ---------- */
.catalog-pane-resize {
  flex: 0 0 6px;
  cursor: col-resize;
  position: relative;
  z-index: 5;
  /* invisible but hoverable */
}

.catalog-pane-resize::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  border-radius: 2px;
  background: rgba(0,0,0,.12);
  transition: background .15s, height .15s;
}

.catalog-pane-resize:hover::after {
  background: rgba(0,0,0,.3);
  height: 60px;
}
