/* ET+ AI Tutor — prompt history popover styles (Phase 4 / 4.4).
 *
 * Discoverable 🕒 Recent button + slide-up popover. Brand-aligned
 * with the same cyberpunk-futuristic shell.
 */

.etp-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-left: 8px;
  background: rgba(0, 200, 255, 0.07);
  border: 1px solid rgba(0, 200, 255, 0.32);
  color: #C7D0E0;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.etp-history-btn:hover,
.etp-history-btn:focus-visible {
  background: rgba(0, 200, 255, 0.18);
  border-color: #00C8FF;
  color: #E5F3FF;
}
.etp-history-btn__label { font-size: 12px; letter-spacing: 0.04em; }

.etp-history-btn--floating {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  box-shadow: 0 4px 24px rgba(0, 200, 255, 0.20);
}

.etp-history-panel {
  position: fixed;
  right: 18px;
  bottom: 70px;
  z-index: 1001;
  width: 360px;
  max-width: calc(100vw - 36px);
  max-height: 70vh;
  background: #061224;
  border: 1px solid rgba(0, 200, 255, 0.32);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 24px rgba(0, 200, 255, 0.18);
  color: #C7D0E0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.etp-history-panel[aria-hidden="false"] {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.etp-history-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.18);
  background: rgba(0, 200, 255, 0.05);
}
.etp-history-panel__head h2 {
  flex: 1;
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #00C8FF;
}
.etp-history-clear,
.etp-history-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: inherit;
  border-radius: 999px;
  padding: 2px 10px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.etp-history-close { padding: 2px 8px; font-size: 14px; line-height: 1; }
.etp-history-clear:hover, .etp-history-close:hover { border-color: #00C8FF; color: #00C8FF; }

.etp-history-panel__list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 200, 255, 0.32) transparent;
}
.etp-history-panel__hint {
  margin: 0;
  padding: 8px 12px;
  font-size: 11px;
  color: #6E7B8F;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.25);
}

.etp-history-item {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(0, 200, 255, 0.04);
  border: 1px solid rgba(0, 200, 255, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 4px 2px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: background 150ms ease, border-color 150ms ease;
}
.etp-history-item:hover,
.etp-history-item:focus-visible {
  background: rgba(0, 200, 255, 0.10);
  border-color: rgba(0, 200, 255, 0.55);
}

.etp-history-item__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
  color: #6E7B8F;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.04em;
}
.etp-history-item__time { text-transform: uppercase; }
.etp-history-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(199, 146, 234, 0.14);
  color: #C792EA;
}
.etp-history-tag--mode { background: rgba(0, 255, 136, 0.12); color: #00FF88; }

.etp-history-item__prompt {
  font-size: 13px;
  line-height: 1.4;
  color: #E5F3FF;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.etp-history-item__reply {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: #8A99B3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.etp-history-empty {
  margin: 14px;
  padding: 12px;
  font-size: 13px;
  text-align: center;
  color: #6E7B8F;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.10);
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .etp-history-btn,
  .etp-history-panel,
  .etp-history-item { transition: none; }
}
