:root {
  --bg-color: #05070a; /* Pitch black obsidian */
  --card-bg: #070d0a;
  --text-primary: #4ade80; /* The classic terminal lime/phosphor green */
  --accent: #c084fc; /* Glowing neon green for headers & active links */
  --border: #14532d; /* Matrix-style dark green border */
  --glow: rgba(74, 222, 128, 0.25);
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: "Courier New", Courier, monospace;
  text-shadow: 0 0 2px var(--glow);
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.container {
  max-width: 900px;
  width: 100%;
  background-color: #022c22;
  border: 1px solid var(--border);
  box-shadow: 0 0 20px rgba(20, 83, 45, 0.2);
  padding: 1.5rem;
  border-radius: 4px;
}

/* Make the inputs look like a terminal */
input,
textarea {
  background: #020402;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border); /*   Drawer edge look  */
  color: var(--text-primary);
  padding: 0.85rem;
  /* border-radius: 2px;   MIGHT NOT NEED THIS */
  font-family: inherit;
  outline: none;
  transition: all 0.3s;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.2);
  /* box-shadow: 0 0 8px var(--glow); previous box shadow */
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 1.5rem;
}

h1 {
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--text-primary);
}

h1::after {
  content: "_"; /* Unicode for a solid block cursor, use "_" if you want underscore instead \2588 */
  color: var(--accent);
  margin-left: 8px;
  animation: blink 1s step-end infinite;
  text-shadow: 0 0 8px var(--accent);
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

header p {
  color: #64748b;
  font-style: italic;

  /* Data Entry Cabinet */
}
.entry-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--card-bg);
  padding: 2.5rem;
  /* border-radius: 8px; MIGHT NOT NEED THIS */
  border: 1px solid var(--border);
  box-shadow: inset 0 0 20px rgba(20, 83, 45, 0.3); /*  INNER DEPTH  */
}

button {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
  padding: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  /* border-radius: 2px; MAY NOT NEED THIS*/
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

button:hover {
  background: var(--text-primary);
  color: var(--bg-color);
  box-shadow: 0 0 15px var(--glow);
}

/* DEPTH SLIDER STYLING */
.depth-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.depth-selector label {
  color: #64748b;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

#depth {
  accent-color: var(--accent);
  flex-grow: 1;
  cursor: pointer;
}

/* Container for the search terminal */
.search-console {
  background-color: #0c0c0c;
  border: 2px solid #33ff00;
  padding: 12px;
  font-family: "Courier New", Courier, monospace;
  display: flex;
  align-items: center;
  box-shadow: 0 0 10px rgba(51, 255, 0, 0.2);
  margin-bottom: 20px;

  /* Subtle CRT Flicker */
  animation: crt-flicker 0.15s infinite alternate;
}

/* The terminal prompt text */
.prompt-symbol {
  color: #33ff00;
  margin-right: 10px;
  font-weight: bold;
}

/* The ACTUAL search input field */
#curiositySearch {
  background: transparent;
  border: none;
  color: #33ff00;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  flex-grow: 1;
}

/* Styling the placeholder text */
#curiositySearch::placeholder {
  color: #1a8000;
  opacity: 0.2;
}

/*keyframes for the flicker effect */
@keyframes crt-flicker {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 1;
  }
}

/* Terminal Search Highlight */
.search-highlight {
  background-color: #33ff00; /* Neon green background */
  color: #0c0c0c; /* Dark text */
  border-radius: 2px;
  padding: 0 2px;
  box-shadow: 0 0 5px #33ff00; /* Subtle glowing edge */
  font-weight: bold;
}

/*            RENDERED JOURNAL ENTRIES (THE ARCHIVES)          */
.journal-entry {
  background: var(--card-bg);
  padding: 1.5rem;
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  position: relative;
  /* border-radius: 4px; LEAVING THIS OUT FOR NOW */
}

.journal-entry h3 {
  margin-top: 0.5rem 0;
  color: var(--text-primary);
}

.journal-entry small {
  color: #64748b;
}

.button-group {
  display: flex;
  justify-content: flex-start;
  gap: 15px;
  margin-top: 1rem;
}

.secondary-btn {
  color: #ef4444;
  border-color: #ef4444;
}

.secondary-btn:hover {
  background: #ef4444;
  color: var(--bg-color);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Container for Edit and Delete buttons */
.entry-actions {
  position: absolute;
  top: 10px;
  right: 15px;
  display: flex;
  gap: 15px;
}

/* Base style for individual actions */
.delete-btn,
.edit-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.delete-btn {
  color: #64748b;
}

.delete-btn:hover {
  color: #ef4444;
  text-shadow: 0 0 5px #ef4444;
}

.edit-btn {
  color: var(--accent);
}

.edit-btn:hover {
  color: var(--accent);
  text-shadow: 0 0 5px var(--accent);
}

/* Style for the Utility Buttons (Tops) */
.file-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  /* margin-bottom: 1rem; MIGHT NOT USE THIS */
}

.util-btn {
  /* background: #334155;
  color: #94a3b8;
  border: none;
  cursor: pointer; MIGHT DELETE THIS LATER*/
  padding: 5px 15px;
  font-size: 0.75rem;
  border-radius: dashed;
}

.dotted-line {
  border: none;
  border-top: 2px dotted #33ff00;
  margin: 20px 0;
}

/* Tag container */
.top-tags-wrapper {
  display: flex;
  gap: 10px; /* space between tags */
  margin-bottom: 20px;
  align-items: center;
}

