/* Map.View.Styles.css - Embedded Map Blocks, Notices, Popups, and Print Rules */

.map-block {
  margin: 14px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.map-note-location-block {
  margin-top: 8px;
  margin-bottom: 18px;
}

.map-canvas {
  width: 100%;
  min-height: 120px;
  background: #1b222c;
  position: relative;
  z-index: 1;
}

/* Override #reading-view img and table styles inside Leaflet containers so tiles have 0 margin while marker icons keep inline anchor margins */
#reading-view .leaflet-container img {
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  max-width: none !important;
  max-height: none !important;
}

#reading-view .leaflet-container table,
#reading-view .leaflet-container th,
#reading-view .leaflet-container td {
  margin: 0;
  border: none;
}

.map-notice-bar {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  background: rgba(245, 158, 11, 0.08);
  border-top: 1px solid var(--border-subtle);
}

.map-notice-bar ul {
  margin: 0;
  padding-left: 18px;
}

.map-notice-bar li {
  margin: 2px 0;
}

.map-error-box {
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
}

.map-error-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #f87171;
}

.map-error-box ul {
  margin: 4px 0 0 0;
  padding-left: 18px;
}

.map-popup-content {
  font-size: 13px;
  line-height: 1.45;
  color: #1f2937;
  max-width: 240px;
  word-break: break-word;
}

.map-popup-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.map-popup-title a {
  color: #2563eb;
  text-decoration: none;
}

.map-popup-title a:hover {
  text-decoration: underline;
}

.map-popup-desc {
  color: #4b5563;
  font-size: 12px;
  margin-top: 3px;
}

/* Hide Leaflet Routing Machine control container by default unless directions: true */
.map-hide-directions .leaflet-routing-container {
  display: none !important;
}

/* Dark-mode styling when turn-by-turn directions panel is enabled (directions: true) */
.map-canvas .leaflet-routing-container {
  background-color: rgba(24, 24, 28, 0.94);
  color: var(--text-normal);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  max-height: 260px;
  overflow-y: auto;
}

.map-canvas .leaflet-routing-alt {
  max-height: 220px;
  border-bottom-color: var(--border-subtle);
}

.map-canvas .leaflet-routing-alt tr:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Progressive Map Expansion Controls & Overlays */
.map-custom-control {
  background: rgba(24, 24, 28, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}

.map-ctrl-btn {
  background: transparent;
  color: var(--text-normal);
  border: none;
  padding: 5px 9px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}

.map-ctrl-btn:hover,
.map-ctrl-btn.active {
  background: var(--accent);
  color: #ffffff;
}

.map-ctrl-search {
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
}

.map-search-form {
  display: flex;
  align-items: center;
}

.map-search-input {
  background: transparent;
  border: none;
  color: var(--text-normal);
  padding: 5px 8px;
  font-size: 12px;
  width: 145px;
  outline: none;
}

.map-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  background: rgba(24, 24, 28, 0.97);
  border-top: 1px solid var(--border-subtle);
  max-height: 150px;
  overflow-y: auto;
  width: 210px;
}

