* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Georgia, 'Noto Serif', serif;
  font-size: 15px;
  background: #f5f5f0;
  color: #222;
}

#header {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 12px 20px;
  font-size: 1.2em;
  font-weight: bold;
  letter-spacing: 0.03em;
}

#controls {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.07);
}

#controls label { font-size: 0.85em; color: #555; }

#pattern {
  width: 260px;
  font-family: monospace;
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
}
#pattern:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 2px rgba(52,152,219,0.2); }

select, input[type="number"] {
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}
select:focus, input[type="number"]:focus { outline: none; border-color: #3498db; }

#max-results { width: 80px; }

#search-btn {
  padding: 6px 20px;
  background: #2980b9;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
#search-btn:hover { background: #3498db; }
#search-btn:active { background: #1a6fa0; }
#search-btn:disabled { background: #aaa; cursor: not-allowed; }

#main {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 110px);
}

#sidebar {
  width: 200px;
  min-width: 160px;
  background: #fff;
  border-right: 1px solid #ddd;
  padding: 12px;
  flex-shrink: 0;
}

#sidebar h3 {
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin-bottom: 8px;
}

#text-filter-input {
  width: 100%;
  padding: 5px 7px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 3px;
  margin-bottom: 6px;
}
#text-filter-input:focus { outline: none; border-color: #3498db; }

#text-filter-buttons {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.filter-btn {
  flex: 1;
  padding: 3px 4px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f8f8f8;
  cursor: pointer;
}
.filter-btn:hover { background: #eee; }

#text-checkboxes {
  max-height: calc(100vh - 230px);
  overflow-y: auto;
  font-size: 13px;
}
#text-checkboxes label {
  display: block;
  padding: 2px 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#text-checkboxes label:hover { color: #2980b9; }
#text-checkboxes input[type="checkbox"] {
  margin-right: 5px;
  cursor: pointer;
}

#content {
  flex: 1;
  padding: 16px 20px;
  min-width: 0;
}

#status {
  font-size: 13px;
  color: #555;
  margin-bottom: 12px;
  min-height: 20px;
}
#status.error { color: #c0392b; font-weight: bold; }
#status.searching { color: #2980b9; }

#results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
#results-table th {
  text-align: left;
  padding: 6px 10px;
  background: #eee;
  border-bottom: 2px solid #ccc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  white-space: nowrap;
}
#results-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  line-height: 1.7;
}
#results-table tr:nth-child(even) td { background: #fafaf8; }
#results-table tr:hover td { background: #f0f4ff; }

.col-text { color: #0066cc; font-weight: bold; font-size: 13px; white-space: nowrap; }
.col-sid  { color: #888; font-size: 12px; white-space: nowrap; font-family: monospace; }
.col-sent { word-break: break-word; }

span.match {
  background: #ffd700;
  font-weight: bold;
  border-radius: 2px;
  padding: 0 1px;
}

#show-more {
  display: block;
  margin: 16px auto 0;
  padding: 8px 28px;
  background: #ecf0f1;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
#show-more:hover { background: #dde1e4; }

#back-to-top {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 8px 14px;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.8;
}
#back-to-top:hover { opacity: 1; }

#toggle-scheme-btn {
  margin-left: 8px;
  padding: 2px 7px;
  font-size: 11px;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: normal;
  color: #333;
  vertical-align: middle;
}
#toggle-scheme-btn:hover { background: #eee; }
#toggle-scheme-btn.active { background: #2980b9; color: #fff; border-color: #2980b9; }
