/* ==============================================
   RunPod Image Generator — Frontend Styles
   ============================================== */

/* ── Body lock when modal open ── */
body.runpod-modal-open {
  overflow: hidden;
}

/* ── Modal Overlay ── */
#runpod-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

#runpod-modal.active {
  display: flex;
}

/* ── Modal box ── */
#runpod-modal-inner {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 600px;
  margin: 16px;
  overflow: hidden;
  animation: runpodSlideUp 0.28s ease;
}

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

/* ── Modal Header ── */
#runpod-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#runpod-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

#runpod-modal-header h2 span {
  font-size: 20px;
  margin-right: 6px;
}

#runpod-modal-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}

#runpod-modal-close:hover {
  background: rgba(255,255,255,0.35);
}

/* ── Modal Body ── */
#runpod-modal-body {
  padding: 24px;
}

/* ── Prompt Row ── */
.runpod-prompt-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

#runpod-prompt-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  background: #fafafa;
}

#runpod-prompt-input:focus {
  border-color: #667eea;
  background: #fff;
}

#runpod-generate-btn {
  padding: 12px 22px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.1s;
  font-family: inherit;
}

#runpod-generate-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

#runpod-generate-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ── Spinner ── */
#runpod-spinner {
  display: none;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  color: #888;
}

.runpod-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  margin: 0 3px;
  animation: runpodBounce 1.2s infinite ease-in-out;
}
.runpod-dots span:nth-child(2) { animation-delay: 0.2s; }
.runpod-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes runpodBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1.1); opacity: 1;   }
}

/* ── Progress Bar ── */
#runpod-progress-wrap {
  display: none;
  margin-bottom: 14px;
  background: #f0f0f0;
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

#runpod-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* ── Status Message ── */
#runpod-status-msg {
  display: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}

#runpod-status-msg.runpod-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

#runpod-status-msg.runpod-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

#runpod-status-msg.runpod-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ── Image Preview ── */
#runpod-preview-wrap {
  display: none;
  margin-bottom: 18px;
  text-align: center;
}

#runpod-preview-wrap p {
  font-size: 12px;
  color: #888;
  margin: 8px 0 0;
}

#runpod-preview-img {
  max-width: 100%;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: block;
}

/* ── Action Buttons ── */
#runpod-action-btns {
  display: none;
  gap: 12px;
  flex-wrap: wrap;
}

.runpod-action-btns-inner {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.runpod-btn-download,
.runpod-btn-publish {
  flex: 1;
  min-width: 140px;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  font-family: inherit;
}

.runpod-btn-download {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #e0e0e0;
}

.runpod-btn-download:hover {
  background: #e8e8e8;
  transform: translateY(-1px);
}

.runpod-btn-publish {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #fff;
  border: 2px solid transparent;
}

.runpod-btn-publish:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17, 153, 142, 0.35);
}

.runpod-btn-publish:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── Success message after publish ── */
#runpod-success-msg {
  display: none;
  margin-top: 14px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  color: #166534;
  font-size: 14px;
  text-align: center;
}

#runpod-success-msg p {
  margin: 0 0 6px;
  font-weight: 600;
}

.runpod-view-gallery-link {
  display: inline-block;
  margin-top: 4px;
  color: #15803d;
  font-weight: 600;
  text-decoration: underline;
}

/* ================================
   GALLERY GRID (shortcode output)
================================ */

.runpod-gallery-section {
  margin: 40px 0;
}

.runpod-gallery-heading {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 10px;
}

.runpod-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--runpod-cols, 3), 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .runpod-gallery-grid { --runpod-cols: 2; }
}

@media (max-width: 560px) {
  .runpod-gallery-grid { --runpod-cols: 1; }
  .runpod-prompt-row { flex-direction: column; }
}

.runpod-gallery-item {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
  transition: transform 0.2s, box-shadow 0.2s;
  background: #fff;
  position: relative;
}

.runpod-gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
}

.runpod-gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.runpod-gallery-caption {
  padding: 10px 12px;
  font-size: 13px;
  color: #555;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runpod-gallery-date {
  font-size: 11px;
  color: #aaa;
  padding: 0 12px 10px;
}

.runpod-gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: #aaa;
}

.runpod-gallery-empty p {
  font-size: 15px;
  margin-bottom: 16px;
}

/* ── Inline Widget (shortcode) ── */
.runpod-inline-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.runpod-inline-widget .runpod-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  font-family: inherit;
}

.runpod-inline-widget .runpod-trigger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── Floating trigger button (auto-injected near image fields) ── */
.runpod-image-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff !important;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
  transition: opacity 0.2s;
  text-decoration: none !important;
}

.runpod-image-trigger-btn:hover {
  opacity: 0.88;
}
