/* ─────────────────────────────────────────────
   RECIPE EDITOR — Crear / editar user_recipes
   ───────────────────────────────────────────── */

.recipe-editor {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-app);
}

/* ── Header ──────────────────────────────────── */
.re-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 52px var(--screen-padding) 12px;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border-subtle);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  flex-shrink: 0;
}

.re-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
}

.re-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.re-save-btn {
  background: var(--color-brand-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.re-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Body ────────────────────────────────────── */
.re-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px var(--screen-padding) 48px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Sections ────────────────────────────────── */
.re-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.re-section:last-child { border-bottom: none; }

.re-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

/* ── Input ───────────────────────────────────── */
.re-input {
  width: 100%;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.re-input:focus { border-color: var(--color-brand-primary); }
.re-input::placeholder { color: var(--color-text-subtle); }

.re-textarea {
  resize: vertical;
  min-height: 70px;
}

.re-select { cursor: pointer; }

/* ── Row 3 ───────────────────────────────────── */
.re-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.re-row-3 .re-section {
  padding: 0;
  border-bottom: none;
}

/* ── Image upload ────────────────────────────── */
.re-img-upload {
  width: 100%;
  height: 160px;
  border-radius: 14px;
  border: 2px dashed var(--color-border-subtle);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-surface);
  transition: border-color 0.15s;
}
.re-img-upload:active { border-color: var(--color-brand-primary); }

.re-img-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.re-img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.re-remove-img-btn {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--color-accent-terracotta);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

/* ── Tags ────────────────────────────────────── */
.re-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.re-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  padding: 4px 8px;
}

.re-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-brand-primary);
  font-size: 15px;
  line-height: 1;
  padding: 0;
  display: flex;
}

.re-tag-input {
  flex: 1;
  min-width: 100px;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--color-text-primary);
}
.re-tag-input::placeholder { color: var(--color-text-subtle); }

/* ── Ingredient rows ─────────────────────────── */
.re-ing-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.re-ing-name { flex: 1; }

/* ── Step rows ───────────────────────────────── */
.re-step-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.re-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-brand-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 8px;
}

/* ── Row remove btn ──────────────────────────── */
.re-row-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  color: var(--color-text-subtle);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.re-row-remove:active { color: var(--color-accent-terracotta); }

/* ── Add btn ─────────────────────────────────── */
.re-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--color-brand-primary);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-brand-primary);
  cursor: pointer;
  margin-top: 4px;
}

/* ── Visibility toggle ───────────────────────── */
.re-visibility {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.re-toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.re-toggle input { display: none; }
.re-toggle__track {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: var(--color-border-subtle);
  transition: background 0.2s;
  cursor: pointer;
}
.re-toggle__track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.re-toggle input:checked + .re-toggle__track {
  background: var(--color-brand-primary);
}
.re-toggle input:checked + .re-toggle__track::after {
  transform: translateX(20px);
}
