/* ==========================================================================
   styles/tabs.css
   The document tab strip, and the footnote drawer at the foot of the window.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */

.tabstrip {
  display: flex; align-items: stretch; gap: 2px;
  padding: 0 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden;
}
.tabstrip::-webkit-scrollbar { height: 0; }

.tab {
  display: flex; align-items: center; gap: 5px;
  padding: 0 6px 0 10px;
  max-width: 230px; min-width: 118px; flex-shrink: 0;
  border: 1px solid transparent; border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  transition: background var(--fast), border-color var(--fast);
}
.tab:hover { background: var(--panel-2); }
.tab.is-active {
  background: var(--panel);
  border-color: var(--line);
}

.tab__name {
  flex: 1; min-width: 0;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--fg-dim);
  direction: ltr; unicode-bidi: isolate; text-align: start;
  padding: 8px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab.is-active .tab__name { color: var(--fg); }

.tab__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.tab__close {
  width: 19px; height: 19px; flex-shrink: 0;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 4px; cursor: pointer;
  color: var(--fg-faint); opacity: 0;
  transition: opacity var(--fast), background var(--fast);
}
.tab:hover .tab__close, .tab.is-active .tab__close { opacity: 1; }
.tab__close:hover { background: var(--line); color: var(--fg); }
.tab__close svg { width: 12px; height: 12px; }

.tab-add {
  width: 30px; flex-shrink: 0; align-self: center;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--fg-faint); height: 26px;
}
.tab-add:hover { background: var(--panel-2); color: var(--fg); }
.tab-add svg { width: 15px; height: 15px; }

/* --------------------------------------------------------------------------
   Footnote drawer
   Along the foot of the window, the way notes sit at the foot of a page. A
   side column would squeeze a long note into a four-word ribbon.
   -------------------------------------------------------------------------- */

.footnotes-drawer {
  position: absolute; inset-inline: 0; inset-block-end: var(--status-h);
  z-index: 60;
  max-height: min(48vh, 500px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.fn-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem; font-weight: 600;
}
.fn-head .spacer { margin-inline-start: auto; }
.fn-head #footnote-summary { font-weight: 400; font-size: 0.76rem; }

.fn-list { overflow-y: auto; padding: 6px 12px 12px; }

.fn-row {
  display: grid;
  grid-template-columns: 42px 1fr 70px 30px;
  gap: 10px; align-items: start;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.fn-row:last-child { border-bottom: 0; }
.fn-row--broken { background: var(--accent-wash); border-radius: var(--radius-sm); }

.fn-num {
  height: 30px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; font-size: 0.82rem; font-weight: 700; color: var(--accent-strong);
}
.fn-num:hover:not(:disabled) { border-color: var(--accent); }
.fn-num:disabled { opacity: 0.45; cursor: default; color: var(--fg-faint); }

.fn-text {
  font-family: inherit; font-size: 0.84rem; line-height: 1.9; color: var(--fg);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 9px;
  resize: none; overflow: hidden; min-height: 30px;
}
.fn-text:focus { outline: none; border-color: var(--accent); }

.fn-where {
  font-size: 0.7rem; color: var(--fg-faint);
  font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate;
  padding-top: 8px;
}

.fn-remove {
  width: 28px; height: 30px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--fg-faint);
}
.fn-remove:hover { background: var(--line); color: var(--err); }
.fn-remove svg { width: 15px; height: 15px; }

.fn-warn {
  font-size: 0.79rem; line-height: 1.85; color: var(--warn);
  padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--warn); border-radius: var(--radius-sm);
}
.fn-empty { font-size: 0.82rem; color: var(--fg-dim); padding: 18px 6px; text-align: center; }
