/* Session minutes on the map (src/ui/components/protocols.js) */

.protocol-button {
  position: absolute;
  top: 66px;
  left: 10px;
  z-index: 1000;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--popup-bg, #fff);
  color: var(--text-color, #222);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  font: 600 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}
.protocol-button.active { outline: 2px solid #8b5cf6; }

.protocol-panel {
  /* names the Markdown editor (md-editor.js, shared with the CMS) uses */
  --input-bg: #fffdf8; --text-primary: #2b241b; --text-secondary: #6f6352; --border-color: #d9ccb2;
  --accent-primary: #6d28d9; --focus-border: #6d28d9; --focus-ring: rgba(109, 40, 217, 0.22); --card-bg: #fffdf8;
  --toast-error: #b3261e; --bg-secondary: #f1e8d6; --tab-hover-bg: rgba(109, 40, 217, 0.1);
  position: fixed;
  top: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 1500;
  width: min(820px, calc(100vw - 380px));
  min-width: 340px;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #fbf7ee;
  color: #2b241b;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}
.protocol-panel[hidden] { display: none; }
.protocol-panel.folded { display: none; }
[data-theme="dark"] .protocol-panel {
  --input-bg: #1f1c18; --text-primary: #f1e9da; --text-secondary: #b6a98f; --border-color: #3d362c;
  --accent-primary: #b49cff; --focus-border: #b49cff; --focus-ring: rgba(180, 156, 255, 0.25); --card-bg: #24201b;
  --bg-secondary: #2a251f; --tab-hover-bg: rgba(180, 156, 255, 0.14);
  background: #1b1915; color: #f1e9da;
}

.pp-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-color); }
.pp-head strong { margin-right: auto; font-size: 15px; }
.pp-head button, .pp-actions button, .pp-lockform button, .pp-edit {
  min-height: 30px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 6px;
  background: var(--card-bg); color: inherit; font: inherit; cursor: pointer;
}
.pp-head .pp-new, .pp-actions .pp-save, .pp-lockform button { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.pp-head .pp-close { font-size: 18px; padding: 0 10px; }
.pp-search { width: 180px; min-height: 30px; padding: 2px 8px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--input-bg); color: inherit; }

.pp-body { display: grid; grid-template-columns: 210px 1fr; min-height: 0; }
.pp-list { overflow-y: auto; border-right: 1px solid var(--border-color); padding: 6px; display: grid; align-content: start; gap: 2px; }
.pp-item { display: grid; grid-template-columns: 32px 1fr; gap: 0 6px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.pp-item strong { grid-row: span 2; font-size: 16px; color: var(--accent-primary); }
.pp-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pp-item-meta { font-size: 12px; color: var(--text-secondary); }
.pp-item:hover { background: var(--tab-hover-bg); }
.pp-item.active { background: var(--bg-secondary); box-shadow: inset 3px 0 0 var(--accent-primary); }

.pp-view { overflow-y: auto; padding: 16px 20px 40px; min-width: 0; }
.pp-read-head { display: grid; gap: 6px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.pp-read-head h2 { margin: 0; font-size: 20px; }
.pp-read-head h2 .wiki-link { text-decoration: none; }
.pp-meta { margin: 0; color: var(--text-secondary); font-size: 13px; }
.pp-players { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.pp-chip { padding: 1px 8px; border-radius: 10px; background: var(--bg-secondary); font-size: 12.5px; }
.pp-edit { justify-self: start; }
.pp-text { font-size: 15px; line-height: 1.6; }
.pp-text h4 { font-size: 16px; margin: 1em 0 0.3em; }
.pp-note { color: var(--text-secondary); }
.pp-error { color: var(--toast-error); }

.pp-lockform { grid-column: 1 / -1; display: grid; gap: 10px; max-width: 360px; margin: 40px auto; padding: 0 16px; }
.pp-lockform input, .pp-form input { min-height: 32px; padding: 4px 8px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--input-bg); color: inherit; font: inherit; }

.pp-form { display: grid; gap: 12px; }
.pp-form h2 { margin: 0; font-size: 18px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.pp-form label { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.pp-form .pp-wide { grid-column: 1 / -1; }
.pp-form textarea { min-height: 300px; padding: 8px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--input-bg); color: inherit; font: inherit; }
.pp-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* the Markdown editor inside the panel */
.protocol-panel .md-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-bottom: 0; border-radius: 6px 6px 0 0; }
.protocol-panel .md-tool { min-width: 28px; padding: 2px 7px; font: 12px system-ui, sans-serif; color: var(--text-primary); background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
.protocol-panel .md-tool:hover { background: var(--tab-hover-bg); }
.protocol-panel .md-spacer { flex: 1; }
.protocol-panel .md-preview { padding: 8px 10px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 0 0 6px 6px; font-weight: 400; color: var(--text-primary); }
.protocol-panel .cm-editor .cm-scroller { min-height: 300px; }

/* "Erwähnt in: 📜 Sitzung 12" in popups */
.backlinks .protocol-link { color: #6d28d9; font-weight: 600; text-decoration: none; white-space: nowrap; }
[data-theme="dark"] .backlinks .protocol-link { color: #b49cff; }

@media (max-width: 800px) {
  .protocol-panel { left: 0; right: 0; top: 0; bottom: 0; width: auto; min-width: 0; border-radius: 0; }
  .pp-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .pp-list { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--border-color); }
  .pp-search { width: 120px; }
}

/* Date fields you can type and paste into (src/utils/date-field.js) */
.date-field { position: relative; display: flex; align-items: stretch; gap: 4px; min-width: 0; }
.date-field > input[type="text"] { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.date-field-button { flex: none; padding: 0 7px; border: 1px solid var(--border-color, var(--line-2, #ccc)); border-radius: 6px; background: transparent; cursor: pointer; font-size: 14px; }
.date-field-button:disabled { opacity: 0.4; cursor: default; }
.date-field-picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.date-field-invalid { border-color: var(--toast-error, var(--bad, #c0392b)) !important; }
