/* Layout for the Movement Engineer interface */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
}

body {
  display: flex;
  flex-direction: column;
}

/* Top bar */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: #111827;
  color: #f9fafb;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.1rem;
}

.top-bar-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.schema-version {
  font-size: 0.8rem;
  opacity: 0.7;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

button {
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
}

button:hover {
  background: #d1d5db;
}

button.danger {
  background: #fee2e2;
  color: #b91c1c;
}

button.danger:hover {
  background: #fecaca;
}

.status {
  font-size: 0.8rem;
  min-width: 120px;
  text-align: right;
  opacity: 0.8;
}

/* Main layout */

.layout {
  flex: 1;
  display: flex;
  min-height: 0; /* allow flex children to scroll */
}

/* Sidebar */

.sidebar {
  width: 230px;
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0.75rem 0.75rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 0.95rem;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

.item-list li {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-list li span.secondary {
  font-size: 0.75rem;
  opacity: 0.6;
}

.item-list li:hover {
  background: #e5e7eb;
}

.item-list li.selected {
  background: #111827;
  color: #f9fafb;
}

/* Content */

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Tabs */

.tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.tab {
  padding: 0.5rem 0.9rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
}

.tab.active {
  border-bottom-color: #111827;
  font-weight: 600;
  background: #e5e7eb;
}

.tab-panel {
  display: none;
  flex: 1;
  overflow: auto;
}

.tab-panel.active {
  display: block;
}

.panel-body {
  padding: 0.9rem 1.1rem 1.2rem;
}

/* Forms */

.form-row {
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  max-width: 600px;
}

.form-row label {
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  color: #4b5563;
}

.form-row input,
.form-row textarea,
.form-row select {
  font-size: 0.88rem;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #fff;
}

.form-row textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.code-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.8rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #e5e7eb;
}

/* Generic hints */

.hint {
  font-size: 0.8rem;
  margin-top: 0;
  margin-bottom: 0.9rem;
  color: #6b7280;
}

/* Split view in collections tab */

.split {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  min-height: 300px;
}

.list-pane {
  flex: 0 0 35%;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #f9fafb;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.detail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#item-editor {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.82rem;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  background: #fff;
}

.editor-actions {
  margin-top: 0.4rem;
  display: flex;
  justify-content: flex-end;
}

/* Collection toolbar */

.collection-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.collection-toolbar label {
  font-size: 0.8rem;
}

.collection-toolbar select,
.collection-toolbar input[type="checkbox"] {
  margin-left: 0.25rem;
}

.collection-toolbar .inline {
  display: flex;
  align-items: center;
}

.collection-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

/* Dashboard stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.stat-card {
  background: #f9fafb;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  padding: 0.6rem 0.7rem;
  font-size: 0.83rem;
}

.stat-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
}

.stat-card ul {
  padding-left: 1.1rem;
  margin: 0.1rem 0 0;
}

.section-heading {
  margin-top: 1.1rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.chip {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #e5e7eb;
}

/* Comparison */

.comparison-selector {
  margin-bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

.comparison-selector label {
  cursor: pointer;
}

.comparison-table-wrapper {
  overflow-x: auto;
}

.comparison-table-wrapper table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8rem;
}

.comparison-table-wrapper th,
.comparison-table-wrapper td {
  border: 1px solid #e5e7eb;
  padding: 0.35rem 0.45rem;
}

.comparison-table-wrapper th {
  background: #f3f4f6;
  text-align: left;
}
