.xsd-studio-page {
  margin: 0;
  background: #0f172a;
  color: #e5e7eb;
  font-family: Arial, sans-serif;
}

#xsdStudioApp {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  min-height: 100vh;
}

.studio-header,
.studio-bottom-panel,
.studio-status-bar {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-header__title h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.studio-header__title p {
  margin: 0;
  color: #94a3b8;
}

.studio-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 0;
}

.studio-sidebar {
  --sidebar-panel-width: 260px;
  display: grid;
  grid-template-columns: 40px var(--sidebar-panel-width);
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #111827;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: grid-template-columns 160ms ease;
}

.studio-sidebar.is-collapsed {
  grid-template-columns: 40px 0;
}

.studio-sidebar__toggle {
  position: sticky;
  top: 0;
  z-index: 2;
  grid-column: 1;
  width: 40px;
  height: 44px;
  padding: 0;
  border-radius: 0;
  background: #0f172a;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.studio-sidebar__toggle:hover,
.studio-sidebar__toggle:focus-visible {
  background: #1f2937;
  color: #ffffff;
}

.studio-toolbar {
  grid-column: 2;
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  width: var(--sidebar-panel-width);
  min-width: 0;
  min-height: 0;
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
}

.studio-sidebar.is-collapsed .studio-toolbar {
  visibility: hidden;
  padding-left: 0;
  padding-right: 0;
  width: 0;
}

.studio-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.studio-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px 16px;
  min-height: 0;
  overflow: hidden;
}

.studio-pane {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  background: #111827;
}

.studio-pane__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  background: #1f2937;
  font-weight: 600;
}

.studio-pane__header > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-pane__meta {
  flex: 0 1 auto;
  min-width: 0;
  color: #94a3b8;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-editor-host {
  min-height: 0;
  height: 100%;
}

.studio-tabs {
  min-width: 0;
}

.studio-bottom-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.studio-bottom-panel__close {
  flex: 0 0 auto;
  min-width: 28px;
  min-height: 28px;
  padding: 2px 8px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.studio-bottom-panel__close:hover,
.studio-bottom-panel__close:focus-visible {
  background: rgba(148, 163, 184, 0.14);
  color: #ffffff;
}

.toolbar-group,
.tabs-group,
.studio-status-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-group {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  overflow-y: auto;
}

.toolbar-group > button {
  padding: 4px 6px;
  min-height: 28px;
  font-size: 12px;
  line-height: 1.2;
}

.toolbar-group--external-xsd {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.toolbar-group__title {
  margin: 0;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 700;
}

button {
  background: #2563eb;
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

button.is-active {
  background: #1d4ed8;
}

.studio-panel-content {
  min-height: 160px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
}

.studio-panel-view[hidden] {
  display: none !important;
}

.result-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #e5e7eb;
}

.result-item:not(.is-static):hover {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(37, 99, 235, 0.08);
}

.result-item--error {
  background: rgba(220, 38, 38, 0.15);
}

.result-item--warning {
  background: rgba(245, 158, 11, 0.15);
}

.result-item__badge {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.result-item__target,
.result-item__location {
  color: #cbd5e1;
  font-size: 12px;
  white-space: nowrap;
}

.result-item__message {
  min-width: 0;
}

.results-empty,
.results-ok {
  color: #94a3b8;
  padding: 8px 4px;
}

.status-bar__item {
  color: #cbd5e1;
}

@media (max-width: 980px) {
  .studio-sidebar {
    --sidebar-panel-width: 220px;
  }

  .studio-workspace {
    grid-template-columns: 1fr;
  }

  .result-item {
    grid-template-columns: 1fr;
  }
}

.schema-tree-node {
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
}

.schema-tree-node:hover {
  background: rgba(59,130,246,0.15);
}

.schema-tree-kind {
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 6px;
}

.schema-tree-label {
  font-weight: 500;
}

.schema-tree-node {
  padding-top: 6px;
  padding-bottom: 6px;
  border-radius: 6px;
  cursor: pointer;
}

.schema-tree-node:hover {
  background: rgba(59, 130, 246, 0.15);
}

.schema-tree-kind {
  display: inline-block;
  min-width: 56px;
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 8px;
}

.schema-tree-label {
  font-weight: 500;
}

/* Bottom panel should not grow over the workspace */
#xsdStudioBottomPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

#xsdStudioBottomPanel[hidden] {
  display: none !important;
}

/* Keep the content area fixed and scrollable */
#xsdStudioPanelContent {
  min-height: 0;
  max-height: calc(3 * 3.25rem); /* about 3 result rows */
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Each tab panel should stay inside the scroll area */
#xsdStudioPanelContent .studio-panel-view {
  min-height: 0;
  box-sizing: border-box;
}

/* Optional: make result rows a bit more compact/predictable */
.result-item,
.result-item.is-static {
  box-sizing: border-box;
  min-height: 3rem;
}

#xsdStudioPanelContent {
  min-height: 0;
  max-height: 10rem;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.toolbar-external-xsd-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  align-items: flex-start;
  min-height: 32px;
  overflow: auto;
}

.toolbar-external-xsd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.toolbar-external-xsd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-color, #444);
  border-radius: 6px;
  background: var(--panel-bg, #1e1e1e);
  line-height: 1;
}

.toolbar-external-xsd-empty {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
}

.toolbar-external-xsd-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.toolbar-external-xsd-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 0, 0, 0.15);
  color: #ff4d4f;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.toolbar-external-xsd-chip__remove:hover {
  background: rgba(255, 0, 0, 0.3);
  transform: scale(1.05);
}

.toolbar-external-xsd-chip__remove:active {
  transform: scale(0.95);
}

.toolbar-external-xsd-chip__remove:hover {
  background: rgba(255, 255, 255, 0.12);
}
