/* --- Creator Layout --- */

.creator-layout {
  width: min(1300px, 95vw);
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 1rem;
  min-height: 70vh;
}

/* --- Chat Panel --- */

.creator-chat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 80vh;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.5rem;
  min-height: 120px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.chat-msg {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: fadeSlide 200ms ease-out;
}

.chat-msg p { margin: 0 0 0.4rem; }
.chat-msg p:last-child { margin-bottom: 0; }

.chat-msg.system {
  background: rgba(70, 213, 255, 0.06);
  border: 1px solid rgba(70, 213, 255, 0.15);
  color: #d0e8f0;
}

.chat-msg.user {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  align-self: flex-end;
  max-width: 90%;
}

.chat-msg.assistant {
  background: rgba(139, 255, 125, 0.06);
  border: 1px solid rgba(139, 255, 125, 0.15);
  color: #c8f0c4;
}

.chat-msg.error {
  background: rgba(255, 79, 138, 0.08);
  border: 1px solid rgba(255, 79, 138, 0.2);
  color: #f0c4c4;
}

.chat-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.example-btn {
  background: rgba(70, 213, 255, 0.1) !important;
  border: 1px solid rgba(70, 213, 255, 0.25) !important;
  color: var(--cyan) !important;
  font-size: 0.78rem !important;
  padding: 0.28rem 0.55rem !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: background 120ms;
}

.example-btn:hover {
  background: rgba(70, 213, 255, 0.18) !important;
  transform: none;
  filter: none;
}

/* --- Chat Input --- */

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-size: 0.92rem;
}

.chat-input-row button[type="submit"] {
  min-width: 80px;
  height: 44px;
  position: relative;
}

.send-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #1a0f02;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chat-controls {
  display: flex;
  gap: 0.4rem;
}

.chat-controls button {
  flex: 1;
  font-size: 0.82rem;
  padding: 0.45rem 0.5rem;
}

/* --- Stage Panel --- */

.creator-stage {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 500px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stage-header h2 {
  font-size: 1.1rem;
  opacity: 0.85;
}

.stage-controls {
  display: flex;
  gap: 0.3rem;
}

.icon-btn {
  min-width: 36px !important;
  padding: 0.3rem !important;
  font-size: 1.1rem !important;
  text-align: center;
}

.iframe-wrap {
  flex: 1;
  position: relative;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #020305;
  overflow: hidden;
  min-height: 400px;
}

.iframe-wrap iframe {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  border: none;
  background: #000;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
}

/* --- Progress Bar --- */

.generation-progress {
  position: relative;
  height: 28px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(70, 213, 255, 0.2), rgba(139, 255, 125, 0.2));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 300ms ease-out;
}

.progress-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* --- Responsive --- */

@media (max-width: 980px) {
  .creator-layout {
    grid-template-columns: 1fr;
  }

  .creator-stage {
    min-height: 60vh;
    order: -1;
  }

  .creator-chat {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .creator-layout {
    width: 96vw;
  }

  .iframe-wrap {
    min-height: 300px;
  }
}

/* --- Fullscreen mode --- */

.iframe-wrap.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  border-radius: 0;
  border: none;
  min-height: auto;
}
