/* ============================================================
   DecEptioner — Rewrite history drawer
   Loaded on the homepage and the AI humanizer page, AFTER style.css
   and the page CSS, so it overrides the old .history-* rules there.
   Markup is built by js/homepageToggleHistory.js (`.hist-*` classes).
   ============================================================ */

.history-panel {
  position: fixed;
  top: 0;
  left: -380px;
  width: 380px;
  max-width: 88vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1b1b20, #141417);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 24px 0 60px -22px rgba(0, 0, 0, 0.75);
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  font-family: "Poppins", system-ui, sans-serif;
}
.history-panel.open { left: 0; }

/* --- header --- */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.history-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}
.hist-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #c9b8ff;
  background: rgba(132, 94, 247, 0.15);
  border: 1px solid rgba(132, 94, 247, 0.3);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  min-width: 1.4rem;
  text-align: center;
}
.hist-count:empty { display: none; }

.close-history {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  color: #cfcfe0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.close-history i { margin: 0; }
.close-history:hover {
  background: rgba(255, 93, 115, 0.16);
  color: #ff5d73;
  border-color: rgba(255, 93, 115, 0.6);
}

/* --- search --- */
.hist-search {
  position: relative;
  margin: 1rem 1.25rem 0.35rem;
}
.hist-search i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #7d7c89;
  font-size: 0.85rem;
  margin: 0;
  pointer-events: none;
}
.hist-search input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.3rem;
  background: #0f0f12;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  color: #f3f2f7;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.hist-search input::placeholder { color: #6f6e7a; }
.hist-search input:focus {
  border-color: #845ef7;
  box-shadow: 0 0 0 3px rgba(132, 94, 247, 0.18);
}

.history-info {
  color: #7d7c89;
  font-size: 0.76rem;
  margin: 0.55rem 1.25rem 0.25rem;
  line-height: 1.4;
}

/* --- scrollable list --- */
.history-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 1.25rem 1.5rem;
  color: #f3f2f7;
}

/* --- date divider (encodes the day grouping) --- */
.hist-date {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.15rem 0 0.65rem;
}
.hist-date:first-child { margin-top: 0.4rem; }
.hist-date span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #9b9aa6;
  white-space: nowrap;
}
.hist-date::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

/* --- entry card --- */
.hist-card {
  background: #202026;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 0.95rem;
  margin-bottom: 0.7rem;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.hist-card:hover {
  border-color: rgba(132, 94, 247, 0.4);
  background: #24242b;
  transform: translateY(-1px);
}

.hist-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.hist-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #c9b8ff;
  background: rgba(132, 94, 247, 0.14);
  border: 1px solid rgba(132, 94, 247, 0.28);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.hist-chip i { margin: 0; }
.hist-read {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  font-size: 0.72rem;
  color: #8a8995;
}
.hist-read i { margin: 0; }
.hist-read b { color: #cfcfe0; font-weight: 600; }

.hist-row { margin-bottom: 0.55rem; }
.hist-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.hist-label .dot { width: 6px; height: 6px; border-radius: 50%; }
.hist-label.is-orig { color: #ff8a98; }
.hist-label.is-orig .dot { background: #ff5d73; }
.hist-label.is-human { color: #43d9a3; }
.hist-label.is-human .dot { background: #34d399; }
.hist-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #bdbcc9;
  word-break: break-word;
}
.hist-text.is-human { color: #e7e6ee; }
.hist-hl {
  background: rgba(132, 94, 247, 0.38);
  color: #fff;
  border-radius: 3px;
  padding: 0 0.1em;
}

.hist-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.hist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}
.hist-btn i { margin: 0; }
.hist-restore {
  flex: 1;
  background: linear-gradient(135deg, #845ef7, #9d7bff);
  color: #11071f;
}
.hist-restore:hover { filter: brightness(1.08); }
.hist-copy {
  flex: 0 0 auto;
  width: 42px;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #c9b8ff;
}
.hist-copy:hover {
  background: rgba(132, 94, 247, 0.16);
  border-color: #845ef7;
  color: #fff;
}
.hist-copy.copied { color: #34d399; border-color: rgba(52, 211, 153, 0.6); }

/* --- empty / no-results state --- */
.hist-empty {
  text-align: center;
  padding: 3rem 1.25rem;
  color: #7d7c89;
}
.hist-empty i {
  display: block;
  font-size: 1.7rem;
  color: #4a4a55;
  margin: 0 0 0.85rem;
}
.hist-empty h4 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: #cfcfe0;
}
.hist-empty p {
  margin: 0 auto;
  font-size: 0.83rem;
  line-height: 1.55;
  max-width: 26ch;
}

/* ============================================================
   Toggle button that OPENS the drawer
   Replaces the dated solid-purple block from style.css with a
   refined glassy icon button matching the drawer's .close-history.
   ============================================================ */
.history-button {
  width: 42px;
  height: 42px;
  padding: 0;
  margin-left: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(132, 94, 247, 0.12);
  color: #c9b8ff;
  border: 1px solid rgba(132, 94, 247, 0.32);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.history-button i { margin: 0; font-size: 1rem; }
.history-button:hover {
  background: rgba(132, 94, 247, 0.22);
  border-color: #845ef7;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -10px rgba(132, 94, 247, 0.8);
}

/* ============================================================
   "copied!" toast on the Copy Output button
   Floats above the button (position:absolute inside .gen-text)
   so showing it no longer reflows / pushes the textarea up.
   Keeps style.css's display:none so JS can toggle visibility.
   ============================================================ */
#custom-tooltip {
  position: absolute;
  left: 50%;
  bottom: 4.25rem;
  transform: translateX(-50%);
  margin-left: 0;
  padding: 0.4rem 0.85rem;
  background: linear-gradient(135deg, #845ef7, #9d7bff);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 8px 24px -8px rgba(132, 94, 247, 0.7);
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}

/* clear the mobile top bar / notch when the drawer is open */
@media only screen and (max-width: 800px) {
  .history-header { padding-top: 3rem; }
  .history-button { margin-left: 0; }
}
