:root {
  --bg: #07090d;
  --panel: #11161f;
  --panel-2: #171d29;

  --text: #f5f7fb;
  --muted: #8d97aa;

  --line: rgba(255, 255, 255, 0.08);

  --accent: #4c6fff;
  --gold: #c8a96a;

  --radius: 28px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at top, rgba(76, 111, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #07090d, #05070b);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.ambient-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
}

.glow-1 {
  top: -120px;
  left: -120px;
  background: #4c6fff;
}

.glow-2 {
  right: -120px;
  bottom: -160px;
  background: #c8a96a;
}

.studio-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 7%;
  backdrop-filter: blur(18px);
  background: rgba(7, 9, 13, 0.72);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: Georgia, serif;
  color: var(--gold);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.brand strong {
  display: block;
  font-size: 14px;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.back-link:hover {
  color: var(--text);
}

.studio-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 520px;
  gap: 60px;
  align-items: start; /* ✅ CAMBIO: center → start para evitar cortes */
  min-height: calc(100vh - 80px);
  padding: 70px 7%;
}

.studio-panel {
  max-width: 620px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

h1 {
  font-size: clamp(44px, 5vw, 74px);
  line-height: 0.94;
  letter-spacing: -0.07em;
  margin-bottom: 20px;
}

.hero-copy {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 42px;
}

.studio-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 18px 18px;
  font-size: 15px;
  outline: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(76, 111, 255, 0.45);
  background: rgba(76, 111, 255, 0.06);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.style-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.style-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.style-chip:hover,
.style-chip.active {
  color: white;
  border-color: rgba(76, 111, 255, 0.35);
  background: rgba(76, 111, 255, 0.12);
}

.generate-btn {
  height: 58px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #4c6fff, #314ed1);
  color: white;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 20px 40px rgba(76, 111, 255, 0.24);
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 26px 50px rgba(76, 111, 255, 0.32);
}

.generate-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: -6px;
}

/* ==========================================
   PANEL DE PREVIEW (TELÉFONO)
   ========================================== */

.preview-panel {
  display: flex;
  justify-content: center;
  align-items: flex-start; /* ✅ Para que no se corte en desktop */
  padding-top: 20px;
}

.preview-phone {
  position: relative;
  width: 360px;
  height: 720px;
  padding: 18px;
  border-radius: 42px;
  background: linear-gradient(180deg, #151c28, #0a0d13);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45);

  /* ✅ FIX CRÍTICO: Contener contenido y distribuir en columna */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.phone-top {
  width: 120px;
  height: 26px;
  margin: 0 auto 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0; /* ✅ Que no se comprima */
}

/* ==========================================
   CONTENIDO DEL PREVIEW (CON SCROLL)
   ========================================== */

.preview-content {
  /* ✅ FIX: Scroll interno en lugar de height fijo */
  flex: 1;
  min-height: 0; /* ✅ Permite que flex + scroll funcionen */
  overflow-y: auto;

  border-radius: 28px;
  padding: 36px 28px;
  background:
    radial-gradient(circle at top right, rgba(76, 111, 255, 0.14), transparent 24%),
    linear-gradient(180deg, #121722, #0b0f16);
  border: 1px solid rgba(255, 255, 255, 0.06);

  /* ✅ Scroll invisible */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.preview-content::-webkit-scrollbar {
  display: none;
}

/* ✅ Evitar que textos largos rompan el layout */
.preview-content h2,
.preview-content p,
.preview-content a {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ==========================================
   LOGO EN EL PREVIEW (FIX PRINCIPAL)
   ========================================== */

.preview-logo {
  /* ✅ Dimensiones fijas para evitar saltos de layout */
  width: 80px;
  height: 80px;
  min-width: 80px;
  min-height: 80px;

  /* Centrado y espaciado */
  margin: 0 auto 20px;

  /* Estilo base (cuando es texto placeholder) */
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(200, 169, 106, 0.15), rgba(76, 111, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.1);

  /* Flex para centrar contenido */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Texto placeholder */
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  font-family: Georgia, serif;

  /* ✅ Seguridad: nada se sale, no se comprime */
  overflow: hidden;
  flex-shrink: 0;
}

/* ✅ Cuando hay imagen dentro del logo */
.preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Mantiene proporciones SIN distorsionar */
  display: block;
}

/* ==========================================
   ELEMENTOS DENTRO DEL PREVIEW
   ========================================== */

.preview-badge {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(200, 169, 106, 0.08);
  border: 1px solid rgba(200, 169, 106, 0.12);
  flex-shrink: 0;
}

.preview-content h2 {
  margin-top: 30px;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.preview-content p {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 15px;
}

.preview-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 42px;
}

.preview-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  transition: 0.2s ease;
}

.preview-links a:hover {
  transform: translateY(-2px);
  border-color: rgba(76, 111, 255, 0.25);
  background: rgba(76, 111, 255, 0.08);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 1100px) {
  .studio-layout {
    grid-template-columns: 1fr;
    align-items: center;
  }

  .preview-panel {
    margin-top: 10px;
    order: -1; /* ✅ Preview arriba en móvil */
  }
}

@media (max-width: 720px) {
  .studio-navbar {
    padding: 16px 5%;
  }

  .studio-layout {
    gap: 44px;
    padding: 40px 5% 80px;
  }

  h1 {
    font-size: clamp(38px, 12vw, 58px);
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .preview-phone {
    width: 100%;
    max-width: 360px;
    height: 680px;
  }

  /* ✅ Logo más pequeño en móvil */
  .preview-logo {
    width: 70px;
    height: 70px;
    min-width: 70px;
    min-height: 70px;
    font-size: 24px;
  }
}
