/* == GLOBAL STYLES == */
*,
*::before,
*::after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  transition: opacity 0.5s ease-out;
}

/* FIX: Split html and body to ensure Dark Mode toggles correctly */
html {
  margin: 0;
  padding: 0;
  /* No background-color here so it inherits from body */
}

body {
  margin: 0;
  padding: 0;
  /* Background applied ONLY to body so the class toggle works */
  background-color: #f5f5f5; 
  
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: rgba(0, 0, 0, 0.6);
  font-size: 18px;
}

p {
  font-weight: 400;
}

h1 {
  color: rgba(0, 0, 0, 0.75);
}

.icon {
  font-size: 20px;
  color: #333 !important; /* No idea why !important is necessary, but it is. */
}

code {
  background-color: #eee;
  padding: 1px 5px;
}

kbd,
.shepherd-element.shepherd-theme-arrows .shepherd-content kbd {
  background-color: #fcfcfc;
  font-size: .75em;
  padding: 0.25em 0.4em;
  border-radius: 0.2em;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.25);
}

button {
  font-family: inherit;
}

button[type=button]:active {
  background-color: #f0f0f0;
}

a {
  color: #5a5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* == HELPER CLASSES == */

/* Class for making semitransparent elements with a blur behind them */
.transparent-blur {
  background-color: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

/* == Class for making divs strech the full screen == */
.fullscreen {
  /* Same size as window */
  width: 100vw;
  height: 100vh;

  /* No space from top corner */
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
}

/* == LOADING ICON == */
#loading {
  position: fixed;
  bottom: 15px;
  right: 60px; /* Positioned to the left of the button group */
  z-index: 100;
  font-size: 30px;
  color: #333;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}

.loading-hidden {
  opacity: 0;
}

/* Spinning animation for the loading icon */
#loading .icon.ion-load-c {
  display: block;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* == DEBUG PANEL STYLES == */
.debug-btn {
  position: fixed;
  bottom: 220px; 
  right: 12px;   
  z-index: 1000;
  background: none; 
  border: none;     
  box-shadow: none; 
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}
.debug-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  background: none;
}
.debug-btn .icon {
    font-size: 16px; 
    color: #555 !important;
}

.debug-section {
  margin-bottom: 8px;
}

.debug-section label {
  display: block;
  margin-bottom: 2px;
  color: #ccc;
}

.debug-section input {
  width: 100%;
}

.debug-section span {
  display: block;
  text-align: right;
  color: #4CAF50;
  font-weight: bold;
}

.debug-panel {
  position: fixed;
  top: 50px;    /* Top Right */
  right: 10px;  /* Top Right */
  width: 260px;
  background-color: rgba(0,0,0,0.85);
  color: white;
  padding: 10px;
  border-radius: 5px;
  z-index: 1001;
  font-size: 12px;
  font-family: monospace;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid #555;
  padding-bottom: 5px;
  font-weight: bold;
}


/* == INFO CARD STYLES == */
/* The wrapper (invisible box for positioning) */
#node-info-card {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 320px;
  max-width: 90vw;
  z-index: 1000;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; /* Let clicks pass through empty space */
}

/* The floating action buttons above the card */
.info-actions {
  pointer-events: auto;
  position: absolute;
  top: -48px; /* Floating above */
  left: 0;
  height: 40px;
  display: flex;
  
  background-color: rgba(255, 255, 255, 0.6); /* Match button container style */
  border: 1px solid #aaa;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.info-actions button {
  width: 40px;
  height: 40px;
  padding: 5px;
  margin: 0;
  background-color: transparent;
  border: none;
  border-right: 1px solid #aaa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-actions button:last-child {
  border-right: none;
}

.info-actions button:hover {
  background-color: rgba(255,255,255,0.8);
}

/* The actual white content box */
.info-content {
  pointer-events: auto;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  padding: 15px;
  font-size: 14px;
  max-height: 50vh;
  overflow-y: auto;
  position: relative;
}

.info-content h2 {
  margin-top: 0;
  font-size: 1.2em;
  color: #333;
}

.info-content img {
  max-width: 80px;
  max-height: 116px;
  object-fit: cover;
  float: left;
  margin-right: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.info-content .close-card {
  position: absolute;
  top: 5px;
  right: 10px;
  cursor: pointer;
  font-size: 1.5em;
  line-height: 1;
  color: #888;
  background: none;
  border: none;
  padding: 0;
}

.info-content .close-card:hover {
  color: #333;
}

/* == DARK MODE STYLES == */
body.dark-mode {
  background-color: #121212;
  color: #ccc;
}

body.dark-mode .transparent-blur,
body.dark-mode #info,
body.dark-mode #formbox,
body.dark-mode .modal-background {
  background-color: rgba(30, 30, 30, 0.85);
  border-color: #444;
}

body.dark-mode .icon {
  color: #ccc !important;
}

body.dark-mode button {
  color: #ccc;
}
body.dark-mode button:hover {
  background-color: rgba(255,255,255,0.1);
}

body.dark-mode .button-container,
body.dark-mode .info-actions {
  border-color: #555;
  background-color: rgba(30,30,30,0.8);
}

body.dark-mode .button-container button,
body.dark-mode .info-actions button {
  border-color: #555;
}

body.dark-mode #input input {
  color: #fff;
}

body.dark-mode .controls-guide {
  background: rgba(255,255,255,0.05);
  border: 1px solid #444;
}

body.dark-mode .suggestion-item {
  background-color: #2a2a2a;
  border-color: #444;
  color: #bbb;
}
body.dark-mode .suggestion-item:hover {
  background-color: #3a3a3a;
}

body.dark-mode .info-content {
  background-color: #222;
  color: #ddd;
}
body.dark-mode .info-content h2,
body.dark-mode h1,
body.dark-mode h3,
body.dark-mode h4 {
  color: #fff;
}

/* Adjust tag items in the input bar for dark mode */
body.dark-mode .item {
  background-color: rgba(100, 180, 255, 0.4);
  color: #fff;
}

body.dark-mode .shepbtn {
    background-color: #444;
    color: #fff;
}
