.widget-demo {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.demo-header {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.demo-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.demo-header p {
  color: #666;
  font-size: 0.875rem;
}

.demo-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  min-height: 400px; /* 降低最小高度 */
}

.editor-panel,
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.panel-header h3 {
  font-size: 1rem;
  color: #333;
  margin: 0;
}

.widget-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.widget-container {
  flex: 1;
  padding: 1.5rem;
  background: #fafafa;
  overflow: auto;
  min-height: 200px;
}

/* 确保 adp-widget 正确显示 */
.widget-container adp-widget {
  display: block;
  width: 100%;
  min-height: 100px;
  max-height: 400px;
  overflow: auto;
}

.event-logs {
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  max-height: 300px;
}

.clear-btn {
  padding: 0.25rem 0.75rem;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: #f5f5f5;
  border-color: #0052d9;
  color: #0052d9;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.locale-select {
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  outline: none;
  height: 41px;
  box-sizing: border-box;
}

.locale-select:hover {
  border-color: #0052d9;
}

.locale-select:focus {
  border-color: #0052d9;
  box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.1);
}

.disable-btn {
  padding: 0.5rem 1rem;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  font-weight: 500;
}

.disable-btn:hover {
  background: #f5f5f5;
  border-color: #0052d9;
}

.disable-btn.active {
  background: #0052d9;
  color: white;
  border-color: #0052d9;
}

.disable-btn.active:hover {
  background: #0046b8;
  border-color: #0046b8;
}

.logs-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fafafa;
}

.empty-logs {
  text-align: center;
  color: #999;
  padding: 2rem;
  font-size: 0.875rem;
}

.log-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.log-item:last-child {
  margin-bottom: 0;
}

.log-time {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.log-content pre {
  margin: 0;
  font-size: 0.875rem;
  color: #333;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 1024px) {
  .demo-content {
    grid-template-columns: 1fr;
  }

  .event-logs {
    max-height: 200px;
  }
}