.map-search-item {
  padding: 6px 8px;
  font-size: 11.5px;
  color: var(--text-normal);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.map-search-item:hover {
  background: rgba(59, 130, 246, 0.22);
}

.map-measure-readout {
  padding: 4px 8px;
  font-size: 11.5px;
  color: #fbbf24;
  border-left: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.map-minimap-container {
  width: 116px;
  height: 88px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  background: #0f172a;
}

.map-choropleth-legend {
  background: rgba(24, 24, 28, 0.92);
  color: var(--text-normal);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  font-size: 11.5px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.map-legend-title {
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: capitalize;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.map-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: inline-block;
}

.map-geojson-prop-row {
  margin: 1px 0;
}

/* Collapsible Frontmatter Properties Block */
.properties-container .properties-header {
  cursor: pointer;
  user-select: none;
  text-transform: none;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
  transition: margin-bottom var(--transition-fast), color var(--transition-fast);
}

.properties-container .properties-header:hover {
  color: var(--text-normal);
}

.properties-fold-icon {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: transform var(--transition-fast);
  transform: rotate(90deg);
}

.properties-fold-icon .icon-svg {
  width: 15px;
  height: 15px;
}

.properties-container.is-collapsed .properties-header {
  margin-bottom: 0;
}

.properties-container.is-collapsed .properties-fold-icon {
  transform: rotate(0deg);
}

.properties-container.is-collapsed .properties-table {
  display: none;
}

@media print {
  .map-block {
    break-inside: avoid;
    page-break-inside: avoid;
    border-color: #d1d5db;
  }

  .leaflet-control-zoom {
    display: none !important;
  }

  .leaflet-control-attribution {
    display: block !important;
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    color: #111827 !important;
  }
}

/* Smart Search In-Note Heading Filter */
.smart-search-hidden {
  display: none !important;
}

.smart-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  margin: 0 4px;
}

.smart-search-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--interactive-accent, #7c3aed);
}

.smart-search-select {
  background: var(--background-secondary, #202024);
  color: var(--text-normal, #dcddde);
  border: 1px solid var(--border-subtle, #333338);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11.5px;
  cursor: pointer;
  outline: none;
  margin: 0 4px;
}

.smart-search-select:focus {
  border-color: var(--interactive-accent, #7c3aed);
}

.smart-search-empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-faint, #71717a);
  font-size: 13px;
  font-style: italic;
  border: 1px dashed var(--border-subtle, #333338);
  border-radius: 6px;
  margin: 16px 0;
}

/* Outline Panel Smart Search Yellow Highlights */
.outline-item.smart-search-match {
  background-color: rgba(234, 179, 8, 0.22);
  color: #fef08a !important;
  font-weight: 600;
  border-left: 3px solid #eab308;
  padding-left: 6px;
  border-radius: 3px;
}

.outline-item.smart-search-match:hover {
  background-color: rgba(234, 179, 8, 0.35);
}

/* Master Reset Tab Bar Close-All Button */
.tab-close-all-btn {
  width: 26px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm, 4px);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle, #333338);
  color: var(--text-muted, #9ca3af);
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast, 0.15s ease);
  margin-left: 2px;
  z-index: 2;
}

.tab-close-all-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.tab-close-all-btn .icon-svg {
  width: 14px;
  height: 14px;
}

/* Drag & Drop External Markdown Preview & Side-Panel Disabled State */
#sidebar-pane.panel-temp-disabled,
#inspector-pane.panel-temp-disabled {
  opacity: 0.18;
  filter: grayscale(100%) brightness(0.7);
  pointer-events: none;
  user-select: none;
  transition: opacity 0.18s ease, filter 0.18s ease;
}

.tab-temp-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  margin-right: 4px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  flex-shrink: 0;
}

.tab.tab-temp-preview.active {
  border-bottom-color: #38bdf8;
}

.drop-zone-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-zone-overlay.hidden {
  display: none !important;
}

.drop-zone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 36px;
  border-radius: 10px;
  background: var(--bg-secondary, #1e1e24);
  border: 2px dashed #38bdf8;
  color: var(--text-normal, #e4e4e7);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* Offline Lucide Map Icons Gallery (```map-icons) */
.map-icons-gallery-block {
  margin: 14px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary);
  padding: 14px;
}

.map-icon-gallery-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.map-icon-gallery-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.map-icon-gallery-search {
  flex: 1 1 260px;
  padding: 7px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-strong, var(--border-subtle));
  background: var(--bg-primary);
  color: var(--text-normal);
  font-size: 13px;
  outline: none;
}

.map-icon-gallery-search:focus {
  border-color: var(--accent, #2563eb);
}

.map-icon-gallery-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.map-icon-gallery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.map-icon-gallery-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.map-icon-gallery-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 2px;
}

.map-icon-gallery-pill {
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-normal);
  font-size: 12px;
  cursor: pointer;
}

.map-icon-gallery-pill.active,
.map-icon-gallery-pill:hover {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #ffffff;
}

.map-icon-gallery-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  cursor: pointer;
  padding: 0;
}

.map-icon-gallery-swatch.active {
  border-color: var(--text-normal);
  transform: scale(1.15);
}

.map-icon-gallery-color-input {
  width: 24px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.map-icon-gallery-hint {
  font-size: 11.5px;
  color: var(--text-faint, var(--text-muted));
}

.map-icon-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.map-icon-gallery-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-normal);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.map-icon-gallery-card:hover {
  border-color: var(--accent, #2563eb);
  transform: translateY(-1px);
}

.map-icon-gallery-card.copied {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.14);
}

.map-icon-gallery-preview {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#reading-view .map-icon-gallery-preview img {
  margin: 0;
  padding: 0;
  border-radius: 0;
}

.map-icon-gallery-name {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  word-break: break-word;
  line-height: 1.25;
}

.map-icon-gallery-empty {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.map-icon-gallery-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.map-icon-gallery-more-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-strong, var(--border-subtle));
  background: var(--bg-primary);
  color: var(--text-normal);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.map-icon-gallery-more-btn:hover {
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
}

/* Collapsible Headings (H2-H6) & Reading View Context Menu */
@media screen {
  .reading-rendered-content:not(.smart-search-active) > .heading-folded-hidden {
    display: none !important;
  }
}

.heading-fold-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  vertical-align: middle;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.45;
  transition: transform var(--transition-fast, 0.15s ease), opacity var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

.heading-fold-toggle .icon-svg {
  width: 14px;
  height: 14px;
}