/* Individual tag styling */
.tag-pill.top-tag {
  background-color: #e2e8f0;
  color: #334155;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: crosshair;
}

/* Tag Pill Style */
.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag-pill {
  background: transparent;
  color: #64748b;
  border: 1px solid #64748b;
  padding: 2px 10px;
  /* border-radius: 12px; MIGHT */
  font-size: 0.7rem;
  text-transform: lowercase;
}

.filter-section {
  margin: 3rem 0 1.5rem 0;
}

#tag-filter {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border);
  color: var(--accent);
  font-style: italic;
  /* outline: none;
  transition: border-color 0.3s;
  padding: 0.75rem; MIGHT */
}

#tag-filter:focus {
  border-bottom-color: var(--accent);
}

/* This highlights tags that match the filter */
.tag-pill.match {
  background: var(--accent);
  color: var(--bg-color);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/*         Anecdote "Curiosity" Style         */
.anecdote-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  cursor: help;
  transition: all 0.2s;
  text-shadow: 0 0 5px rgba(192, 132, 252, 0.5);
}

.anecdote-link:hover {
  color: #ffffff;
  background: rgba(192, 132, 252, 0.15);
}

/* Sidebar Styling */
.sidebar {
  position: fixed;
  top: 0;
  right: -450px; /* hidden */
  width: 400px;
  height: 100%;
  background: #040806;
  border-left: 2px solid var(--accent);
  box-shadow: -10px 0 30px rgba(192, 132, 252, 0.15);
  z-index: 1000;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
}

/* The White Rabbit */
.crt-image-container {
  position: relative;
  width: 260px;
  margin: 0 auto 1.5rem auto; /* centers the image */
  border: 1px solid var(--border);
  box-shadow: 0 0 15px var(--glow);
}

.crt-image {
  display: block;
  width: 100%;
  height: auto;
  /* grayscale strips color....Sepia + Hue Rotate forces it to neon green */
  filter: invert(1) grayscale(100%) sepia(100%) hue-rotate(80deg) saturate(200%)
    contrast(1.5);
  opacity: 0.85;
  animation: hologram-glitch 4s infinite linear;
}

/* =============================================================================
=========================HOLOGRAM GLITCH ANIMATION==============================
============================================================================= */

@keyframes hologram-glitch {
  0%,
  100% {
    opacity: 0.85;
    filter: invert(1) grayscale(100%) sepia(100%) hue-rotate(80deg)
      saturate(200%) contrast(1.5);
    transform: translate(0, 0);
  }
  34% {
    opacity: 0.85;
  }
  /* Glitch 1: Sharp opacity drop and contrast spike */
  35% {
    opacity: 0.3;
    filter: invert(1) grayscale(100%) sepia(100%) hue-rotate(80deg)
      saturate(400%) contrast(2.5);
  }
  36% {
    opacity: 0.85;
  }

  69% {
    opacity: 0.85;
  }
  /* Glitch 2: Slight physical jitter and dimming */
  70% {
    opacity: 0.5;
    transform: translate(2px, -1px);
  }
  71% {
    opacity: 0.85;
    transform: translate(0, 0);
  }

  89% {
    opacity: 0.85;
  }
  /* Glitch 3: Quick double-flicker */
  90% {
    opacity: 0.4;
  }
  91% {
    opacity: 0.85;
  }
  92% {
    opacity: 0.4;
  }
  93% {
    opacity: 0.85;
  }
}

/* The  Scanline Effect */
.crt-image-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(5, 7, 10, 0.4) 3px,
    rgba(5, 7, 10, 0.4) 4px
  );
  pointer-events: none; /* allows you to click through overlay */
}

.sidebar.active {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 1rem;
}

#sidebar-title {
  color: var(--accent);
  margin: 0;
  font-size: 1.2rem;
  text-transform: uppercase;
}

#sidebar-content {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  resize: none;
  line-height: 1.6;
  width: 100%;
  height: 300px;
  margin-bottom: 1rem;
}

/* Overlay that dims background */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 999;
}

#sidebar-overlay.active {
  display: block;
}

.close-btn {
  border: none;
  font-size: 1.5rem;
}

.close-btn:hover {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  text-shadow: 0 0 10px var(--accent);
}

/* Cheshire Cat Encryption */
.cheshire-text {
  color: transparent;
  text-shadow: 0 0 12px var(--accent);
  background: rgba(192, 132, 252, 0.1);
  padding: 0 5px;
  border-radius: 3px;
  cursor: crosshair;
  transition: all 0.5s ease-in-out;
  user-select: none; /*prevents accidental copying while hidden */
}

.cheshire-text:hover {
  color: var(--text-primary);
  text-shadow: 0 0 2px var(--text-primary);
  background: transparent;
  user-select: auto;
}

/* ===========================================================================
========================== MARKDOWN & TEXT FORMATTING ========================
=========================================================================== */

/* Enter key line breaks honored */
.journal-entry p {
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Bold text */
.journal-entry strong {
  color: #33ff00; /* Bright terminal green babbbbbbbbbyyyyyy */
  font-weight: 900;
  text-shadow: 0 0 5px rgba(51, 255, 0, 0.4);
}

/* Italics text (*text*) */
.journal-entry em {
  color: var(--accent); /* Neon purple accent :) */
  font-style: italic;
}

/* Blockquotes / Margins (> text */
.md-quote {
  border-left: 3px solid var(--accent);
  margin: 15px;
  padding: 10px 15px;
  color: #94a3b8;
  font-style: italic;
  background: rgba(192, 132, 252, 0.05);
  border-radius: 0 4px 4px 0;
}
