/* =================================================================== */
/*    PARTIAL: SYSTEM & NAVIGATION TOOLS                               */
/*    Contains: Command Palette, Custom Cursor, Theme Toggles,         */
/*    and Back to Top utility.                                         */
/* =================================================================== */

/* --- UI TOGGLE BUTTONS (Theme & Cursor) --- */
.ui-toggle-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.ui-toggle-btn {
  background-color: var(--onyx);
  color: var(--white1);
  font-size: 20px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow1);
  transition: var(--transition1);
}

.ui-toggle-btn:hover {
  background-color: var(--jet);
  color: var(--orange-yellow-crayola);
}

.ui-toggle-btn .sun-icon,
.ui-toggle-btn .moon-icon {
  display: none;
}

html.theme-dark .ui-toggle-btn .sun-icon,
html.theme-dracula .ui-toggle-btn .sun-icon,
html.theme-workshop .ui-toggle-btn .sun-icon {
  display: block;
}
html.theme-light .ui-toggle-btn .moon-icon {
  display: block;
}

.ui-toggle-btn ion-icon[name="mouse-outline"] {
  display: block;
}

/* --- COMMAND PALETTE (Search Engine Overlay) --- */
.command-palette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: hsla(0, 0%, 0%, 0.5);
  backdrop-filter: blur(4px);
  z-index: 11000; /* Above Modals */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.command-palette {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 90%;
  max-width: 600px;
  background-color: var(--eerie-black2);
  border: 1px solid var(--jet);
  border-radius: 16px;
  box-shadow: var(--shadow5);
  z-index: 11500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
  overflow: hidden;
}

.command-palette-overlay.active,
.command-palette.active {
  opacity: 1;
  visibility: visible;
}

.command-palette.active {
  transform: translateX(-50%) scale(1);
}

.command-palette-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--jet);
}

.command-palette-search ion-icon {
  font-size: 20px;
  color: var(--light-gray70);
}

.command-palette-search input {
  width: 100%;
  font-size: var(--fs5);
  color: var(--white2);
  background: none;
  border: none;
  outline: none;
}

.command-palette-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}
.command-palette-results::-webkit-scrollbar { width: 8px; }
.command-palette-results::-webkit-scrollbar-track { background: transparent; }
.command-palette-results::-webkit-scrollbar-thumb { background: var(--jet); border-radius: 8px; }

.command-palette-results li a {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  transition: var(--transition1);
}

.command-palette-results li img {
    flex-shrink: 0; 
}

.command-palette-results li a:hover,
.command-palette-results li a:focus {
  background-color: var(--onyx);
}

.command-palette-results .result-title {
  color: var(--light-gray);
}

.command-palette-results .result-type {
  font-size: var(--fs8);
  color: var(--light-gray70);
  background-color: var(--jet);
  padding: 2px 6px;
  border-radius: 4px;
}

.command-palette-footer {
  padding: 8px 16px;
  text-align: right;
  font-size: var(--fs8);
  color: var(--light-gray70);
  border-top: 1px solid var(--jet);
}

.command-palette-footer kbd {
  background: var(--jet);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--onyx);
  font-family: inherit;
}

/* --- CUSTOM CURSOR (Interaction Engine) --- */
.cursor-dot,
.cursor-outline {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 20000; /* Absolute Top */
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, width 0.3s, height 0.3s, background-color 0.3s, border-color 0.3s;
  display: none; 
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background-color: var(--orange-yellow-crayola);
}

.cursor-outline {
  width: 30px;
  height: 30px;
  border: 1px solid hsla(45, 100%, 72%, 0.5);
}

html.cursor-hover .cursor-dot {
  transform: translate(-50%, -50%) scale(0.5); 
  background-color: var(--white1);
}

html.cursor-hover .cursor-outline {
  width: 60px; 
  height: 60px;
  border-color: var(--orange-yellow-crayola);
  border-width: 2px;
  background-color: hsla(45, 100%, 72%, 0.1); 
}

html.cursor-danger .cursor-outline {
  border-color: var(--bittersweet-shimmer);
  background-color: hsla(0, 43%, 51%, 0.1);
}

body {
  cursor: auto;
}

body.hide-native-cursor {
  cursor: none !important;
}

/* --- BACK TO TOP BUTTON --- */
.back-to-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--onyx);
  color: var(--white1);
  font-size: 20px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow1);
  z-index: 4; 
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition1);
}

.back-to-top-btn.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  background-color: var(--jet);
  color: var(--orange-yellow-crayola);
}