/* Hide shoelace library components until they have been defined */
:not(:defined) {
  visibility: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  /* Apply to all elements */
}


body {
  font-family: sans-serif;
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  /* Add this to the body */
}


h1,
h2,
h3 {
  margin: auto
}

.hidden {
  visibility: hidden;
}

.hbox-with-gap {
  display: flex;
  flex-direction: row;
  margin: 0px;
  padding: 0px;
  gap: 10px;
}

#container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  padding: 10px;
}

#toolbar {
  height: 55px;
}

#toolbar.dropdown-open {
  z-index: var(--sl-z-index-dropdown);
}

/* special styling of the toolbar to align the labels of the selectboxes and button groups */
#toolbar sl-button-group[label]:before {
  content: attr(label);
  position: absolute;
  top: -8px;
  left: 0;
  color: var(--sl-color-gray-500);
  font-size: smaller;
  white-space: nowrap;
  display: block;
}

#toolbar sl-select::part(form-control) {
  transform: translateY(-5px);
}

#toolbar sl-button::part(base) {
  margin-top: 5px;
}

sl-select::part(form-control-label) {
  font-size: smaller;
  color: var(--sl-color-gray-500)
}


#editors {
  flex-grow: 1;
  display: flex;
  flex-direction: row;
  margin: 0px;
  gap: 10px;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#pdf-viewer {
  width: 50%;
  border: 1px solid #ccc;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

iframe {
  width: 100%;
  flex-grow: 1;
  border: none;
  order: 1;
  /* Ensure iframe appears after headerbar and before statusbar */
}

#xml-editor {
  width: 50%;
  border: 1px solid #ccc;
  display: flex;
  /* Use flexbox to manage codemirror-container height */
  flex-direction: column;
}

#codemirror-container {
  flex-grow: 1;
  /* Allow codemirror-container to take up all available height */
  height: 100%;
  /*Important, otherwise it won't work.*/
  overflow: scroll;
}


sl-dialog {
  --header-spacing: var(--sl-spacing-small);
  --body-spacing: var(--sl-spacing-small);
  --footer-spacing: var(--sl-spacing-small);
}

/* Headerbar styling */
status-bar[name="headerbar"] {
  border-bottom: 1px solid #e0e0e0;
  background: #f5f5f5;
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  order: 0;
  /* Ensure headerbar appears first */
}

/* Statusbar styling */
status-bar {
  border-top: 1px solid #e0e0e0;
  background: #f5f5f5;
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  order: 2;
  /* Ensure statusbar appears after iframe */
}

.dialog-big {
  --width: 75vw;
}

.dialog-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog-row {
  display: flex block;
  flex-direction: row;
  gap: 10px;
}

sl-select::part(display-input) {
  caret-color: transparent !important;
  font-size: smaller;
}

sl-select::part(listbox) {
  width: max-content;
}

sl-option::part(label),
sl-menu-item::part(label) {
  font-size: smaller;
}

sl-button-group[label] {
  position: relative;
  /* To contain the absolute positioning of the :before pseudo-element */
}

.invalid-xml {
  background-color: #ff000030;
}

.editor-readonly {
  background-color: #f8e8b7ba;
}

sl-icon.rotating {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* File Selection Drawer Tree Styling */

/* Font size of the tree item labels (always use a span) */
sl-tree-item span {
  font-size: smaller;
}

/* Collection items - light blue background */
sl-tree-item.collection-item::part(item) {
  background-color: var(--sl-color-blue-50);
  border-radius: var(--sl-border-radius-small);
  margin-bottom: 2px;
}

/* Gold section - light yellow/gold background */
sl-tree-item.gold-section::part(item) {
  background-color: var(--sl-color-amber-50);
  border-radius: var(--sl-border-radius-small);
  margin-bottom: 1px;
}

/* Versions section - light gray background */
sl-tree-item.versions-section {
  font-weight: 600;
}
sl-tree-item.versions-section::part(item) {
  background-color: var(--sl-color-neutral-100);
  border-radius: var(--sl-border-radius-small);
  margin-bottom: 1px;
}

/* PDF items - subtle green background */
sl-tree-item.pdf-item::part(item) {
  background-color: var(--sl-color-green-50);
  border-radius: var(--sl-border-radius-small);
  margin-bottom: 1px;
}

/* Gold and version items - normal styling with hover */
sl-tree-item.gold-item::part(item):hover,
sl-tree-item.version-item::part(item):hover {
  background-color: var(--sl-color-neutral-200);
}

/* Spacing between tree items */
sl-tree-item {
  margin-bottom: 2px;
}

/* Icon spacing */
sl-tree-item sl-icon[slot="prefix"] {
  margin-right: 0.5rem;
}
