/* Result, download, copy, and task detail surfaces. */

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin-top: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--creator-red);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.download-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.download-icon-button.with-text {
  width: auto;
  gap: 7px;
  padding: 0 12px;
  font-size: 15px;
}

.download-icon-button.with-text span {
  font-size: 13px;
  font-weight: 700;
}

.result-download {
  margin-top: 14px;
}

.result-state-user-friendly {
  border: 1px solid #fed7aa;
  background: #fff7ed;
}

.result-state-user-friendly p {
  max-width: 720px;
  color: #7c2d12;
}

.partial-result-grid {
  margin-top: 16px;
}

.retry-task-button {
  width: auto;
  min-width: 128px;
  margin-top: 14px;
  padding: 0 18px;
}

.result-image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.result-image {
  display: grid;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: zoom-in;
}

.result-image img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid #f0d9de;
  border-radius: 8px;
  background: #fff;
}

.result-image span {
  color: #555;
  font-size: 12px;
  line-height: 1.35;
}

.result-copy {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #f0d9de;
  border-radius: 8px;
  background: #fff;
}

.result-copy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.copy-field {
  display: grid;
  gap: 6px;
}

.copy-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.copy-field-head span {
  color: #555;
  font-size: 12px;
  font-weight: 700;
}

.copy-box {
  max-height: 132px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #f2e1e4;
  border-radius: 7px;
  background: #fff8f9;
  color: #555;
  font-size: 13px;
  line-height: 1.6;
  white-space: normal;
}

.copy-field-body .copy-box {
  max-height: 220px;
}

.mini-action {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.mini-action.danger {
  border-color: #fed7aa;
  color: var(--danger);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 24px;
}

.lightbox.is-open {
  display: grid;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.58);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.lightbox-head button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.lightbox-panel.image-panel {
  width: min(620px, calc(100vw - 32px));
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.lightbox-panel.image-panel img {
  max-width: 100%;
  max-height: min(70vh, 720px);
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  background: #f6f6f7;
}

.lightbox-panel.image-panel .download-link {
  justify-self: center;
  margin: 0 0 14px;
}

.admin-task-detail {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.admin-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.admin-task-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafafa;
  color: #555;
  font-size: 12px;
}

.admin-task-meta b {
  color: var(--ink);
}

.admin-task-note {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff7f7;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.5;
}

.admin-task-detail .result-image-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.task-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}

.task-detail-actions .download-link {
  margin-top: 0;
}

@media (max-width: 720px) {
  .result-image-grid,
  .admin-task-detail .result-image-grid {
    grid-template-columns: 1fr;
  }

  .lightbox {
    padding: 12px;
  }

  .lightbox-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}
