/* Generation History - Right Panel Work History */
/* Replaces settings panel with work history */
/* Settings open as overlay instead of shifting layout */
/* Applied: 2026-10-17 */

.gen-history-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--nd-line);
  background: var(--nd-surface);
  width: 300px;
}

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

.gen-history-header h2 {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  color: var(--nd-text);
}

.gen-history-count {
  font-size: 10px;
  color: var(--nd-text-secondary);
  padding: 2px 6px;
  background: var(--nd-surface-raised);
  border-radius: 10px;
}

/* History filters */
.gen-history-filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--nd-line);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gen-history-search {
  width: 100%;
  padding: 6px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.gen-history-tabs {
  display: flex;
  gap: var(--space-xs);
}

.gen-history-tab {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--nd-line);
  border-radius: var(--radius-sm);
  background: var(--nd-surface);
  font-size: 10px;
  text-align: center;
  color: var(--nd-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gen-history-tab:hover {
  border-color: var(--nd-line-strong);
  background: var(--nd-surface-raised);
}

.gen-history-tab.active {
  background: var(--nd-accent-bg);
  border-color: var(--nd-accent);
  color: var(--nd-accent);
}

/* History list */
.gen-history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--mono-gray-700) transparent;
}

/* History item card */
.gen-history-item {
  border: 1px solid var(--nd-line);
  border-radius: var(--radius-md);
  background: var(--nd-surface);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gen-history-item:hover {
  border-color: var(--nd-line-strong);
  background: var(--nd-surface-raised);
}

.gen-history-item.active {
  border-color: var(--nd-accent);
  background: var(--nd-accent-bg);
}

.gen-history-item-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--mono-black);
  position: relative;
  overflow: hidden;
}

.gen-history-item-thumb video,
.gen-history-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gen-history-item-status {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-sm);
  font-size: 8px;
  color: var(--mono-white);
  backdrop-filter: blur(4px);
}

.gen-history-item-info {
  padding: 8px 10px;
}

.gen-history-item-prompt {
  font-size: 11px;
  line-height: 1.4;
  color: var(--nd-text);
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gen-history-item-meta {
  font-size: 9px;
  color: var(--nd-text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Settings overlay */
.gen-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  padding: var(--space-xl);
  animation: fadeIn 0.2s ease;
}

.gen-settings-overlay[hidden] {
  display: none;
}

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

.gen-settings-overlay-dialog {
  background: var(--nd-surface);
  border: 1px solid var(--nd-line-strong);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gen-settings-overlay-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--nd-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gen-settings-overlay-header h2 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.gen-settings-overlay-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--nd-line);
  border-radius: var(--radius-sm);
  background: var(--nd-surface);
  color: var(--nd-text);
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gen-settings-overlay-close:hover {
  border-color: var(--nd-line-strong);
  background: var(--nd-surface-raised);
}

.gen-settings-overlay-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--mono-gray-700) transparent;
}

.gen-settings-overlay-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--nd-line);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Empty state */
.gen-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  color: var(--nd-text-secondary);
  flex: 1;
}

.gen-history-empty h3 {
  font-size: 13px;
  margin: 0 0 var(--space-xs);
  color: var(--nd-text);
}

.gen-history-empty p {
  font-size: 10px;
  margin: 0;
}

/* Mobile responsive */
@media (max-width: 1180px) {
  .gen-history-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
  }

  .gen-history-open .gen-history-panel {
    transform: translateX(0);
  }

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

  .gen-history-open .gen-history-scrim {
    display: block;
  }
}

@media (max-width: 720px) {
  .gen-history-panel {
    width: 100%;
    max-width: 320px;
  }

  .gen-settings-overlay {
    padding: var(--space-lg);
  }

  .gen-settings-overlay-dialog {
    max-width: 100%;
    max-height: 90vh;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gen-settings-overlay,
  .gen-settings-overlay-dialog,
  .gen-history-panel {
    animation: none;
    transition: none;
  }
}
