/* Extracted from index.html. Reverse prompt result modal and loading indicator styles. */

@keyframes reverse-btn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.icon-btn.reverse-loading {
  opacity: 1 !important;
  animation: reverse-btn-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
}

.reverse-result-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: contain;
}
.reverse-result-modal.show {
  display: flex;
}
.reverse-result-stack {
  position: relative;
  z-index: 1;
  width: min(1100px, 92vw);
  max-height: 90vh;
}
.reverse-result-references {
  position: absolute;
  left: 28px;
  bottom: calc(100% + 12px);
  width: calc(100% - 56px);
  z-index: 2;
}
.reverse-result-reference-list {
  display: flex;
  gap: 8px;
  min-height: 66px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px;
  scrollbar-width: none;
}
.reverse-result-reference-list::-webkit-scrollbar {
  display: none;
}
.reverse-result-reference-item {
  position: relative;
  flex: 0 0 66px;
  width: 66px;
  height: 66px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: var(--soft);
}
.reverse-result-reference-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.reverse-result-reference-index {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
html.theme-dark .reverse-result-reference-item {
  border-color: rgba(255, 255, 255, 0.1);
  background: #242424;
}
.reverse-result-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.reverse-result-card {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.14);
  padding: 8px 16px 12px;
  z-index: 1;
}
.reverse-result-modal.has-reference-images .reverse-result-stack {
  max-height: calc(90vh - 96px);
}
.reverse-result-modal.has-reference-images .reverse-result-card {
  max-height: inherit;
}
@media (max-width: 760px) {
  .reverse-result-stack {
    width: 94vw;
  }
  .reverse-result-references {
    left: 16px;
    bottom: calc(100% + 10px);
    width: calc(100% - 32px);
  }
  .reverse-result-reference-item {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
  }
}
.reverse-result-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: #ff5c60;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  padding: 0;
  transform: scale(1);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.reverse-result-close:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  filter: brightness(1.03);
}
.reverse-result-close:active {
  transform: scale(1.14);
}
html.theme-dark .reverse-result-card {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.reverse-result-body {
  display: flex;
  gap: 28px;
  align-items: stretch;
}
.reverse-result-image {
  flex: 0 0 auto;
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  margin-top: 6px;
}
.reverse-result-img {
  display: block;
  max-width: 460px;
  max-height: 460px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
}
.reverse-result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 360px;
  box-sizing: border-box;
}
.reverse-result-status {
  font-size: 13px;
  color: var(--muted);
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes reverse-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}
.reverse-loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.reverse-loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: reverse-dot-bounce 1.2s ease-in-out infinite;
}
.reverse-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.reverse-loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes reverse-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.reverse-result-textarea {
  width: 100%;
  min-height: 360px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.7;
  padding: 14px;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.3s ease;
}
.reverse-result-textarea.shimmer {
  background: linear-gradient(90deg, var(--soft) 30%, rgba(99,102,241,0.06) 50%, var(--soft) 70%);
  background-size: 800px 100%;
  animation: reverse-shimmer 2s ease-in-out infinite;
}
html.theme-dark .reverse-result-textarea.shimmer {
  background: linear-gradient(90deg, #242424 30%, rgba(139,92,246,0.08) 50%, #242424 70%);
  background-size: 800px 100%;
}
.reverse-result-textarea:focus {
  border-color: #F0EEE9;
}
html.theme-dark .reverse-result-textarea {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
}
html.theme-dark .reverse-result-textarea:focus {
  border-color: rgba(255, 255, 255, 0.2);
}
.reverse-result-textarea-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.reverse-result-textarea-wrap .reverse-result-textarea {
  position: relative;
  z-index: 1;
  background: transparent !important;
  flex: 1;
}
.reverse-result-textarea-wrap {
  background: var(--soft);
  border-radius: 12px;
}
html.theme-dark .reverse-result-textarea-wrap {
  background: #242424;
}
.reverse-result-highlight-layer {
  position: absolute;
  inset: 0;
  padding: 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: normal;
  color: transparent;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  pointer-events: none;
  border-radius: 12px;
  border: 1px solid transparent;
  box-sizing: border-box;
  z-index: 0;
}
.reverse-result-highlight-layer mark {
  background: rgba(254, 188, 46, 0.45);
  color: transparent;
  border-radius: 2px;
}
html.theme-dark .reverse-result-highlight-layer mark {
  background: rgba(254, 188, 46, 0.5);
}
.reverse-replace-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
}
.reverse-replace-find,
.reverse-replace-to {
  flex: 0 1 140px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.reverse-replace-find:focus,
.reverse-replace-to:focus {
  border-color: #F0EEE9;
}
html.theme-dark .reverse-replace-find,
html.theme-dark .reverse-replace-to {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
}
html.theme-dark .reverse-replace-find:focus,
html.theme-dark .reverse-replace-to:focus {
  border-color: rgba(255, 255, 255, 0.2);
}
.reverse-replace-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, color 0.15s ease;
}
.reverse-replace-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}
.reverse-replace-btn:active {
  transform: scale(0.96);
}
html.theme-dark .reverse-replace-btn {
  border-color: rgba(255, 255, 255, 0.1);
}
html.theme-dark .reverse-replace-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.reverse-replace-btn + .reverse-result-confirm {
  margin-left: auto;
}
.reverse-result-confirm {
  height: 34px;
  min-width: 88px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--blue);
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.reverse-result-confirm:hover:not(:disabled) {
  background: #e5e3dd;
}
.reverse-result-confirm:active:not(:disabled) {
  transform: scale(0.96);
}
.reverse-result-confirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
