/* ==========================================================================
   Recipe page — reading, inline editing and drag & drop
   Depends on the tokens declared in papilles.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   Rich text rendered from the recipe body
   -------------------------------------------------------------------------- */
.recipe-content ul {
  list-style-type: none;
  padding-left: 0;
  margin: 1rem 0;
}
.recipe-content ul li {
  position: relative;
  padding-left: 1.5rem;
  margin: 0.75rem 0;
  line-height: 1.65;
}
.recipe-content ul li:before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-400);
}
.recipe-content ol {
  list-style-type: none;
  padding-left: 0;
  margin: 1rem 0;
  counter-reset: step-counter;
}
.recipe-content ol li {
  position: relative;
  padding-left: 3rem;
  margin: 1.5rem 0;
  line-height: 1.65;
  counter-increment: step-counter;
}
.recipe-content ol li:before {
  content: counter(step-counter);
  background: linear-gradient(145deg, var(--gold-400), var(--gold-600));
  color: white;
  font-weight: 700;
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Step number badge (shared with the JS that appends new steps)
   -------------------------------------------------------------------------- */
.step-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--gold-400), var(--gold-600));
  box-shadow: 0 4px 10px -4px rgba(196, 118, 26, 0.7);
}

/* --------------------------------------------------------------------------
   Ingredient checklist
   -------------------------------------------------------------------------- */
.ingredient-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  border: 1.5px solid var(--cream-300);
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.ingredient-checkbox:hover {
  border-color: var(--gold-400);
}
.ingredient-checkbox:checked {
  background: var(--gold-500);
  border-color: var(--gold-500);
}
.ingredient-checkbox:checked::after {
  content: "";
  width: 0.32rem;
  height: 0.6rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.ingredient-checkbox:checked + .ingredient-text {
  text-decoration: line-through;
  text-decoration-color: var(--ink-400);
}

/* --------------------------------------------------------------------------
   Servings counter
   -------------------------------------------------------------------------- */
.servings-counter button {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
}

.servings-edit-container {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.servings-edit-container button {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.servings-edit-container button:hover {
  background: var(--cream-200);
  color: var(--ink-700);
}
.servings-edit-container input,
.edit-servings-input {
  width: 1.75rem;
  text-align: center;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-900);
}
.servings-edit-container input:focus,
.edit-servings-input:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   Inline editing
   -------------------------------------------------------------------------- */
.editable-title {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.25rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 12px;
  transition: all 0.25s var(--ease-out);
  resize: none;
  overflow: hidden;
  line-height: 1.1;
  width: 100%;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  color: inherit;
  min-height: auto;
}
.editable-title::placeholder {
  color: var(--ink-400);
}
.editable-title:hover {
  background-color: rgba(253, 239, 211, 0.5);
}
.editable-title:focus {
  outline: none;
  background-color: rgba(253, 239, 211, 0.7);
  border-color: var(--gold-300);
}

.editable-input {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  transition: all 0.25s var(--ease-out);
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
.editable-input::placeholder {
  color: var(--ink-400);
}
.editable-input:hover {
  background-color: rgba(253, 239, 211, 0.45);
}
.editable-input:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--gold-300);
  box-shadow: 0 0 0 3px rgba(239, 171, 67, 0.15);
}

.editable-textarea {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  transition: all 0.25s var(--ease-out);
  resize: none;
  min-height: 1.9rem;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.55;
  color: inherit;
}
.editable-textarea::placeholder {
  color: var(--ink-400);
}
.editable-textarea:hover {
  background-color: rgba(253, 239, 211, 0.45);
}
.editable-textarea:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--gold-300);
  box-shadow: 0 0 0 3px rgba(239, 171, 67, 0.15);
}

/* --------------------------------------------------------------------------
   Add / remove row controls
   -------------------------------------------------------------------------- */
.add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.65rem 0 0.25rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gold-600);
  background: rgba(253, 239, 211, 0.55);
  border: 1px dashed var(--gold-300);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}
.add-item-btn:hover {
  background: var(--gold-500);
  border-color: var(--gold-500);
  border-style: solid;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -8px rgba(196, 118, 26, 0.7);
}

.remove-item-btn {
  background: transparent;
  color: var(--ink-400);
  border: none;
  border-radius: 50%;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  margin-left: 0.25rem;
  flex-shrink: 0;
  opacity: 0;
}
.editable-item:hover .remove-item-btn,
.remove-item-btn:focus-visible {
  opacity: 1;
}
.remove-item-btn:hover {
  background: #fbe5e3;
  color: #c1453d;
}

/* Touch devices have no hover, so keep the control visible */
@media (hover: none) {
  .remove-item-btn {
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   Drag & drop
   -------------------------------------------------------------------------- */
.drag-handle {
  cursor: grab;
  padding: 0.4rem 0.2rem;
  color: var(--cream-300);
  transition: color 0.2s var(--ease-out);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.editable-item:hover .drag-handle {
  color: var(--ink-400);
}
.drag-handle:active {
  cursor: grabbing;
}

.editable-item {
  position: relative;
  padding: 0.15rem 0.35rem;
  border-radius: 12px;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out),
    opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.editable-item:hover {
  background-color: rgba(251, 244, 236, 0.9);
}
.editable-item.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}
.editable-item.drag-over {
  border-color: var(--gold-400);
  background-color: rgba(253, 239, 211, 0.7);
}

/* --------------------------------------------------------------------------
   Gallery picker & category tags
   -------------------------------------------------------------------------- */
.gallery-select {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--cream-300);
  border-radius: 14px;
  padding: 0.45rem;
  font-size: 0.875rem;
  max-height: 8rem;
  overflow-y: auto;
}
.gallery-select input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  border: 1.5px solid var(--cream-300);
  border-radius: 5px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.gallery-select input[type="checkbox"]:checked {
  background: var(--gold-500);
  border-color: var(--gold-500);
}
.gallery-select input[type="checkbox"]:checked::after {
  content: "";
  width: 0.28rem;
  height: 0.55rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.gallery-option {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s var(--ease-out);
}
.gallery-option:hover {
  background-color: rgba(253, 239, 211, 0.6);
}

.category-input-container #id_categories {
  display: none;
}

.category-tag {
  transition: all 0.2s var(--ease-out);
}
.category-tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}
