/* ============================================================
   NYX PORTAL — GENERATOR V4
   Clean rewrite. Scope: .gv4-* prefix, no conflicts.
   ============================================================ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }

/* ── Generator background stage (EVA5 premium — CRISP, NO BLUR) — scoped to body.generator-page ── */
body.generator-page {
  position: relative;
  min-height: 100vh;
  background: #06040a; /* dark fallback */
  overflow-x: hidden;
}

body.generator-page #generator-bg-stage {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
  background: #000;
}

body.generator-page #generator-bg-stage .bg-layer {
  display: block;
  position: absolute;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  object-position: center;
  transform: translateZ(0); /* GPU layer promotion only — no scale */
  filter: none !important;  /* CRISP: zero blur, no distortion */
  backdrop-filter: none !important;
  opacity: 0.72;            /* visible full-screen wallpaper */
}

body.generator-page #generator-bg-stage .bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 55% at 50% 30%,
      rgba(0,0,0,0.08),
      rgba(0,0,0,0.42)),
    linear-gradient(to bottom,
      rgba(0,0,0,0.22),
      rgba(0,0,0,0.48));
  filter: none !important;
  backdrop-filter: none !important;
}

/* Shell */
.gv4-shell {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.gv4-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.gv4-topbar-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 0 20px rgba(155,89,182,0.6);
}
.gv4-credits-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10,5,18,0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(155,89,182,0.3);
  border-radius: 50px;
  padding: 7px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
}
.gv4-credits-pill .gv4-credit-num {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(155,89,182,0.8);
}
.gv4-buy-link {
  background: rgba(155,89,182,0.28);
  border: 1px solid rgba(155,89,182,0.55);
  color: #fff;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-family: 'Cinzel', serif;
  letter-spacing: 1.5px;
  text-decoration: none;
  transition: all 0.25s ease;
}
.gv4-buy-link:hover {
  background: rgba(155,89,182,0.5);
  box-shadow: 0 0 18px rgba(155,89,182,0.4);
}
.gv4-lang-link {
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-decoration: none;
  transition: color 0.2s;
  font-family: 'Inter', sans-serif;
}
.gv4-lang-link:hover { color: #fff; }
.gv4-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Main 2-panel layout */
.gv4-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 20px;
  padding: 0 24px 28px;
  align-items: start;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Glass panel — fully transparent, ghost panel */
.gv4-panel {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: none;
}

/* Heading */
.gv4-heading {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.45);
  text-align: center;
  margin: 0 0 4px;
  text-shadow: 0 1px 12px rgba(0,0,0,0.8);
}
.gv4-subheading {
  text-align: center;
  font-size: 0.67rem;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.18);
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  margin: 0 0 20px;
}

/* Prompt */
.gv4-prompt-wrap { position: relative; margin-bottom: 6px; }
/* Textarea — "escribir sobre el video", casi invisible */
.gv4-textarea {
  width: 100%;
  min-height: 110px;
  max-height: 220px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  border-radius: 0;
  padding: 13px 4px;
  color: rgba(255,255,255,0.92);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.65;
  resize: none;
  outline: none;
  transition: border-color 0.3s;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: block;
  text-shadow: 0 1px 8px rgba(0,0,0,0.9);
}
.gv4-textarea::placeholder { color: rgba(255,255,255,0.22); font-style: normal; letter-spacing: 0.3px; }
.gv4-textarea:focus {
  border-bottom-color: rgba(155,89,182,0.6);
}
.gv4-textarea.gv4-error-field { border-bottom-color: rgba(255,46,99,0.8) !important; }

.gv4-char-counter {
  text-align: right;
  font-size: 0.71rem;
  color: rgba(255,255,255,0.14);
  font-family: 'Inter', sans-serif;
  margin-top: 5px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

/* Label */
.gv4-label {
  font-size: 0.67rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.2);
  font-family: 'Inter', sans-serif;
  margin-bottom: 8px;
  display: block;
}

