/* Editor page styles */

/* LAYOUT */
.editor-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

@media (max-width: 768px) {
  .editor-layout {
    grid-template-columns: 1fr;
    padding: 32px 20px;
    gap: 40px;
  }
}

/* NAV */
.nav-back {
  margin-left: auto;
  font-size: 14px;
  color: var(--fg-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--fg); }

/* INPUT PANEL */
.panel-header { margin-bottom: 36px; }
.editor-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--fg);
  margin: 12px 0 8px;
  letter-spacing: -0.5px;
}
.editor-sub {
  font-size: 14px;
  color: var(--fg-2);
  font-weight: 300;
}

/* FORM */
.render-form { display: flex; flex-direction: column; gap: 24px; }

.field-group { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: 0.3px;
}
.label-icon { font-size: 14px; }
.char-count { margin-left: auto; font-size: 11px; color: var(--fg-3); font-weight: 400; }

.script-textarea,
.character-textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding: 14px 16px;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.script-textarea:focus,
.character-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.script-textarea::placeholder,
.character-textarea::placeholder { color: var(--fg-3); font-size: 13px; }

/* RENDER BUTTON */
.render-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: #0f1623;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
}
.render-btn:hover:not(:disabled) { background: #fbbf24; transform: translateY(-1px); }
.render-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-icon { font-size: 16px; }

/* ERROR BOX */
.error-box {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: #fca5a5;
  margin-top: -8px;
}
.hidden { display: none !important; }

/* PREVIEW PANEL */
.preview-header { margin-bottom: 28px; }
.preview-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--fg);
  margin-top: 10px;
}

/* EMPTY / LOADING / RESULT shared phone */
.preview-empty,
.preview-loading,
.preview-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.preview-hint,
.loading-hint,
.result-hint {
  font-size: 13px;
  color: var(--fg-3);
  text-align: center;
}

/* Phone frame */
.phone-frame {
  width: 220px;
  background: var(--bg-card);
  border-radius: 28px;
  border: 3px solid var(--surface);
  padding: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 40px var(--accent-glow);
}
.phone-notch {
  width: 80px; height: 20px;
  background: var(--surface);
  border-radius: 0 0 10px 10px;
  margin: 0 auto 8px;
}
.phone-screen {
  background: linear-gradient(160deg, #0d1927, #111d2e);
  border-radius: 18px;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Screen states */
.screen-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--fg-3);
}
.placeholder-icon { font-size: 40px; opacity: 0.5; }
.screen-placeholder p { font-size: 12px; }

/* Loading / generating screen */
.generating-screen {
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}
.gen-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--surface);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gen-label {
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 500;
}
.gen-progress {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.gen-bar {
  flex: 1;
  height: 5px;
  background: var(--surface);
  border-radius: 5px;
  overflow: hidden;
}
.gen-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #fbbf24);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.gen-pct {
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

/* Result screen */
.result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
}

/* Result actions */
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: transform 0.15s, background 0.15s;
}
.action-btn:hover { transform: translateY(-1px); }
.action-btn.primary {
  background: var(--accent);
  color: #0f1623;
}
.action-btn.secondary {
  background: var(--surface);
  color: var(--fg-2);
  border: 1px solid var(--border);
}

/* Field label + chips row */
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Example chips */
.example-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--surface);
  color: var(--fg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Recent renders strip */
.renders-strip {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  margin-top: 8px;
}
.renders-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.renders-list { display: flex; flex-direction: column; gap: 8px; }
.render-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.render-item:hover { background: var(--bg-card-hover); }
.render-thumb {
  width: 36px;
  height: 64px;
  border-radius: 4px;
  background: linear-gradient(160deg, #0d1927, #111d2e);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  overflow: hidden;
}
.render-thumb img { width: 100%; height: 100%; object-fit: cover; }
.render-info { flex: 1; min-width: 0; }
.render-script-preview {
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.render-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.status-dot.completed { background: #28c840; }
.status-dot.failed { background: #ef4444; }
.status-dot.pending, .status-dot.generating { background: var(--accent); animation: pulse 1.5s ease-in-out infinite; }
.status-text { font-size: 10px; color: var(--fg-3); }
.render-time { font-size: 10px; color: var(--fg-3); margin-left: auto; }

/* Inline video display */
.video-player {
  width: 100%;
  aspect-ratio: 9/16;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.video-player video, .video-player img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Better result screen */
.result-video-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
}

/* Download-in-progress state */
.action-btn[data-downloading] {
  opacity: 0.75;
  pointer-events: none;
  cursor: not-allowed;
}

.dl-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(15, 22, 35, 0.3);
  border-top-color: #0f1623;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}