/* History Section Specific Styles */

/* History Header */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history-header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.history-header .search-container {
  flex: 1;
  margin: 0;
}

.export-btn,
.import-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
  white-space: nowrap;
}

.export-btn:hover,
.import-btn:hover {
  background: #2563eb;
}

.clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--danger);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
  white-space: nowrap;
}

.clear-btn:hover {
  background: #dc2626;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

/* Hover effect removed to avoid blue background
.history-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
} */

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.history-item-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.history-item-action-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: scale(1.05);
}

.history-item-action-btn:active {
  transform: scale(0.95);
}

.history-delete-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.history-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.history-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

.history-url {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-detections {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.history-timestamp {
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  opacity: 0.8;
  white-space: nowrap;
}

.history-detection-tag {
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}

.history-detection-tag.more-detections {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* History Detail Modal */
.history-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.history-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.history-modal-container {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.history-modal-title-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.history-modal-favicon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
}

.history-modal-title-info {
  flex: 1;
  min-width: 0;
}

.history-modal-title-info h3 {
  margin: 0 0 4px 0;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-modal-url {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.history-modal-url:hover {
  text-decoration: underline;
}

.history-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.history-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.history-modal-meta-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.history-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-modal-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.history-modal-action-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.history-modal-action-btn:active {
  transform: translateY(0);
}

.history-modal-action-btn svg {
  flex-shrink: 0;
}

.history-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

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

.history-modal-content::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.history-modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.history-modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.history-modal-detection-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.history-modal-detection-card:last-child {
  margin-bottom: 0;
}

.history-modal-detection-card.has-methods .history-modal-detection-header {
  cursor: pointer;
  transition: all 0.2s;
  padding: 2px;
  margin: -2px;
  border-radius: 6px;
}

.history-modal-detection-card.has-methods .history-modal-detection-header:hover {
  background: rgba(33, 150, 243, 0.08);
}

.history-modal-detection-card.has-methods:hover {
  border-color: rgba(33, 150, 243, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-modal-detection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-modal-detection-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.history-modal-detection-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-modal-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.history-modal-confidence {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 48px;
  text-align: center;
}

.history-modal-confidence.confidence-high {
  background: #10b981;
  color: white;
}

.history-modal-confidence.confidence-medium {
  background: #f59e0b;
  color: white;
}

.history-modal-confidence.confidence-low {
  background: #ef4444;
  color: white;
}

.history-modal-expand-icon {
  margin-left: 4px;
  font-size: 12px;
  transition: transform 0.2s;
  color: var(--text-muted);
  flex-shrink: 0;
}

.history-modal-detection-card.expanded .history-modal-expand-icon {
  transform: rotate(180deg);
}

.history-modal-detection-methods {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.history-modal-detection-card.expanded .history-modal-detection-methods {
  display: flex;
}

.history-modal-method-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s;
}

.history-modal-method-item:hover {
  background: var(--bg-secondary);
  border-color: rgba(33, 150, 243, 0.2);
  transform: translateX(2px);
}

.history-modal-method-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.history-modal-method-value {
  flex: 1;
  font-size: 11px;
  color: var(--text-primary);
  font-family: 'Monaco', 'Courier New', monospace;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.history-modal-method-confidence {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 42px;
  text-align: center;
}

.history-modal-method-confidence.confidence-high {
  background: #10b981;
  color: white;
}

.history-modal-method-confidence.confidence-medium {
  background: #f59e0b;
  color: white;
}

.history-modal-method-confidence.confidence-low {
  background: #ef4444;
  color: white;
}

.history-modal-empty,
.history-modal-no-methods {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Empty State */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}