/* ===== Page base (black theme) ===== */
body {
  background-color: #000;
  color: #ddd;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
}

main {
  max-width: 98%;
  margin: 20px auto;
  padding: 10px;
}

main h2 {
  font-size: 1.6rem;
  margin-bottom: 15px;
  color: #f0f0f0;
}

/* ===== Toolbar layout ===== */
.toolbar {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
  margin-bottom: 12px;
  padding: 0 16px 0 4px;
}

.tools-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.tools-group .edit-note {
  margin: 0 0 0 6px;
  color: #bbb;
  font-size: 12px;
}

/* ===== Buttons & Inputs ===== */
#searchInput {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #111;
  color: #ddd;
}

#searchBtn, #resetSearchBtn,
#downloadBtn, #undoBtn, #resetBtn {
  margin: 6px 4px 14px 0;
  padding: 6px 12px;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  background: #4c6ef5;
  color: white;
  cursor: pointer;
}

#searchBtn:hover, #resetSearchBtn:hover,
#downloadBtn:hover, #undoBtn:hover, #resetBtn:hover {
  background: #364fc7;
}

/* ===== Explanation card ===== */
.explain-card {
  background: linear-gradient(180deg, #1b1b1b, #161616);
  border: 1px solid #2e2e2e;
  border-left: 3px solid #4c6ef5;
  color: #cfcfcf;
  border-radius: 10px;
  padding: 12px 12px 12px 14px;
  max-height: 220px;
  overflow: auto;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45),
              inset 0 1px 0 rgba(255,255,255,0.03);
  backdrop-filter: blur(2px);
  position: sticky;
  top: 76px;
  margin-right: 8px;
}

.explain-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px 0;
}

.explain-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4c6ef5;
  box-shadow: 0 0 8px rgba(76,110,245,0.6);
}

.explain-card strong {
  color: #f0f0f0;
  letter-spacing: 0.2px;
}

.explain-card ul {
  margin: 0;
  padding-left: 18px;
}

.explain-card li {
  margin: 4px 0;
  line-height: 1.35;
}

/* ===== Table ===== */
#tableContainer {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  border: 1px solid #333;
  border-radius: 4px;
  background: #111;
}

table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
  background: #111;
  color: #eee;
}

thead th {
  background: #222;
  color: white;
  padding: 6px 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

td, th {
  border: 1px solid #444;
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #1a1a1a;
}
tbody tr:nth-child(odd) {
  background: #111;
}

td[contenteditable="true"] {
  background: #2b2b1f;
  cursor: text;
  color: #fff;
}

td img {
  max-width: 70px;
  max-height: 70px;
  display: block;
  margin: auto;
  border-radius: 4px;
}

td button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #ccc;
  transition: color 0.2s, transform 0.2s;
}

td button:hover {
  color: red;
  transform: scale(1.1);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-right: 8px;
  }

  .explain-card {
    max-height: 180px;
    position: relative;
    top: auto;
    margin-right: 0;
  }
}
