:root {
  --bg: #ffffff;
  --text: #000000;
  --input-bg: #f0f0f0;
  --accent: #9929EA;
  --accent-light: #CC66DA;
  --highlight: #FAEB92;
  --highlight-tab: #CC66DA;
  --code-bg: #f9f9f9;
  --border: #ddd;
  --modal-title: #000;
  --warn-text: #000;
  --copy-default: gray;
  --copy-hover: var(--accent-light);
  --delete-color: red;
}

html.dark {
  --bg: #000000;
  --text: #f8f8f8;
  --input-bg: #222;
  --accent: #9929EA;
  --accent-light: #CC66DA;
  --highlight: #FAEB92;
  --highlight-tab: #FAEB92;
  --code-bg: #111;
  --border: #333;
  --modal-title: #fff;
  --warn-text: #fff;
  --copy-default: lightgray;
  --copy-hover: var(--accent);
  --delete-color: #ff6b6b;
}

body {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  background-color: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

/* HEADER */
header {
  background-color: var(--accent);
  color: white;
  padding: 1em 1.5em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
  font-size: 1.5em;
}

.controls {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

/* ----- Search box */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

#search {
  padding: 0.4em 0.6em;
  border: 1px solid var(--boarder);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
}

#clearSearch {
  background: transparent;
  color: gray;
  border: none;
  font-size: 1.2em;
  margin-left: -25px;
  cursor: pointer;
}

/* ----- Sidebar buttons  */
#themeToggle,
#addBtn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.4em 0.8em;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.3s ease;
  height: 35px;
}

#addBtn:hover,
#themeToggle:hover {
  background: var(--highlight);
  color: black;
}

.icon-svg {
  height: 20px;
  width: 20px;
}


/* ----- Tabs */
.tabs {
  display: flex;
  justify-content: center;
  background-color: var(--bg);
  border-bottom: 2px solid var(--accent);
}

.tab {
  padding: 0.6em 1.2em;
  background: none;
  border: none;
  color: #666;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.tab.active {
  color: var(--highlight-tab);
  border-bottom: 2px solid var(--highlight-tab);
}

/* Main Content */
main {
  padding: 1em 1.5em;
}

section {
  margin-bottom: 2em;
}

h2 {
  display: inline-block;
  font-size: 1.1em;
  margin-bottom: 0.6em;
  padding: 0.3em 0.6em;
  background: linear-gradient(to right, rgba(153, 41, 234, 0.3), rgba(153, 41, 234, 0));
  color: var(--text);
}


/* WRAPPER FOR CODE BLOCK + BUTTONS */
.code-block {
  position: relative;
  margin-bottom: 1em;
}

.code-block pre {
  background-color: var(--code-bg);
  color: var(--text);
  padding: 0.8em;
  border: 1px solid var(--accent);
  border-left: 6px solid var(--accent);
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  min-height: 3em;
  position: relative;
  z-index: 0;
  font-family: monospace;
}

/* Copy/Delete buttons */
.action-buttons {
  position: absolute;
  top: 0.6em;
  right: 0.6em;
  display: flex;
  gap: 0.4em;
  z-index: 10;
}

.copy,
.delete {
  background: transparent;
  border: none;
  padding: 0.2em 0.4em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: transform 0.2s ease, color 0.2s ease;
  
}

/* COPY BUTTON: icon only */
.copy svg {
  width: 20px;
  height: 20px;
  stroke: var(--copy-default);
  fill: none;
  pointer-events: none;
  transition: stroke 0.2s ease;
}

.copy:hover svg {
  stroke: var(--copy-hover);
}

/* DELETE BUTTON: small red text */
.delete {
  color: var(--delete-color);
  font-size: 0.8rem;
  font-weight: 500;
}

.delete:hover {
  transform: translateX(-2px);
}

/* ------ add command/category Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--input-bg);
  padding: 2em;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  border: 1px solid var(--accent);
  position: relative;
  color: var(--text);
}

html.dark .modal-content button:hover {
  color: black;
}

.modal-title {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--modal-title);
  margin-bottom: 1em;
}

/* WARNING IN MODAL */
.warning-message {
  font-size: 0.9em;
  color: var(--warn-text);
  background: rgba(250, 235, 146, 0.1);
  padding: 0.8em;
  border-left: 4px solid var(--highlight);
  border-radius: 6px;
  margin-bottom: 1em;
  line-height: 1.4;
}

.warning-message code {
  background: none;
  font-family: inherit;
  font-size: 0.95em;
  color: var(--accent);
}

/* FORM FIELDS */
.form-group {
  margin: 0.6em 0;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  width: 100%;
  padding: 0.6em;
  margin: 0.5em 0;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--accent-light);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1em;
  box-sizing: border-box;
}

/* SUBMIT BUTTON */
.modal-content button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  padding: 0.6em;
  margin-top: 1em;
  width: 100%;
  border-radius: 6px;
}

.modal-content button:hover {
  background: var(--highlight);
  color: var(--text);
}

/* CLOSE BUTTON */
.close {
  position: absolute;
  top: 0.6em;
  right: 1em;
  font-size: 1.5em;
  color: var(--text);
  cursor: pointer;
}


/* ----- Responsive */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.2em;
  }

  #search {
    width: 100px;
  }
}

/* ------ category */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.delete-category {
  background: transparent;
  color: var(--delete-color);
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.3s ease;
  margin-left: 1.5rem;
}

.delete-category:hover {
  transform: translateX(-3px);
}

/* ------- Menu button  */
.menu-button svg {
  pointer-events: none;
}

.menu-button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text); /* Use your existing light/dark text color */
  padding: 8px;
  transition: transform 0.2s ease;
}

.menu-button:hover {
  transform: scale(1.1);
}

/* ------- Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--bg, #111);
  color: var(--text, #fff);
  width: 250px;
  height: 100%;
  padding: 1rem;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar.visible {
  transform: translateX(0);
}

.close-sidebar {
  background: none;
  border: none;
  color: inherit;
  font-size: 2rem;
  cursor: pointer;
  align-self: flex-end;
}

/* -------- IP / PORT form */
.ip-port-form {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 1.5em;
}

.field-group {
  display: flex;
  align-items: center;
}

.field-label {
  background-color: var(--accent-light);
  color: white;
  padding: 0.4em 0.6em;
  font-weight: bold;
  border: none;
  border-right: none;
  border-radius: 6px 0 0 6px;
}


#ipInput,
#portInput {
  padding: 0.4em;
  border: 1px solid #999;
  border-radius: 0 6px 6px 0;
  outline: none;
  width: 100%;
}

#incPort {
  margin-left: 0.4em;
  padding: 0.4em 0.6em;
  background-color: var(--accent-light);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

#incPort:hover {
  filter: brightness(1.5); /* optional hover effect */
}


#replaceBtn {
  background-color: var(--accent);
  color: white;
  padding: 0.5em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

#replaceBtn:hover {
  background: var(--highlight);
  color: black;
}


/* ------ Toast */
.toast {
  position: fixed;
  top: 1em;
  left: 50%;
  transform: translateX(-50%);
  background-color: #116944; /* default greenish */
  color: #cfd8dc;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
}

.toast-Error {
  background-color: #b00020; /* red */
  color: white;
}

/* Delete confirmation modal */
.highlight-command {
  background: None;
  color: gray;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.highlight-category {
  color: gray;
  font-weight: bold;
}
