.editor-page {
  display: flex;
  flex-direction: column;

  padding-bottom: 100px;
}

/* Loading */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 32px;
  color: #1abc9c;
}

.loading-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Header */
.editor-header {
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 0;
}

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

.back-btn {
  width: 40px;
  height: 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.mode-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* Content */
.editor-content {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Section card */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

/* Fields */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mc-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Topics list */
.topic-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.topic-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
}

.topic-position {
  width: 26px;
  height: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.topic-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-item-resources {
  font-size: 11px;
  color: var(--text-muted);
}

.topic-item-actions {
  display: flex;
  gap: 4px;
}

.icon-action {
  width: 30px;
  height: 30px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
}

.icon-action.danger {
  color: #ff4d4f;
}

/* Resource chips */
.topic-resources {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--border);
}

.resource-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
}

.chip-title {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  padding: 0;
  display: flex;
  align-items: center;
  margin-left: 2px;
}

/* Danger zone */
.danger-zone {
  gap: 10px;
}

.publish-btn {
  width: 100%;
  background-color: #1abc9c;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.publish-btn:hover:not(:disabled) {
  opacity: 0.85;
}

.publish-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-badge.published {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #1abc9c;
  background: rgba(26, 188, 156, 0.1);
  border: 1px solid rgba(26, 188, 156, 0.3);
  border-radius: 10px;
  padding: 10px;
}

.delete-btn {
  width: 100%;
  background: none;
  border: 1px solid #ff4d4f;
  color: #ff4d4f;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}

.delete-btn:hover {
  background: rgba(255, 77, 79, 0.08);
}

/* Resource type pills */
.type-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.type-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.type-pill.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

/* Resource picker */
.resources-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.picker-item.linked {
  border-color: #1abc9c;
  background: rgba(26, 188, 156, 0.05);
  cursor: default;
}

.resource-icon-sm {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.picker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-type {
  font-size: 11px;
  color: var(--text-muted);
}

.linked-icon {
  font-size: 18px;
  color: #1abc9c;
}

.empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}
