/* 样式：日志分析工具 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
  color: #333;
  background-color: #f5f5f5;
  margin: 0;
  padding: 8px;
  min-height: 100vh;
  box-sizing: border-box;
  font-size: 13px;
}

.container {
  max-width: 100%;
  margin: 0;
  background: white;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
}

h1 {
  text-align: center;
  color: #333;
}

.input-section {
  margin-bottom: 20px;
}

.file-upload {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  font-size: 12px;
}

.file-upload-label {
  display: inline-block;
  padding: 8px 16px;
  background: #f0f0f0;
  border: 2px dashed #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.file-upload-label:hover {
  background: #e0e0e0;
  border-color: #999;
}

.file-upload input[type="file"] {
  display: none;
}

#fileName {
  margin-left: 15px;
  color: #666;
  font-size: 12px;
  color: #666;
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: inline-block;
  vertical-align: middle;
}

.divider {
  text-align: center;
  margin: 10px 0;
  color: #999;
  position: relative;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: #ddd;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.textarea-container {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 15px;
}

.textarea-header {
  background: #2c3e50;
  color: white;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.toggle-btn:hover {
  background-color: #e9e9e9;
}

.toggle-btn.collapsed svg {
  transform: rotate(-90deg);
}

.toggle-textarea {
  position: absolute;
  right: 6px;
  top: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 1px 4px;
  font-size: 11px;
  cursor: pointer;
  z-index: 10;
  line-height: 1.2;
}

textarea#logInput {
  width: 100%;
  flex: 1;
  padding: 6px 8px;
  border: none;
  resize: none;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.3;
  font-size: 12px;
  box-sizing: border-box;
  tab-size: 2;
}

.controls {
  margin: 10px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

.search-container {
  background: #f8f9fa;
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-row {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.search-section {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-label {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  min-width: 80px;
}

.tag-input-container {
  flex: 1;
  position: relative;
}

.tag-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-size: 12px;
  height: 24px;
  box-sizing: border-box;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 8px 0;
  min-height: 24px;
  padding: 2px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  background: #e9ecef;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  color: #495057;
  cursor: default;
  transition: all 0.2s;
  line-height: 1.3;
}

.tag.include {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.tag.include .remove-tag:hover {
  color: #1b5e20;
}

.tag.exclude {
  background: #fff1f0;
  border: 1px solid #ffa39e;
  color: #f5222d;
}

.tag .remove-tag {
  margin-left: 6px;
  cursor: pointer;
  font-size: 12px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.tag .remove-tag:hover {
  opacity: 1;
}

.search-stats {
  font-size: 12px;
  color: #666;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #eee;
  line-height: 1.2;
}

button {
  background: #007bff;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #0056d2;
}
 

#logContainer {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.3;
  background: white;
}

.log-line {
  display: flex;
  line-height: 1.3;
  padding: 1px 0;
  border-bottom: 1px solid #f5f5f5;
  transition: all 0.1s ease;
  font-size: 12px;
}

.log-line.hidden-line {
  display: none;
}

/* 上下文行样式 */
.log-line.context-line {
  opacity: 0.7;
  background-color: #fafafa;
}

.log-line.context-line:hover {
  opacity: 1;
  background-color: #f0f7ff;
}

/* 上下文分隔符 */
.context-separator {
  text-align: center;
  color: #999;
  font-size: 12px;
  padding: 2px 0;
  background: #f5f5f5;
  border-bottom: 1px dashed #e0e0e0;
  cursor: default;
  user-select: none;
}

.log-line.highlight {
  background-color: #fff9c4;
  box-shadow: 0 0 0 1px #ffd600;
  position: relative;
  z-index: 1;
}

.log-line.highlight::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: #ff9800;
}

.log-line:hover {
  background: #f0f7ff;
}

.line-number {
  min-width: 40px;
  padding: 0 6px;
  color: #999;
  user-select: none;
  border-right: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #fafafa;
  font-size: 11px;
}

.toggle-icon {
  margin-right: 4px;
  cursor: pointer;
  font-size: 12px;
  opacity: 0.5;
  transition: opacity 0.2s;
  width: 16px;
  text-align: center;
}

.toggle-icon:hover {
  opacity: 1;
}

.line-number-text {
  flex: 1;
  text-align: right;
}

.line-content {
  flex: 1;
  padding: 0 6px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Consolas', 'Courier New', monospace;
}

.log-line {
  animation: fadeIn 0.2s ease-out;
}

/* 根据日志级别上色 */
.log-line.info {
  color: #4caf50;
}

.log-line.warn {
  color: #ff9800;
}

.log-line.error {
  color: #e53935;
}
