/* Extracted from index.html. Generate history modal styles. */

.generate-history-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.generate-history-modal.show {
  display: flex;
  pointer-events: auto;
}
body.generate-history-open {
  overflow: hidden;
}
.generate-history-backdrop {
  position: absolute;
  inset: 0;
}
.generate-history-card {
  position: relative;
  width: min(68vw, 980px);
  height: min(88vh, 900px);
  min-height: 640px;
  max-width: 980px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
html.theme-dark .generate-history-card {
  border-color: rgba(255, 255, 255, 0.08);
}
.generate-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 44px 12px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
html.theme-dark .generate-history-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.generate-history-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.generate-history-count {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.generate-history-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: #ff5c60;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.generate-history-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 150px) minmax(110px, 140px);
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
html.theme-dark .generate-history-toolbar {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.generate-history-search,
.generate-history-select {
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  min-width: 0;
}
html.theme-dark .generate-history-search,
html.theme-dark .generate-history-select {
  border-color: rgba(255, 255, 255, 0.14);
}
.generate-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.generate-history-item {
  display: block;
}
.generate-history-item-box {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg);
  display: grid;
  grid-template-columns: minmax(0, 580px) 348px;
  grid-template-areas:
    "left right";
  gap: 12px;
  align-items: stretch;
  margin: 0 auto;
}
html.theme-dark .generate-history-item-box {
  border-color: rgba(255, 255, 255, 0.1);
}
.generate-history-item-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.generate-history-item-uploads {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  max-width: 580px;
}
.generate-history-upload-slot,
.generate-history-item-uploads img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.generate-history-upload-slot.empty::after,
.generate-history-item-results .result-slot.empty::after {
  content: "";
  display: block;
  width: 26%;
  height: 26%;
  min-width: 22px;
  min-height: 22px;
  border: 1px dashed rgba(0, 0, 0, 0.24);
  border-radius: 5px;
}
.generate-history-item-meta {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px 0;
}
.generate-history-prompt-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 108px;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}
.generate-history-item-prompt {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  line-height: 1.45;
  cursor: pointer;
}
.generate-history-item-right {
  grid-area: right;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
  align-content: start;
  min-width: 0;
  width: 348px;
  max-width: 348px;
  position: relative;
}
.generate-history-item-results {
  display: contents;
}
.generate-history-item-results .result-slot {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  max-height: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.generate-history-item-results .result-slot:not(.empty) {
  cursor: pointer;
}
.generate-history-item-results .result-slot .gh-slot-download {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: var(--blue);
  color: #1d1d1f;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}
.generate-history-item-results .result-slot:not(.empty):hover .gh-slot-download {
  display: flex;
}
.generate-history-item-results .result-slot .gh-slot-download:hover {
  background: #e5e3dd;
}
html.theme-dark .generate-history-item-results .result-slot {
  background: rgba(255, 255, 255, 0.08);
}
.generate-history-item-results .result-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.generate-history-item-results .result-slot.processing::after,
.generate-history-item-results .result-slot.failed::after {
  display: none;
}
.generate-history-item-results .result-slot.processing span,
.generate-history-item-results .result-slot.failed span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.generate-history-item-results .result-slot.processing span::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto 8px;
  border: 2px solid rgba(0, 0, 0, 0.14);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: generate-history-spin 0.8s linear infinite;
}
html.theme-dark .generate-history-item-results .result-slot.processing span::before {
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: currentColor;
}
@keyframes generate-history-spin {
  to { transform: rotate(360deg); }
}
html.theme-dark .generate-history-item-results .result-slot.empty::after {
  border-color: rgba(255, 255, 255, 0.25);
}
.generate-history-item-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
}
.generate-history-item-actions button {
  width: auto;
  height: 36px;
  min-height: 0;
  min-width: 88px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  background: #F0EEE9;
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.generate-history-item-actions button:hover {
  background: #e5e2dc;
  transform: scale(1.02);
}
.generate-history-item-actions button:active {
  transform: scale(0.96);
}
html.theme-dark .generate-history-item-actions button {
  background: #F0EEE9;
  color: #1d1d1f;
}
html.theme-dark .generate-history-item-actions button:hover {
  background: #e5e2dc;
}
.generate-history-item-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0;
}
.generate-history-item-side-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 400;
  opacity: 0.5;
  word-break: break-word;
}
.generate-history-item-side-meta .gh-meta-line {
  display: block;
}
.generate-history-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 900px) {
  .generate-history-card {
    width: 94vw;
    min-height: 0;
  }
  .generate-history-toolbar {
    grid-template-columns: 1fr;
  }
  .generate-history-item-box {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "right";
    align-items: stretch;
  }
  .generate-history-item-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
  }
  .generate-history-item-foot {
    align-items: flex-end;
  }
}