/* Ratio selector */
.gv4-ratio-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.gv4-ratio-btn {
  flex: 1;
  min-width: 60px;
  background: rgba(10,5,20,0.45);
  border: 1.5px solid rgba(155,89,182,0.22);
  border-radius: 10px;
  padding: 10px 6px;
  color: rgba(255,255,255,0.65);
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.gv4-ratio-btn:hover {
  border-color: rgba(155,89,182,0.5);
  color: #fff;
  background: rgba(15,8,28,0.6);
}
.gv4-ratio-btn.active {
  background: linear-gradient(135deg, rgba(155,89,182,0.35), rgba(100,50,150,0.25));
  border-color: rgba(155,89,182,0.8);
  color: #fff;
  box-shadow: 0 0 20px rgba(155,89,182,0.32), inset 0 0 14px rgba(155,89,182,0.08);
  text-shadow: 0 0 10px rgba(255,255,255,0.4);
}

/* Invoke button */
.gv4-invoke-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(155,89,182,0.38), rgba(90,40,140,0.28));
  border: 1.5px solid rgba(155,89,182,0.6);
  border-radius: 50px;
  padding: 17px 30px;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 22px rgba(155,89,182,0.25);
  margin-bottom: 10px;
}
.gv4-invoke-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  left: -100%;
  transition: left 0.55s ease;
}
.gv4-invoke-btn:hover:not(:disabled)::before { left: 100%; }
.gv4-invoke-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(155,89,182,0.58), rgba(110,55,165,0.48));
  border-color: rgba(155,89,182,0.92);
  box-shadow: 0 6px 35px rgba(155,89,182,0.5);
  transform: translateY(-2px);
}
.gv4-invoke-btn:active:not(:disabled) { transform: translateY(0); }
.gv4-invoke-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
.gv4-invoke-btn.loading { cursor: wait; animation: gv4pulse 1.4s infinite; }
@keyframes gv4pulse {
  0%   { box-shadow: 0 0 0 0 rgba(155,89,182,0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(155,89,182,0); }
  100% { box-shadow: 0 0 0 0 rgba(155,89,182,0); }
}

/* Cost badge */
.gv4-cost-badge {
  text-align: center;
  font-size: 0.71rem;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.14);
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* Status message */
.gv4-status {
  min-height: 20px;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  text-align: center;
  border-radius: 8px;
  padding: 8px 14px;
  display: none;
}
.gv4-status.visible { display: block; }
.gv4-status.gv4-error {
  background: rgba(255,46,99,0.1);
  border: 1px solid rgba(255,46,99,0.3);
  color: #ff6b8a;
}
.gv4-status.gv4-info {
  background: rgba(155,89,182,0.1);
  border: 1px solid rgba(155,89,182,0.28);
  color: rgba(255,255,255,0.8);
}
.gv4-status.gv4-success {
  background: rgba(0,200,100,0.08);
  border: 1px solid rgba(0,200,100,0.22);
  color: #4dffa0;
}

/* Back link */
.gv4-back {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.14);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  transition: color 0.2s;
}
.gv4-back:hover { color: rgba(255,255,255,0.55); }

/* RIGHT PANEL: Preview */
.gv4-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

/* Placeholder */
.gv4-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 40px 20px;
  width: 100%;
  height: 100%;
  min-height: 200px;
}
.gv4-placeholder-dots {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 6px;
  color: rgba(255,255,255,0.18);
  animation: gv4breathe 4s infinite ease-in-out;
}
@keyframes gv4breathe {
  0%,100% { opacity: 0.18; }
  50%      { opacity: 0.38; }
}

