/* ---------- Base ---------- */

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

h1:focus {
  outline: none;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 5px;
  border: 1px solid var(--mud-palette-lines-inputs);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.7rem;
  text-align: center;
  color: var(--mud-palette-text-primary);
  background: var(--mud-palette-background-gray);
}

/* ---------- App bar ---------- */

.app-bar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-logo {
  width: 34px;
  height: 34px;
  margin: 0 10px 0 4px;
}

.brand-text {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

.brand-accent {
  color: #26c4af;
}

.brand-tagline {
  margin-left: 16px !important;
  opacity: 0.6;
}

.file-count {
  margin-right: 8px !important;
  color: inherit !important;
}

/* ---------- Side panel ---------- */

.side-panel {
  border-right: 1px solid var(--mud-palette-lines-default);
}

.side-panel .mud-drawer-content {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--mud-palette-lines-default);
}

.panel-footer {
  margin-top: auto;
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 12px;
  border: 2px dashed var(--mud-palette-lines-inputs);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.upload-box:hover,
.upload-box:focus-visible,
.upload-box.drag-over {
  border-color: var(--mud-palette-primary);
  background: rgba(38, 196, 175, 0.07);
  outline: none;
}

.upload-box.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.upload-hint {
  line-height: 1.5 !important;
}

.empty-list {
  padding: 4px 0;
}

.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 8px;
  margin: 0 -6px 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.12s;
}

.model-row:hover {
  background: var(--mud-palette-action-default-hover);
}

.model-row.selected {
  border-color: var(--mud-palette-primary);
  background: rgba(38, 196, 175, 0.09);
}

.model-row.is-hidden .model-info {
  opacity: 0.45;
}

.model-info {
  flex: 1;
  min-width: 0;
}

.model-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.swatch {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.swatch::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.swatch::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 8px;
  margin: 4px 0 12px;
  font-size: 0.75rem;
  color: var(--mud-palette-text-secondary);
}

.privacy-note {
  display: flex !important;
  align-items: flex-start;
  gap: 6px;
}

/* ---------- Model editor ---------- */

.editor-group {
  margin-bottom: 10px;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: -4px;
}

.xyz {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.xyz .mud-input-control {
  margin-top: 4px !important;
}

.axis-x .mud-input-label { color: #ef5350 !important; }
.axis-y .mud-input-label { color: #66bb6a !important; }
.axis-z .mud-input-label { color: #5c9ded !important; }

.axis-x-text { color: #ef5350 !important; font-weight: 700 !important; }
.axis-y-text { color: #66bb6a !important; font-weight: 700 !important; }
.axis-z-text { color: #5c9ded !important; font-weight: 700 !important; }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-actions .mud-button-group-root {
  display: flex;
  width: 100%;
}

.quick-actions .mud-button-group-root .mud-button-root {
  flex: 1;
  min-width: 0;
}

.size-readout {
  display: block;
  margin-top: 4px;
}

/* ---------- Viewport ---------- */

.main-content {
  height: 100dvh;
  overflow: hidden;
}

.viewport-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.viewport {
  position: absolute;
  inset: 0;
}

.viewport canvas {
  display: block;
  outline: none;
  touch-action: none;
}

.viewport-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 10px !important;
}

.viewport-stats {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  pointer-events: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}

.empty-state img {
  width: min(520px, 80%);
  height: auto;
  margin-bottom: 8px;
  opacity: 0.92;
  user-select: none;
}

.empty-state .mud-typography-body2 {
  max-width: 460px;
}

.empty-title {
  font-weight: 700 !important;
  margin-bottom: 6px !important;
}

.empty-action {
  pointer-events: auto;
}

.drop-overlay {
  position: absolute;
  inset: 12px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 3px dashed var(--mud-palette-primary);
  border-radius: 16px;
  background: rgba(38, 196, 175, 0.12);
  color: var(--mud-palette-primary);
  pointer-events: none;
}

.viewport-wrap.drag-over .drop-overlay {
  display: flex;
}

/* ---------- Export dialog ---------- */

.format-option {
  display: flex;
  flex-direction: column;
  padding: 2px 0;
}

.format-ext {
  opacity: 0.55;
  font-size: 0.8em;
  margin-left: 4px;
}

/* ---------- Blazor defaults ---------- */

.blazor-error-boundary {
  background: #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "An error has occurred.";
}
