/*!
 * Lína — css/sections/history.css
 * Copyright © 2025–2026 Hyperfokal LLC. All rights reserved.
 * Proprietary and confidential. Unauthorized copying, modification,
 * distribution, or use of this file, via any medium, is prohibited.
 * Not licensed for use in training machine-learning or AI models.
 */
/* ===============================
   SCREENPLAY HISTORY PANEL
   Shares the outline panel shell (.outline-panel / -header / -content).
   =============================== */

.history-toolbar {
  padding: 8px 10px 4px;
  flex-shrink: 0;
}
.history-toolbar:empty { display: none; }

.history-toolbar .btn,
.history-name-form .btn {
  font-size: 11px;
  padding: 4px 10px;
}

.history-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.history-day {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 12px 6px 4px;
}

.history-entry {
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 7px 8px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.history-entry:hover,
.history-entry:focus-visible {
  background: var(--bg-elevated);
  border-color: var(--border);
  outline: none;
}
.history-entry.history-checkpoint {
  border-left: 3px solid var(--accent);
}

.history-entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.history-entry-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}
.history-entry-label {
  font-size: 12px;
  color: var(--accent);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-entry-name {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 2px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.history-entry:hover .history-entry-name,
.history-entry:focus-within .history-entry-name { opacity: 1; }
.history-entry-name:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.history-entry-name svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-entry-meta {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-secondary);
}
.history-entry-who { flex-shrink: 0; }
.history-entry-stats { margin-left: auto; white-space: nowrap; }

.history-add { color: #4fc27f; }
.history-del { color: #e8766a; }
.history-mod { color: var(--accent); }

.history-name-form {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}
.history-name-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  padding: 5px 7px;
}
.history-name-form input:focus { outline: none; border-color: var(--accent-muted); }

/* ===============================
   COMPARE VIEW
   =============================== */

.history-cmp-modal {
  width: min(980px, 94vw);
  height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  overflow: hidden;
}
.history-cmp-modal.history-busy { opacity: 0.6; pointer-events: none; }

.history-cmp-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-cmp-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.history-cmp-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-cmp-when { font-size: 12px; color: var(--text-secondary); }

.history-cmp-modes {
  display: flex;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}
.history-cmp-mode {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.history-cmp-mode.active { background: var(--bg-elevated); color: var(--text-primary); }

.history-cmp-summary {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-cmp-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 20px;
}

.history-cmp-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.history-cmp-hint {
  flex: 1;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Scenes */
.hd-unchanged {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  padding: 6px;
  margin: 6px 0;
  border: 1px dashed var(--border);
  border-radius: 5px;
}

.hd-scene {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 10px 0;
  overflow: hidden;
  background: var(--bg-main);
}
.hd-scene-added   { border-left: 3px solid #4fc27f; }
.hd-scene-removed { border-left: 3px solid #e8766a; }
.hd-scene-changed { border-left: 3px solid var(--accent); }

.hd-scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
}
.hd-scene-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  min-width: 22px;
  text-align: center;
}
.hd-scene-heading {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hd-scene-badge { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.hd-scene-restore { font-size: 11px; padding: 3px 9px; }

/* Script lines, laid out like the page */
.hd-lines {
  padding: 10px 14px 12px;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
}
.hd-row { padding: 1px 6px; border-radius: 3px; white-space: pre-wrap; }
.hd-row + .hd-slug,
.hd-row + .hd-action,
.hd-row + .hd-character,
.hd-row + .hd-transition { margin-top: 8px; }

.hd-slug { font-weight: 700; text-transform: uppercase; }
.hd-character { padding-left: 38%; text-transform: uppercase; }
.hd-paren { padding-left: 31%; padding-right: 30%; }
.hd-dialogue { padding-left: 21%; padding-right: 22%; }
.hd-transition { text-align: right; text-transform: uppercase; }
.hd-centered { text-align: center; }
.hd-section { color: var(--text-secondary); font-style: italic; }

.hd-same { opacity: 0.6; }
.hd-add { background: rgba(79, 194, 127, 0.14); box-shadow: inset 2px 0 0 #4fc27f; }
.hd-del { background: rgba(232, 118, 106, 0.12); box-shadow: inset 2px 0 0 #e8766a; }
.hd-del .hd-text { text-decoration: line-through; text-decoration-color: rgba(232, 118, 106, 0.7); }
.hd-mod { box-shadow: inset 2px 0 0 var(--accent); }
.hd-mod ins { background: rgba(79, 194, 127, 0.22); text-decoration: none; border-radius: 2px; }
.hd-mod del { background: rgba(232, 118, 106, 0.2); text-decoration: line-through; text-decoration-color: rgba(232, 118, 106, 0.8); border-radius: 2px; }

.hd-skip {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 6px;
  margin: 2px 0;
}
.hd-skip::before { content: "⋯ "; }

@media (max-width: 700px) {
  .history-cmp-header { flex-wrap: wrap; }
  .history-cmp-modes { order: 3; width: 100%; }
  .history-cmp-mode { flex: 1; }
  .hd-character { padding-left: 25%; }
  .hd-dialogue, .hd-paren { padding-left: 10%; padding-right: 8%; }
}

/* A draft's starting point (upload, or the text from before history began) */
.history-origin .history-entry-label { color: var(--text-secondary); }

/* Boneyard: scenes removed when a file was brought in */
.history-boneyard-title { color: var(--accent); }
.history-bone {
  border: 1px dashed var(--border);
  border-radius: 5px;
  padding: 7px 8px;
  margin-bottom: 4px;
}
.history-bone-num { font-size: 11px; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.history-bone-heading {
  flex: 1; min-width: 0; font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-bone-put { font-size: 11px; padding: 3px 9px; flex-shrink: 0; }