/* Loader */
.gv4-loader-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 50px 20px;
}
.gv4-loader-wrap.visible { display: flex; }
.gv4-spinner {
  width: 58px; height: 58px;
  border: 2.5px solid rgba(155,89,182,0.15);
  border-top-color: rgba(155,89,182,0.9);
  border-right-color: rgba(255,46,99,0.55);
  border-radius: 50%;
  animation: gv4spin 1s linear infinite;
}
@keyframes gv4spin { to { transform: rotate(360deg); } }
.gv4-loader-text {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  animation: gv4flicker 2s infinite;
}
@keyframes gv4flicker {
  0%,100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* Result */
.gv4-result {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.gv4-result.visible { display: flex; }
.gv4-result-img {
  max-width: 100%;
  max-height: 62vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(155,89,182,0.1);
  border: 1px solid rgba(155,89,182,0.2);
  cursor: zoom-in;
  display: block;
  animation: gv4fadein 0.5s ease;
}
@keyframes gv4fadein {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* Action buttons */
.gv4-result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.gv4-action-btn {
  background: rgba(10,5,20,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(155,89,182,0.35);
  border-radius: 50px;
  padding: 10px 22px;
  color: #d4acfc;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gv4-action-btn:hover {
  border-color: rgba(155,89,182,0.75);
  box-shadow: 0 4px 20px rgba(155,89,182,0.32);
  color: #fff;
  transform: translateY(-1px);
}
.gv4-action-btn.gv4-reset-btn:hover {
  border-color: rgba(255,46,99,0.7);
  box-shadow: 0 4px 20px rgba(255,46,99,0.28);
  color: #ff6b8a;
}

/* No-essences modal */
.gv4-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.gv4-modal-overlay.open { opacity: 1; visibility: visible; }
.gv4-modal-box {
  background: rgba(12,6,22,0.97);
  border: 1px solid rgba(255,46,99,0.32);
  border-radius: 20px;
  padding: 46px 38px;
  max-width: 460px; width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.gv4-modal-overlay.open .gv4-modal-box { transform: scale(1); }
.gv4-modal-icon { font-size: 3.5rem; margin-bottom: 18px; }
.gv4-modal-title {
  font-family: 'Cinzel', serif; font-size: 1.75rem; color: #fff;
  letter-spacing: 3px; margin: 0 0 14px;
  text-shadow: 0 0 20px rgba(255,46,99,0.4);
}
.gv4-modal-text {
  font-family: 'Inter', sans-serif; font-size: 0.95rem;
  color: rgba(255,255,255,0.72); line-height: 1.7; margin: 0 0 28px;
}
.gv4-modal-actions { display: flex; flex-direction: column; gap: 12px; }
.gv4-modal-btn-primary {
  background: linear-gradient(135deg, #ff2e63, #a90b34);
  border: 1px solid #ff2e63; border-radius: 50px;
  padding: 14px 30px; color: #fff;
  font-family: 'Cinzel', serif; font-size: 0.95rem; font-weight: 600;
  letter-spacing: 2px; cursor: pointer; transition: all 0.3s;
  text-decoration: none; display: block;
  box-shadow: 0 4px 20px rgba(255,46,99,0.32);
}
.gv4-modal-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 7px 30px rgba(255,46,99,0.52); }
.gv4-modal-btn-secondary {
  background: transparent; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50px; padding: 12px 30px;
  color: rgba(255,255,255,0.62); font-family: 'Inter', sans-serif;
  font-size: 0.85rem; cursor: pointer; transition: all 0.25s;
}
.gv4-modal-btn-secondary:hover {
  border-color: rgba(255,255,255,0.4); color: #fff;
  background: rgba(255,255,255,0.05);
}

/* Fullscreen modal */
.gv4-fs-modal {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,0.97);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.gv4-fs-modal.open { opacity: 1; visibility: visible; }
.gv4-fs-modal img {
  max-width: 96vw; max-height: 96vh;
  border-radius: 6px;
  box-shadow: 0 0 80px rgba(0,0,0,0.9);
}
.gv4-fs-close {
  position: absolute; top: 16px; right: 20px;
  background: transparent; border: none;
  color: rgba(255,255,255,0.65); font-size: 2.2rem;
  cursor: pointer; line-height: 1; transition: color 0.2s;
}
.gv4-fs-close:hover { color: #fff; }

/* Responsive */
@media (max-width: 900px) {
  .gv4-layout { grid-template-columns: 1fr; padding: 0 14px 22px; }
  .gv4-preview { min-height: 280px; }
}
@media (max-width: 600px) {
  .gv4-topbar { padding: 12px 14px; }
  .gv4-panel  { padding: 18px 15px; border-radius: 14px; }
  .gv4-textarea { font-size: 16px !important; }
  .gv4-invoke-btn { font-size: 0.92rem; letter-spacing: 2.5px; }
  .gv4-heading { font-size: 1.1rem; }
  .gv4-result-img { max-height: 54vw; }
  .gv4-modal-box { padding: 34px 22px; }
  .gv4-modal-title { font-size: 1.35rem; }
}

/* ── Generator bg: responsive (mobile — fixed causes scroll lag on iOS/Android) ── */
@media (max-width: 768px) {
  body.generator-page #generator-bg-stage {
    position: absolute; /* avoid iOS fixed-background jank */
    height: 100%;
  }
  body.generator-page #generator-bg-stage .bg-layer {
    display: block;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    filter: none !important;         /* CRISP on mobile too */
    backdrop-filter: none !important;
    opacity: 0.64;                   /* keep wallpaper visible on mobile */
  }
}

/* ── Prevent solid backgrounds from covering the stage (scoped) ── */
body.generator-page,
body.generator-page main,
body.generator-page .gv4-shell {
  background: transparent !important;
}
