* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Roboto Condensed', sans-serif;
}
.app { height: 100%; }

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Navbar */
.navbar {
  background-color: #224;
  color: #fff;
  padding: 12px 16px;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 1px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-info {
  font-size: 14px;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0;
}

.transport {
  display: flex;
  align-items: center;
  gap: 4px;
}

.transport-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #fff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.transport-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.transport-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.transport-btn.speed-active {
  background: rgba(74, 158, 255, 0.4);
  border-color: rgba(74, 158, 255, 0.6);
}

/* Main content */
.main-content {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* Sidebar overlay */
.sidebar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  pointer-events: none;
  z-index: 1;
}

.sidebar-overlay > * {
  pointer-events: auto;
}

/* Sidebar icons */
.sidebar-icons {
  background-color: #88a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-button {
  background: transparent;
  border: none;
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sidebar-button.active {
  background: #aac;
}

/* Sidebar panel */
.sidebar-panel {
  width: 300px;
  background-color: #f5f5f5;
  border-right: 1px solid #ddd;
  flex-shrink: 0;
  overflow-y: auto;
  height: 100%;
}

.panel-content {
  padding: 12px;
}

.panel-header {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #666;
}

/* Files panel */
.files-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.files-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 8px;
}

.files-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.files-table th {
  text-align: left;
  color: #888;
  font-weight: normal;
  padding: 4px 8px;
  box-shadow: inset 0 -1px 0 #ddd;
  position: sticky;
  top: 0;
  background-color: #f5f5f5;
}

.th-tag, .td-tag {
  width: 16px;
  padding: 4px 2px !important;
  text-align: center;
}

.files-row {
  cursor: pointer;
}

.files-row td {
  padding: 4px 8px;
}

.files-row:hover {
  background-color: #e0e0e0;
}

.th-del, .td-del {
  width: 20px;
  padding: 0 !important;
  text-align: center;
}

.files-delete-btn {
  background: none;
  border: none;
  color: #c44;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.1s;
}

.files-row:hover .files-delete-btn {
  opacity: 1;
}

.files-delete-btn:hover {
  color: #f00;
}

.files-row.deleted td {
  color: #aaa;
  text-decoration: line-through;
}

.files-undelete-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.1s;
}

.files-row:hover .files-undelete-btn {
  opacity: 1;
}

.files-undelete-btn:hover {
  color: #4a9eff;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.panel-header-row .panel-header {
  margin-bottom: 0;
}

.show-deleted-toggle {
  font-size: 11px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.files-row.active {
  background-color: #4a9eff;
  color: #fff;
}

/* Recording panel */
.midi-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.midi-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aaa;
  flex-shrink: 0;
}

.midi-status-connected .midi-status-dot { background: #4caf50; }
.midi-status-connected { color: #4caf50; }
.midi-status-disconnected .midi-status-dot { background: #f44336; }
.midi-status-disconnected { color: #c44; }

.midi-refresh-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  margin-left: auto;
  color: inherit;
}

.midi-refresh-btn:hover {
  background: #e0e0e0;
}

.event-count {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 16px;
}

.event-count-label {
  font-size: 14px;
  font-weight: normal;
  color: #888;
}

.button-row {
  display: flex;
  gap: 8px;
}

.btn {
  padding: 8px 16px;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn:disabled {
  background-color: #ccc;
  cursor: default;
}

.btn-save {
  background-color: #4caf50;
}

.btn-discard {
  background-color: #f44336;
}

/* Settings panel */
.settings-label {
  margin-bottom: 8px;
  font-size: 12px;
  color: #888;
}

.settings-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-button {
  padding: 8px 12px;
  background-color: #e0e0e0;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

.settings-button.active {
  background-color: #4a9eff;
  color: #fff;
}

.settings-button:disabled {
  cursor: default;
  opacity: 0.5;
}

/* Tags panel */
.tag-hint {
  font-size: 11px;
  color: #999;
  margin-bottom: 12px;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag-item {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  gap: 8px;
}

.tag-label {
  font-weight: bold;
  font-size: 13px;
  flex-shrink: 0;
}

.tag-range {
  font-size: 11px;
  color: #888;
  flex: 1;
  min-width: 0;
}

.tag-clickable {
  cursor: pointer;
}

.tag-clickable:hover {
  color: #4a9eff;
}

.tag-remove {
  background: none;
  border: none;
  color: #c44;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  flex-shrink: 0;
}

.tag-remove:hover {
  color: #f00;
}

/* Tag inline edit */
.tag-edit-input {
  box-sizing: border-box;
  padding: 2px 6px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid #4a9eff;
  border-radius: 5px;
  background: white;
  outline: none;
  z-index: 2;
}

/* Loading progress */
.loading {
  margin-top: 40vh;
  text-align: center;
  padding: 0 20%;
}

.loading-progress {
  height: 8px;
  background: #ddd;
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto 12px;
}

.loading-progress-fill {
  height: 100%;
  width: 0;
  background: #4a9eff;
  border-radius: 4px;
  transition: width 0.1s;
}

.loading-text {
  color: #888;
  font-size: 14px;
}

/* Piano roll */
.piano-roll-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}
