/* Colors from hallucinator-tui/src/theme.rs, theme "modern" */
:root {
  --bg: #0c0c0c;
  --text: #e6e6e6;
  --dim: rgb(120, 120, 140);
  --border: rgb(60, 60, 80);
  --active: rgb(60, 140, 255); /* blue: logo, titles */
  --ok: rgb(0, 200, 80); /* verified */
  --mis: rgb(255, 200, 0); /* mismatch */
  --nf: rgb(255, 80, 80); /* not found */
  --ret: rgb(200, 50, 200); /* retracted */
  --badge: rgb(0, 200, 80); /* green tab badge */
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 14px;
}

/* Page = 3 rows stacked vertically */
body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  box-sizing: border-box;
}

/* Row 1 and row 2 each split horizontally, independently */
#top-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
#main-row {
  display: flex;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

#tips {
  flex: 1;
} /* tips take the rest of row 1 */
#queue {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#activity {
  width: 33%;
} /* activity: one third of row 2 */
#table-box {
  flex: 1;
} /* table box fills the queue column */

/* Logo */
.logo {
  margin: 0;
  line-height: 1.05;
  font-size: 22px;
  display: flex;
  gap: 4px;
}
.logo-art {
  color: var(--active);
}
.glass {
  color: var(--text);
}

/* Text colors, reused everywhere */
.strong {
  color: var(--text);
  font-weight: bold;
}
.dim {
  color: var(--dim);
}
.ok {
  color: var(--ok);
}
.mis {
  color: var(--mis);
}
.nf {
  color: var(--nf);
}
.ret {
  color: var(--ret);
}

#counts span {
  margin-right: 8px;
}

/* Bordered boxes with a title on the border (no overflow here, so titles aren't cut) */
.panel {
  position: relative;
  border: 1px solid var(--border);
  padding: 16px 10px 10px;
  box-sizing: border-box;
}
.panel-title {
  position: absolute;
  top: -9px;
  left: 10px;
  padding: 0 6px;
  background: var(--bg);
  font-weight: bold;
}
#tips .panel-title {
  color: var(--text);
}

/* Queue tab line and progress row */
#tab-line {
  margin-bottom: 4px;
}
.tab-badge {
  background: var(--badge);
  color: #000;
  padding: 0 6px;
}
#progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
#progress-bar {
  flex: 1;
  height: 14px;
  /* empty track: dim dotted stripes */
  background: repeating-linear-gradient(
    90deg,
    rgb(30, 45, 80) 0 2px,
    transparent 2px 4px
  );
}
#progress-fill {
  height: 100%;
  width: 0%;
  /* filled part: bright dotted stripes, like the TUI gauge */
  background: repeating-linear-gradient(
    90deg,
    var(--active) 0 2px,
    transparent 2px 4px
  );
}

/* Bottom bar */
#bottom-bar {
  display: flex;
  gap: 6px;
}
#bottom-bar button {
  background: #1e1e1e;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
}
#bottom-bar button:hover {
  border-color: var(--active);
}
#bottom-bar button.primary {
  background: var(--active);
  color: #000;
  font-weight: bold;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
}
.queue-table th {
  text-align: left;
  font-weight: bold;
  padding: 2px 10px 4px 0;
}
.queue-table td {
  padding: 2px 10px 2px 0;
  white-space: nowrap;
}
.queue-table td.paper {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis; /* long names end in "…" */
}
.queue-table tbody tr:hover {
  background: rgba(60, 140, 255, 0.12);
}

/* Inline progress bar in the Status column */
.row-progress {
  position: relative;
  width: 120px;
  height: 16px;
  background: rgb(30, 30, 40);
}
.row-progress-fill {
  height: 100%;
  background: var(--active);
}
.row-progress-text {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  color: #fff;
}

/* Highlight the queue while a file is dragged over it */
#queue.drag-over {
  outline: 2px dashed var(--active);
  outline-offset: 4px;
}

/* Hidden elements stay hidden, even if a rule above gives them display: flex */
[hidden] {
  display: none !important;
}

/* Paper screen: same place as the queue, shown instead of it */
#paper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#paper-tab-line {
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
}
#btn-back {
  margin-left: auto;
} /* push the back button to the right */
#paper-progress-box {
  padding: 6px;
  margin-bottom: 14px;
}
#paper-progress-bar {
  position: relative;
  height: 18px;
  background: rgb(30, 45, 80);
}
#paper-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--active);
}
#paper-progress-text {
  position: absolute;
  inset: 0;
  text-align: center;
  line-height: 18px;
  color: var(--text);
}
#refs-box {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}
#refs-area {
  flex: 1;
  overflow: auto;
} /* the table scrolls inside, so the panel title isn't cut off */
#citation-box {
  height: 5em;
}
.queue-table tbody tr {
  cursor: pointer;
}
/* Paper screen table: the title column takes all spare width, long titles end in "…" */
.refs-table td.title {
  width: 100%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.refs-table tbody tr {
  cursor: pointer;
}
.refs-table tbody tr.selected {
  background: rgba(60, 140, 255, 0.3);
} /* stronger than the hover colour, like the TUI's highlighted row */

/* Export modal */
#export-dialog {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--active);
  font-family: inherit;
  padding: 10px 16px;
}
#export-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
#export-dialog label {
  display: block;
  margin: 6px 0;
}
#export-dialog select,
#export-dialog button {
  background: #1e1e1e;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  padding: 4px 10px;
}
#export-dialog button.primary {
  background: var(--active);
  color: #000;
  font-weight: bold;
}
#export-dialog button:disabled {
  opacity: 0.5;
}
