/* RESET BÁSICO */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
}

/* TOPBAR */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e5e7eb;
}

.topbar-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: #6b7280;
}

/* LAYOUT PRINCIPAL */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.layout-main {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: nowrap;
}

/* Columna izquierda: 1/4 */

.col-left {
  flex: 0 0 25%;
  min-width: 260px;
}

/* Columna derecha: 3/4 */

.col-right {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Fila inferior con dos tarjetas a 1/2 cada una */

.row-bottom {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.row-bottom > .card {
  flex: 1 1 0;
  min-width: 280px;
}

/* Tarjetas generales */

.card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.card-help {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.card-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Grid de campos */

.grid {
  display: grid;
  gap: 0.75rem 1rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Campos de formulario */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #4b5563;
}

.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 0.5rem 0.625rem;
  border-radius: 0.65rem;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: inherit;
  min-height: 2.4rem;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
  background: #ffffff;
}

/* Área de código / prompt */

.code-area {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 0.88rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  resize: none;
  /* 10 líneas visibles aprox. */
  line-height: 1.4;
  height: 11.2em;
  max-height: 11.2em;
  overflow-y: auto;
}

.code-area:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
  background: #ffffff;
}

/* Resultados de texto */

.result-box {
  margin-top: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.45;
  min-height: 160px;
}

.placeholder {
  margin: 0;
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Imagen generada */

.image-box {
  margin-top: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.image-box img {
  max-width: 100%;
  max-height: 360px;
  display: block;
  border-radius: 0.75rem;
}

/* Botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.05s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* Primario: azul SEND+IA */

.btn-primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

/* Contorno */

.btn-outline {
  background: #f9fafb;
  color: #1f2933;
  border-color: #d1d5db;
}

.btn-outline:hover:not(:disabled) {
  background: #e5edff;
  border-color: #2563eb;
}

/* Estados / mensajes */

.status {
  min-height: 1.1rem;
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: #6b7280;
}

.status.error {
  color: #b91c1c;
}

/* FOOTER */

.footer {
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: #9ca3af;
}

/* RESPONSIVE */

@media (max-width: 960px) {
  .layout-main {
    flex-direction: column;
  }

  .col-left,
  .col-right {
    flex: 1 1 100%;
  }

  .row-bottom {
    flex-direction: column;
  }

  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1rem;
  }

  .card {
    padding: 1rem 1.1rem;
  }

  .topbar-main {
    padding-inline: 1rem;
  }
}
