/* SoT (Source of Truth) Management Styles */

/* ---- Manager Panel ---- */
.sot-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 5px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.sot-toolbar select,
.sot-toolbar input,
.sot-toolbar button {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
}

.sot-toolbar button {
  cursor: pointer;
  border: 1px solid #ccc;
  background: #fff;
}

.sot-toolbar button:hover {
  background: #e9ecef;
}

.sot-toolbar button.sot-btn-primary {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

.sot-toolbar button.sot-btn-primary:hover {
  background: #0b5ed7;
}

.sot-toolbar .sot-search-input {
  flex: 1;
  min-width: 150px;
}

/* ---- Grid / Table ---- */
.sot-table-container {
  overflow-x: auto;
  margin-bottom: 12px;
}

.sot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sot-table th,
.sot-table td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.sot-table th {
  background: #f2f2f2;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sot-table th:hover {
  background: #e8e8e8;
}

.sot-table th .sort-arrow {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
}

.sot-table th .sort-arrow.active {
  opacity: 1;
}

.sot-table tr:nth-child(even) {
  background: #f9f9f9;
}

.sot-table tr:hover {
  background: #eef2ff;
  cursor: pointer;
}

.sot-table .sot-title-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status badges */
.sot-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}

.sot-badge-draft    { background: #fef3cd; color: #856404; }
.sot-badge-active   { background: #d4edda; color: #155724; }
.sot-badge-archived { background: #e2e3e5; color: #383d41; }

.sot-badge-manual            { background: #cce5ff; color: #004085; }
.sot-badge-autodgis_curated  { background: #d4edda; color: #155724; }
.sot-badge-autodgis_edited   { background: #d1ecf1; color: #0c5460; }
.sot-badge-thumbdown_corrected { background: #f8d7da; color: #721c24; }
.sot-badge-paste_import      { background: #e2e3e5; color: #383d41; }

/* Pagination */
.sot-pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.sot-pagination button {
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.sot-pagination button:hover {
  background: #e9ecef;
}

.sot-pagination button.active {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

.sot-pagination .sot-page-info {
  font-size: 12px;
  color: #666;
  margin: 0 8px;
}

/* ---- Editor Modal ---- */
.sot-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
}

.sot-editor-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}

.sot-editor-meta input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.sot-editor-meta select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}

.sot-editor-meta .sot-meta-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

/* Editor area (textarea + preview) */
.sot-editor-area {
  flex: 1;
  display: flex;
  gap: 0;
  min-height: 300px;
  overflow: hidden;
}

.sot-editor-area.split .sot-textarea-wrap,
.sot-editor-area.split .sot-preview-wrap {
  width: 50%;
}

.sot-textarea-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.sot-textarea-wrap textarea {
  flex: 1;
  width: 100%;
  resize: none;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 4;
}

.sot-textarea-wrap textarea:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.sot-preview-wrap {
  display: none;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 4px 4px 0;
  background: #fafafa;
}

.sot-editor-area.split .sot-preview-wrap {
  display: block;
}

.sot-preview-wrap h1,
.sot-preview-wrap h2,
.sot-preview-wrap h3 {
  margin-top: 0.8em;
}

/* Editor footer */
.sot-editor-footer {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #e0e0e0;
}

.sot-editor-footer .sot-footer-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sot-editor-footer .sot-footer-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sot-editor-footer button {
  padding: 6px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.sot-editor-footer button.sot-btn-save {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

.sot-editor-footer button.sot-btn-save:hover {
  background: #0b5ed7;
}

.sot-editor-footer button:hover {
  background: #e9ecef;
}

/* Version history dropdown */
.sot-version-dropdown {
  position: relative;
  display: inline-block;
}

.sot-version-list {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  max-height: 200px;
  overflow-y: auto;
  min-width: 250px;
  z-index: 100;
}

.sot-version-item {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 12px;
}

.sot-version-item:hover {
  background: #eef2ff;
}

.sot-version-item:last-child {
  border-bottom: none;
}

/* Unsaved indicator */
.sot-unsaved-indicator {
  font-size: 12px;
  color: #dc3545;
  font-weight: 500;
}

/* Empty state */
.sot-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-size: 14px;
}
