/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #24283b;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #4b4f68;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #6e7189;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fadeIn 0.2s ease-out forwards;
}

/* Added markdown preview styles */
/* Markdown Preview Styles */
.markdown-preview {
  color: #dfe0e8;
  line-height: 1.6;
}

.markdown-preview h1 {
  font-size: 2em;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  color: #a78bfa;
  border-bottom: 2px solid #4c1d95;
  padding-bottom: 0.5rem;
}

.markdown-preview h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #c4b5fd;
}

.markdown-preview h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: #ddd6fe;
}

.markdown-preview p {
  margin-bottom: 1rem;
}

.markdown-preview ul,
.markdown-preview ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.markdown-preview li {
  margin-bottom: 0.5rem;
}

.markdown-preview code {
  background-color: #24283b;
  color: #a78bfa;
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
}

.markdown-preview pre {
  background-color: #14151f;
  border: 1px solid #33374d;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.markdown-preview pre code {
  background-color: transparent;
  padding: 0;
  color: #dfe0e8;
}

.markdown-preview blockquote {
  border-left: 4px solid #a78bfa;
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1rem;
  color: #9a9db2;
  font-style: italic;
}

.markdown-preview a {
  color: #a78bfa;
  text-decoration: underline;
}

.markdown-preview a:hover {
  color: #c4b5fd;
}

.markdown-preview strong {
  font-weight: 700;
  color: #fff;
}

.markdown-preview em {
  font-style: italic;
  color: #c2c4d2;
}