#reading-view h2:hover > .heading-fold-toggle,
#reading-view h3:hover > .heading-fold-toggle,
#reading-view h4:hover > .heading-fold-toggle,
#reading-view h5:hover > .heading-fold-toggle,
#reading-view h6:hover > .heading-fold-toggle,
.heading-fold-toggle:hover,
.heading-fold-toggle:focus-visible {
  opacity: 1;
  color: var(--text-normal);
}

.reading-rendered-content:not(.smart-search-active) > .heading-is-folded > .heading-fold-toggle {
  opacity: 0.95;
  transform: rotate(-90deg);
}

.reading-rendered-content:not(.smart-search-active) > .heading-is-folded::after {
  content: "…";
  display: inline-block;
  margin-left: 8px;
  padding: 0 5px;
  font-size: 0.7em;
  line-height: 1.4;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-faint);
  vertical-align: middle;
  font-weight: 500;
}

.mdv-context-menu-item:disabled,
.mdv-context-menu-item.disabled {
  opacity: 0.42;
  cursor: default;
}

.mdv-context-menu-item:disabled:hover,
.mdv-context-menu-item.disabled:hover {
  background: transparent;
  color: var(--text-normal);
}

@media print {
  .heading-fold-toggle,
  .heading-is-folded::after {
    display: none !important;
  }
}

/* Hosted Cloud Vault Blocked Images & Blocked Schemes */
.blocked-remote-image {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px dashed var(--border-strong, #52525b);
  background: var(--bg-secondary, rgba(39, 39, 42, 0.55));
  color: var(--text-muted, #a1a1aa);
  font-size: 12px;
  font-family: var(--font-monospace, monospace);
}

.external-link.is-blocked-scheme,
a.is-blocked-scheme {
  color: var(--text-faint, #71717a);
  text-decoration: line-through;
  cursor: not-allowed;
}







/* ==========================================================================
   Hosted Cloud Vault, Three-Key Reveal Overlay & Conflict UI (v0.3.0)
   ========================================================================== */

.status-cloud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary, #262626);
  border: 1px solid var(--border-color, #363636);
  font-size: 11px;
  margin-right: 8px;
}

.cloud-pill-label {
  font-weight: 600;
}

.cloud-pill-edit {
  color: var(--color-green, #4ade80);
}

.cloud-pill-view {
  color: var(--accent, #7c3aed);
}

.cloud-pill-locked {
  color: var(--color-yellow, #fbbf24);
}

.cloud-pill-btn {
  background: transparent;
  border: 1px solid var(--border-color, #444);
  color: var(--text-normal, #dcddde);
  border-radius: 4px;
  font-size: 10.5px;
  padding: 1px 6px;
  cursor: pointer;
}

.cloud-pill-btn:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
}

.tree-node-author-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  margin-left: 4px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.cloud-new-note-btn {
  background: var(--accent, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  margin-left: 6px;
  cursor: pointer;
}

.cloud-new-note-btn:hover {
  filter: brightness(1.1);
}

.file-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #999);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.tree-file:hover .file-delete-btn,
.tree-file.active .file-delete-btn {
  opacity: 0.85;
}

.file-delete-btn:hover {
  color: var(--color-red, #f87171);
  opacity: 1;
}

.cloud-gate-state .cloud-gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.cloud-gate-error {
  color: var(--color-red, #f87171);
  font-size: 12.5px;
  margin-top: 6px;
}

.cloud-gate-local-match {
  margin-top: 10px;
  font-size: 12.5px;
}

.md-editor-conflict-banner,
.md-editor-external-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(245, 158, 11, 0.16);
  border-bottom: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
  font-size: 12.5px;
}

.md-editor-conflict-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Layered One-Time Key Reveal Overlay (above #sweet-popup-backdrop) */
.mdv-key-reveal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mdv-key-reveal-box {
  width: 100%;
  max-width: 620px;
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #363636);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  color: var(--text-normal, #dcddde);
}

.mdv-key-reveal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mdv-key-reveal-header h3 {
  margin: 0;
  font-size: 15px;
}

.mdv-key-reveal-warning {
  font-size: 12px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0 12px;
}

.mdv-key-row {
  margin-bottom: 10px;
}

.mdv-key-row label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted, #aaa);
  margin-bottom: 4px;
}

.mdv-agent-instructions-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #333);
}

.mdv-agent-instructions-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mdv-agent-view-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  cursor: pointer;
}

.mdv-key-reveal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.apikeys-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.apikeys-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.apikeys-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.apikeys-member-card {
  border: 1px solid var(--border-color, #363636);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--bg-primary, #171717);
}

.apikeys-member-card.is-revoked {
  opacity: 0.6;
}

.apikeys-member-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.apikeys-member-ident {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

.apikeys-member-meta {
  font-size: 11.5px;
  color: var(--text-muted, #999);
}

.apikeys-member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.apikeys-revoked-pill {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
