
/* ================================
   BASE GENERAL
================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ================================
   HEADER
================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.logo-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: white;
  font-size: 0.9rem;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.35);
}

.nav-link {
  color: #475569;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #4f46e5;
}

/* Botón hamburguesa */
.menu-button {
  width: 42px;
  height: 42px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #ffffff;
}

.menu-button span {
  width: 20px;
  height: 2px;
  background: #0f172a;
  border-radius: 999px;
  transition: 0.25s ease;
}

/* Menú móvil */
.mobile-menu {
  display: none;
  padding: 0.75rem 0 1rem;
  border-top: 1px solid #e2e8f0;
}

.mobile-menu.active {
  display: grid;
  gap: 0.5rem;
}

.mobile-menu a {
  padding: 0.8rem 1rem;
  border-radius: 14px;
  color: #475569;
  background: #f8fafc;
  font-weight: 600;
}

.mobile-menu a:hover {
  color: #4f46e5;
  background: #eef2ff;
}

/* ================================
   HERO
================================ */

.hero-card {
  padding: 2rem;
  border-radius: 2rem;
  background:
    radial-gradient(circle at top right, rgba(236, 72, 153, 0.18), transparent 35%),
    radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.2), transparent 35%),
    linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
}

.eyebrow {
  display: inline-flex;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

/* ================================
   SECCIONES
================================ */

.section-card,
.prompt-output-card {
  margin-bottom: 2rem;
  padding: 1.25rem;
  border-radius: 2rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.06);
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 0.5rem;
}

.section-heading p {
  margin-top: 0.3rem;
  color: #64748b;
}

.section-badge {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #9333ea;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
}

/* ================================
   FORMULARIO
================================ */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.field-card {
  padding: 1rem;
  border-radius: 1.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: 0.2s ease;
}

.field-card:hover {
  background: #ffffff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.field-card label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
  font-weight: 750;
  color: #0f172a;
}

.field-card small {
  display: block;
  margin-top: 0.5rem;
  color: #64748b;
  font-size: 0.78rem;
}

.prompt-field,
#finalPrompt {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: 0.2s ease;
  font-size: 0.95rem;
}

.prompt-field:focus,
#finalPrompt:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

select.prompt-field {
  cursor: pointer;
}

textarea.prompt-field {
  resize: vertical;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.color-input {
  width: 70px;
  height: 48px;
  padding: 0.25rem;
  cursor: pointer;
}

.hex-value {
  min-width: 90px;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
}

/* ================================
   DIVISOR IMÁGENES
================================ */

.image-divider {
  margin: 2.5rem 0;
  padding: 2rem 1.2rem;
  text-align: center;
  border-radius: 2rem;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1)),
    #ffffff;
  border: 1px solid #e2e8f0;
}

.image-divider span {
  display: inline-block;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #0f172a;
}

.image-divider p {
  max-width: 650px;
  margin: 0.5rem auto 0;
  color: #64748b;
}

/* ================================
   PROMPT FINAL
================================ */

#finalPrompt {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
  font-size: 1rem;
  background: #f8fafc;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
}

button {
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: 0.2s ease;
}

.btn-primary,
.btn-danger,
.btn-secondary,
.btn-muted {
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  box-shadow: 0 14px 28px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.35);
}

.btn-danger {
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.btn-danger:hover {
  transform: translateY(-2px);
}

.btn-secondary {
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a, #334155);
}

.btn-secondary:hover {
  transform: translateY(-2px);
}

.btn-muted {
  color: #334155;
  background: #e2e8f0;
}

.btn-muted:hover {
  background: #cbd5e1;
  transform: translateY(-2px);
}

.status-message {
  margin-top: 1rem;
  min-height: 24px;
  font-size: 0.9rem;
  font-weight: 700;
}

.status-message.success {
  color: #16a34a;
}

.status-message.error {
  color: #dc2626;
}

/* ================================
   RESPONSIVE
================================ */

@media (min-width: 768px) {
  .hero-card {
    padding: 3rem;
  }

  .section-card,
  .prompt-output-card {
    padding: 2rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md\:col-span-2 {
    grid-column: span 2 / span 2;
  }
}

@media (max-width: 480px) {
  .action-row button {
    width: 100%;
  }

  .hero-card {
    padding: 1.4rem;
  }

  .section-card,
  .prompt-output-card {
    border-radius: 1.5rem;
  }
}

/* ================================
   LAYOUT CON PANEL LATERAL STICKY
================================ */

.builder-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.builder-left {
  min-width: 0;
}

.builder-right {
  min-width: 0;
}

.prompt-output-card {
  position: relative;
}

.prompt-heading-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.expand-btn {
  width: fit-content;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.expand-btn:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

@media (min-width: 1024px) {
  .builder-layout {
    grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
  }

  .builder-right {
    position: sticky;
    top: 6rem;
    align-self: start;
    max-height: calc(100vh - 7rem);
  }

  .builder-right .prompt-output-card {
    max-height: calc(100vh - 7rem);
    overflow: auto;
  }

  .builder-right #finalPrompt {
    min-height: 320px;
    max-height: 42vh;
  }

  .builder-right .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .builder-right .action-row button {
    width: 100%;
  }
}

/* Estado ampliado */
.builder-layout.prompt-expanded {
  grid-template-columns: 1fr;
}

.builder-layout.prompt-expanded .builder-right {
  position: fixed;
  inset: 1.5rem;
  z-index: 100;
  max-height: none;
  overflow: auto;
}

.builder-layout.prompt-expanded .prompt-output-card {
  height: 100%;
  max-height: none;
  overflow: auto;
  border-radius: 2rem;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.25);
}

.builder-layout.prompt-expanded #finalPrompt {
  min-height: 55vh;
  max-height: none;
}

.builder-layout.prompt-expanded .expand-btn {
  color: #ffffff;
  background: #0f172a;
  border-color: #0f172a;
}

@media (min-width: 768px) {
  .prompt-heading-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}