/* ===== History Panel Overlay ===== */
.history-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(10, 14, 26, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== History Panel Sidebar ===== */
.history-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: #fff;
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 401;
}

.history-overlay.active + .history-panel,
.history-panel.active {
  transform: translateX(0);
}

/* ===== Panel Header ===== */
.history-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(41, 121, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.history-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(41, 121, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.history-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.history-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}

/* ===== History List ===== */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: rgba(41, 121, 255, 0.15);
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(41, 121, 255, 0.25);
}

/* ===== History Item ===== */
.history-item {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.history-item:hover {
  background: rgba(41, 121, 255, 0.04);
  border-color: rgba(41, 121, 255, 0.1);
}

.history-item:last-child {
  margin-bottom: 0;
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.history-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
}

.history-item-menu {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
}

.history-item:hover .history-item-menu {
  opacity: 1;
}

.history-item-menu:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.history-item-summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-item-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-item-count {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Empty State ===== */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.history-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(41, 121, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.history-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.history-empty-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== Dropdown Menu ===== */
.history-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid rgba(41, 121, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 6px;
  min-width: 120px;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.history-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.history-dropdown-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-dropdown-item:hover {
  background: rgba(41, 121, 255, 0.06);
  color: var(--text-primary);
}

.history-dropdown-item.danger {
  color: #e53e3e;
}

.history-dropdown-item.danger:hover {
  background: rgba(229, 62, 62, 0.06);
}

/* ===== History Trigger Button ===== */
.btn-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background: rgba(41, 121, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-history:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(41, 121, 255, 0.08);
}

.btn-history-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .history-panel {
    width: 100%;
    max-width: 100vw;
  }

  .history-header {
    padding: 16px 20px;
  }

  .history-list {
    padding: 12px 12px 20px;
  }

  .history-item {
    padding: 12px 14px;
  }

  .btn-history span {
    display: none;
  }
}


