/* === Share Overlay === */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: shareOverlayIn 0.3s ease;
}

.share-overlay.active {
  display: flex;
}

@keyframes shareOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.share-modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--primary);
}

.share-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.share-close-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.share-preview {
  text-align: center;
  margin-bottom: 20px;
}

.share-preview img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.share-actions {
  display: flex;
  gap: 12px;
}

.share-actions .btn-action {
  flex: 1;
}

.btn-download {
  background: linear-gradient(135deg, var(--primary), #b8860b);
  color: #000;
  font-weight: 700;
}

.btn-download:hover {
  box-shadow: 0 6px 24px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-clipboard {
  background: var(--card);
  border: 1px solid var(--border) !important;
  color: var(--text);
}

.btn-clipboard:hover {
  border-color: var(--primary) !important;
  color: var(--primary);
}

/* === History Panel === */
.history-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 150;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.history-panel.active {
  right: 0;
}

.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 149;
  display: none;
}

.history-backdrop.active {
  display: block;
}

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

.history-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
}

.history-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.history-close:hover {
  color: var(--text);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.history-item {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--primary);
}

.history-item-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-item-verdict {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  white-space: nowrap;
}

.history-item-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.history-delete {
  position: relative;
  float: right;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
}

.history-item:hover .history-delete { opacity: 1; }
.history-delete:hover { color: var(--verdict-lose); background: rgba(239, 68, 68, 0.1); }

.history-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.btn-clear-all {
  width: 100%;
  padding: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: var(--verdict-lose);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear-all:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* === Hidden render container for share card === */
#share-render-container {
  position: fixed;
  top: -9999px;
  left: -9999px;
  pointer-events: none;
  z-index: -1;
}

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

  .share-modal {
    max-width: 100%;
    border-radius: 12px;
  }

  .share-actions {
    flex-direction: column;
  }
}