.markdown-preview hr {
  border: none;
  border-top: 1px solid #33374d;
  margin: 1.5rem 0;
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.markdown-preview th,
.markdown-preview td {
  border: 1px solid #33374d;
  padding: 0.5rem;
  text-align: left;
}

.markdown-preview th {
  background-color: #24283b;
  font-weight: 600;
  color: #a78bfa;
}

.markdown-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
/* The app's grid, as the graph draws it (graph/lanes.js drawGrid): a fine line every 32px
   (GRID), a stronger one every 5 steps, a soft violet glow at the top, fading out
   towards the edges. Fixed, so it is painted once, not on scroll. */
.page-pattern {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(124, 58, 237, 0.16), transparent 70%),
    linear-gradient(rgba(139, 152, 179, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 152, 179, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(100, 116, 139, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 116, 139, 0.1) 1px, transparent 1px);
  background-size: 100% 100%, 160px 160px, 160px 160px, 32px 32px, 32px 32px;
  mask-image: radial-gradient(ellipse 100% 85% at 50% 0%, #000 45%, transparent 100%);
}

/* The investigation selector while lookups are saved into a case */
#investigationsDropdown.recording { border: 1px solid rgba(168, 85, 247, 0.35); }

/* Modals: toggled with .modal-open (opacity only - cheap to animate) */
.modal { opacity: 0; transition: opacity 0.15s ease; }
.modal.modal-open { opacity: 1; }
.modal .modal-panel { transform: translateY(6px); transition: transform 0.15s ease; }
.modal.modal-open .modal-panel { transform: none; }

/* Toasts */
.toast { opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; }
.toast.toast-visible { opacity: 1; transform: none; }

.slide-in { animation: slideIn 0.18s ease-out; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Saved-results button badge */
#persistentHistoryBtn { position: fixed; }
.history-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}

/* Investigation timeline: let the browser skip rendering off-screen cards.
   Scoped to its own class - on multi-column/streaming layouts the placeholder
   height makes content jump while scrolling. */
.inv-result-card { content-visibility: auto; contain-intrinsic-size: auto 88px; }

/* Identifier chip that opens the pivot menu */
.pivot-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.15rem 0.5rem;
  border-radius: 0.375rem;
  background: rgba(76, 29, 149, 0.25);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #ddd6fe;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  text-align: left;
  word-break: break-all;
}
.pivot-chip:hover { background: rgba(109, 40, 217, 0.45); color: #fff; }
/* a name in a heading stays heading-sized */
:is(h1, h2, h3, h4, h5, h6) > .pivot-chip { font-size: inherit; font-weight: inherit; font-family: inherit; word-break: normal; }
.pivot-chip i { font-size: 0.6rem; opacity: 0.7; flex-shrink: 0; }
/* The identifier is in other investigations too (count) */
.pivot-chip .shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  background: rgba(120, 53, 15, 0.55);
  border: 1px solid rgba(217, 119, 6, 0.55);
  color: #fcd34d;
  font-size: 0.65rem;
  line-height: 1.1rem;
  flex-shrink: 0;
}
.pivot-chip .shared-badge i { opacity: 1; }

/* Investigation tabs and identifier facets */
.inv-tab { padding: 0.6rem 1rem; color: #9a9db2; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 0.9rem; }
.inv-tab:hover { color: #fff; }
.inv-tab.active { color: #fff; border-bottom-color: #a855f7; }
.facet { padding: 0.25rem 0.65rem; border-radius: 0.375rem; background: #14151f; border: 1px solid #33374d; color: #c2c4d2; font-size: 0.75rem; }
.facet span { color: #6e7189; margin-left: 0.25rem; }
.facet:hover { border-color: #6e7189; }
.facet.active { background: rgba(109, 40, 217, 0.35); border-color: #8b5cf6; color: #fff; }

/* Collapsible result sections (.panel; .recon-section is the same) */
.panel,
.recon-section {
  background: #14151f;
  border: 1px solid #24283b;
  border-radius: 0.5rem;
}
.panel > summary,
.recon-section > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  user-select: none;
}
.panel > summary::-webkit-details-marker,
.recon-section > summary::-webkit-details-marker { display: none; }
.panel > summary::after,
.recon-section > summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 0.7rem;
  margin-left: auto;
  color: #6e7189;
  transition: transform 0.15s ease;
}
.panel[open] > summary::after,
.recon-section[open] > summary::after { transform: rotate(180deg); }
.panel > summary > i,
.recon-section > summary > i { color: #a78bfa; width: 1rem; text-align: center; }
.panel > summary .count,
.recon-section > summary .count { font-size: 0.75rem; color: #6e7189; font-weight: 400; }
.panel > .panel-body,
.recon-section > .recon-body { padding: 0 1.25rem 1.25rem; }

/* Checkboxes across the app */
.pick-box, .note-editor .cm-md-checkbox {
    appearance: none;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    display: inline-grid;
    place-content: center;
    border: 1px solid #4b4f68;
    border-radius: 0.25rem;
    background: #24283b;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pick-box:hover, .note-editor .cm-md-checkbox:hover { border-color: #a855f7; }
.pick-box:focus-visible { outline: 2px solid #a855f7; outline-offset: 2px; }
.pick-box:checked, .pick-box:indeterminate, .note-editor .cm-md-checkbox:checked { background: #9333ea; border-color: #9333ea; }
.pick-box:checked::after, .note-editor .cm-md-checkbox:checked::after {
    content: "";
    width: 0.3rem;
    height: 0.55rem;
    margin-top: -0.1rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.pick-box:indeterminate::after { content: ""; width: 0.5rem; height: 2px; background: #fff; }
.inv-result-card:has(.pick-box:checked) { border-color: rgba(168, 85, 247, 0.6); }

/* Images that open the viewer (openImageViewer in main.js) */
[data-image-view], img.cm-md-image { cursor: zoom-in; }


/* Keyboard focus is always visible on things you can press. Many buttons carry
   focus:outline-none (to hide the ring on click); :focus-visible only applies when
   moving with the keyboard, so the ring is forced back for that case. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
input[type="file"]:focus-visible,
select:focus-visible {
    outline: 2px solid #a855f7 !important;
    outline-offset: 2px;
}

/* For people who ask their system for less motion: no slides, fades or spinning */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Investigation graph: a dark blue-black; its grid is drawn on a canvas under the graph
   (graph/lanes.js drawGrid): a CSS gradient grid repainted on every zoom step was the
   slowest part of zooming on a modest laptop */
.graph-root {
    background-color: #090a10;
}
/* keys work while the graph has focus: a quiet sign of it, not the browser's outline */
.graph-root:focus { outline: none; }
.graph-root:focus-visible { border-color: #6d28d9; }
