/* MAIN CONTENT CONTAINER */
.clipboard-wrapper {
  width: calc(80% + 40px);
  max-width: 840px;
  max-height: calc(40vh + 60px); /* Make div not grow indefinitely*/
  margin: 0 auto;
  border-radius: 8px;
  padding: 8px;
  gap: 8px; /* Gap between inner elements */
  background-color: var(--clipboard-bg-out);
  box-shadow: 0 0 15px var(--shadow-color);
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* matches the old clipboard-panel flex behaviour */
  position: relative;
}

/* Tab bar sits inside the frame at the top */
.tab-switcher {
  display: flex;
  gap: 4px;
}

/* Shared tab button styles */
.tabBtn {
  padding: 6px 18px;
  border: 0px solid var(--border-color);
  border-radius: 8px; /* rounded top corners only */
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  color: var(--theme-color);
  cursor: pointer;
  background-color: var(--clipboard-bg-out); /* inactive = darker */
  position: relative;
}

/* Active tab blends into the panel below */
.tabBtn.active {
  background-color: var(--clipboard-bg);
  z-index: 2;
}

/* COPY-PASTE BUTTON */
#copyBtn {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* CLIPBOARDS */
/* Clipboard container */
.clipboard-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
}

#clipboardIn,
#clipboardOut,
#redactPatterns {
  font-family: "Syne Mono", monospace;
  font-size: 14px;
  background-color: var(--clipboard-bg);
  outline: none; /* Remove default focus outline */
  border-radius: 8px; /* Rounded corners */
  line-height: 1.5; /* Line spacing for readability */
  resize: none; /* Disable manual resizing */
  transition: all 0.3s ease; /* Smooth transitions for all properties */
  overflow-y: auto; /* Enable vertical scrolling if content overflows */
  padding: 20px; /* Internal spacing */
  color: var(--theme-color); /* Text color (changes with theme) */
  min-height: 0; /* Critical: Allows the textarea to shrink below its content height */
  max-height: 100%; /* Ensures it doesn't exceed the container */
}

#clipboardIn,
#clipboardOut {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

#clipboardOut {
  display: none;
  position: relative;
}

#redactPatterns {
  flex: none;
  height: 10vh;
  box-shadow: 0 0 15px var(--shadow-color); /* Shadow for depth (changes with theme) */
  margin: 0 auto; /* Center horizontally */
  width: 80%; /* Take 80% of the width */
  max-width: 800px; /* Maximum width */
}

/* BUTTON CONTAINER */
.button-container-exp {
  flex-wrap: wrap;
  display: flex;
  align-items: center; /* Center content vertically */
  justify-content: center; /* Center content horizontally */
  gap: 20px; /* Space between buttons */
  margin: 20px auto; /* Center and add margin */
  width: 80%;
  max-width: 800px;
  padding: 40px 20px 40px 20px; /* Add padding inside box */
  background-color: rgba(200, 200, 200, 0.15); /* Slight gray shade */
  border-radius: 8px; /* Rounded corners */
  position: relative; /* For positioning the label */
  font-family: "Syne Mono", monospace;
}

/* BUTTON CONTAINER FOR CUSTOM TEXT */
.button-container {
  display: flex; /* Use flexbox for layout */
  justify-content: center; /* Center buttons horizontally */
  gap: 20px; /* Space between buttons */
  margin: 10px auto; /* Center and add margin */
  width: 80%; /* Match text area width */
  max-width: 800px; /* Maximum width */
}

.experimental-label {
  position: absolute; /* Position in upper left */
  top: 8px;
  left: 15px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  letter-spacing: 1px;
}

/* TOGGLE BUTTON CONTAINER */
.toggle-container {
  position: fixed;
  top: 1rem;
  z-index: 1000;
}

/* Right-aligned (default for dark mode) */
.toggle-container.right {
  right: 1rem;
}

/* Left-aligned (for side panel) */
.toggle-container.left {
  left: 1rem;
}

.placeholder-toggle {
  width: 100%; /* forces a new line in the flex container */
  text-align: center;
  font-family: "Press Start 2P", cursive;
  font-size: 12px;
}

/* BUTTON STYLES (applies to both toggle and redaction buttons)  */
.toggle-btn {
  width: 40px; /* Set explicit width */
  height: 40px; /* Set equal height */
  border-radius: 50%; /* Makes it circular */
  display: flex; /* Centers content inside */
  align-items: center;
  justify-content: center;
  padding: 0; /* Remove padding since we're using fixed dimensions */
}

.redact-btn {
  border-radius: 8px; /* Rounded corners */
  padding: 10px 20px; /* Internal spacing */
}

.toggle-btn,
.redact-btn {
  background: var(--theme-color); /* Button background matches text color */
  color: #ffffff; /* White text */
  border: none; /* No border */
  font-family: "Press Start 2P", cursive;
  font-size: 8px;
  cursor: pointer; /* Show hand cursor on hover */
  transition: all 0.3s ease; /* Smooth transitions for all properties */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}

/* TOOLTIPS */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: #333;
  color: #fff;
  border-radius: 4px;
  font-size: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  margin-bottom: 8px;
}

[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-bottom: 2px;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}

/* SIDE PANEL */
.side-panel {
  position: fixed; /* Stays in place even when scrolling */
  top: 0; /* Starts at the top of the page */
  left: 0; /* Aligns to the left edge */
  width: 250px; /* Adjust width as needed */
  height: 100vh; /* Spans full viewport height */
  font-family: "Syne Mono", monospace;
  color: var(--sidebar-text-color);
  background: var(--sidebar-color);
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1); /* Optional: subtle shadow */
  transform: translateX(-100%); /* Hide by default (off-screen) */
  transition: transform 0.3s ease; /* Smooth slide-in animation */
  z-index: 1000; /* Ensures it appears above other content */
}

/* Show panel when active */
.side-panel.active {
  transform: translateX(0); /* Slide in */
}

/* Close button styling */
.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  float: right; /* Aligns to the top-right corner */
}

/* Panel content styling */
.panel-content {
  margin-top: 20px;
}

/* BUTTON STYLES IN DARK MODE */
body.dark-mode .toggle-btn,
body.dark-mode .redact-btn {
  background: #f0f0f0; /* Light background in dark mode */
  color: #121212; /* Dark text in dark mode */
}

/* BUTTON HOVER EFFECTS */
.toggle-btn:hover,
.redact-btn:hover {
  transform: scale(1.05); /* Slightly enlarge the button */
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2); /* More pronounced shadow */
}

/* PLACEHOLDER TEXT STYLES IN TEXT FIELDS */
#clipboardIn:empty::before,
#redactPatterns:empty::before {
  content: attr(placeholder); /* Show the placeholder attribute content */
  color: #666; /* Gray color */
  font-style: italic; /* Italic text */
}

/* Hide the mobile blocker on desktop */
.mobile-block {
  display: none;
}

/* MOBILE FIX */
@media (max-width: 768px) {
  .mobile-block {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: #000000;
    color: #f0f0f0;
  }

  /* Hide everything else */
  body > *:not(.mobile-block) {
    display: none !important;
  }
}
