/* ─────────────────────────────────────────────
   ADD-RECIPE PAGE  — palette-aware styles
   ───────────────────────────────────────────── */

/* PAGE BACKGROUND + CENTERING */
#page-content {
  width: 100%;
  min-height: calc(100vh - 66px);
  display: flex;
  justify-content: center;
  background-color: #ede0d4;
  padding: 2.5rem 1rem 4rem;
}

/* CENTRAL PANEL */
#form-panel {
  width: 100%;
  max-width: 860px;
  background-color: #fdf7f2;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(127, 85, 57, 0.13);
  padding: 2rem 2.5rem 2.5rem;
}

.panel-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #414833;
  margin-bottom: 0.5rem;
}

.panel-divider {
  height: 2px;
  background: linear-gradient(to right, #7f5539, #ede0d4);
  border-radius: 2px;
  margin-bottom: 1.8rem;
}

/* ── TOP SECTION ── */
.top-section {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.2rem;
}

/* ── META FIELDS (left) ── */
.meta-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #656d4a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.time-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.field-group input[type='text'],
.field-group input[type='number'],
.field-group textarea {
  padding: 0.55rem 0.8rem;
  border: 1.5px solid #d5c5b5;
  border-radius: 7px;
  background: #fff;
  color: #414833;
  font-size: 0.97rem;
  font-family: inherit;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
  resize: vertical;
  outline: none;
}

.field-group input:focus,
.field-group textarea:focus {
  border-color: #a68a64;
  box-shadow: 0 0 0 3px rgba(166, 138, 100, 0.15);
}

.times-row {
  display: flex;
  gap: 1rem;
}

.times-row .field-group {
  flex: 1;
}

/* ── IMAGE PICKER (right) ── */
.image-picker {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

/* Placeholder zone */
.image-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  border: 2px dashed #a68a64;
  border-radius: 10px;
  background: #f5ece3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  cursor: pointer;
  transition:
    background 0.18s,
    border-color 0.18s;
  padding: 1rem;
  text-align: center;
}

.image-placeholder:hover {
  background: #ede3d8;
  border-color: #7f5539;
}

.image-placeholder span {
  font-size: 0.82rem;
  color: #a68a64;
  line-height: 1.4;
}

.image-placeholder.drag-over {
  background: #e8ddd4;
  border-color: #7f5539;
}

/* Preview wrapper — takes exact same space as placeholder */
.image-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #a68a64;
  cursor: pointer;
}

.image-preview-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  transition: filter 0.2s ease;
}

/* Dim the photo when hovering the wrapper */
.image-preview-wrap:hover img {
  filter: brightness(0.6);
}

/* Red cross button — hidden by default, shown on wrapper hover */
.image-remove-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 0;
}

.image-preview-wrap:hover .image-remove-overlay {
  opacity: 1;
}

/* ─────────────────────────────────────────────
   LIST SECTIONS (ingredients + steps)
   ───────────────────────────────────────────── */
.list-section {
  margin-bottom: 2rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #414833;
  margin-bottom: 0.9rem;
}

.sortable-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

/* ── INGREDIENT COLUMN HEADERS ── */
.ingredient-header {
  display: flex;
  align-items: center;
  /* offsets: 28px drag handle + 0.5rem gap, then columns */
  padding-left: calc(28px + 0.5rem + 0.55rem);
  padding-right: calc(32px + 0.55rem); /* right-align with delete btn */
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.ingredient-header span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #a68a64;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.ing-col-amount {
  width: 72px;
  flex-shrink: 0;
}
.ing-col-unit {
  width: 110px;
  flex-shrink: 0;
}
.ing-col-desc {
  flex: 1;
}

/* ── EACH ROW ── */
.list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1.5px solid #e2d4c6;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}

.list-item:hover {
  border-color: #a68a64;
  box-shadow: 0 2px 8px rgba(127, 85, 57, 0.09);
}

.list-item.drag-over {
  border-color: #7f5539;
  box-shadow: 0 0 0 3px rgba(127, 85, 57, 0.18);
}

.list-item.dragging {
  opacity: 0.45;
}

/* ── DRAG HANDLE ── */
.drag-handle {
  cursor: grab;
  color: #c4b09a;
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  user-select: none;
}

.drag-handle:hover {
  color: #7f5539;
}
.drag-handle svg {
  pointer-events: none;
}

/* ── STEP NUMBER BADGE ── */
.step-badge {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: #7f5539;
  color: #fff;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── INGREDIENT INPUTS ── */
.ing-amount {
  width: 72px;
  flex-shrink: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: #414833;
  font-family: inherit;
  padding: 0.2rem 0.3rem;
  /* remove number arrows */
  -moz-appearance: textfield;
}
.ing-amount::-webkit-outer-spin-button,
.ing-amount::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.ing-unit {
  width: 110px;
  flex-shrink: 0;
  border: none;
  border-left: 1.5px solid #e2d4c6;
  border-right: 1.5px solid #e2d4c6;
  outline: none;
  background: transparent;
  font-size: 0.92rem;
  color: #7f5539;
  font-family: inherit;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23A68A64' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
}

.ing-unit:focus {
  background-color: rgba(166, 138, 100, 0.07);
}

.ing-desc {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: #414833;
  font-family: inherit;
  padding: 0.2rem 0.3rem;
}

/* ── STEP FIELDS ── */
.step-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.step-title {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.97rem;
  font-weight: 700;
  color: #414833;
  font-family: inherit;
  padding: 0.2rem 0.3rem;
  width: 100%;
}

.step-title::placeholder {
  font-weight: 400;
  color: #b5a090;
}

.step-desc {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.92rem;
  color: #6b5c4e;
  font-family: inherit;
  padding: 0.2rem 0.3rem;
  resize: none;
  line-height: 1.45;
  width: 100%;
}

/* ── DELETE BUTTON ── */
.delete-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  color: #d9534f;
  display: flex;
  align-items: center;
  transition:
    background 0.15s,
    color 0.15s;
}

.delete-btn:hover {
  background: #fdecea;
  color: #b52b27;
}

/* ── ADD ITEM BUTTON ── */
.add-item-btn {
  margin-top: 0.6rem;
  padding: 0.45rem 1rem;
  background: none;
  border: 1.5px dashed #a68a64;
  border-radius: 7px;
  color: #a68a64;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.add-item-btn:hover {
  background: #f5ece3;
  border-color: #7f5539;
  color: #7f5539;
}

/* ─────────────────────────────────────────────
   FORM FOOTER
   ───────────────────────────────────────────── */
.form-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1.5px solid #e8ddd4;
}

.cancel-btn {
  padding: 0.55rem 1.3rem;
  border-radius: 7px;
  border: 1.5px solid #c4b09a;
  background: none;
  color: #7f5539;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.cancel-btn:hover {
  background: #f5ece3;
}

.submit-btn {
  padding: 0.55rem 1.6rem;
  background: #7f5539;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s,
    box-shadow 0.18s;
  font-family: inherit;
}

.submit-btn:hover {
  background: #5c3d27;
  box-shadow: 0 4px 12px rgba(127, 85, 57, 0.25);
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 680px) {
  #form-panel {
    padding: 1.4rem 1.2rem 2rem;
  }
  .top-section {
    flex-direction: column;
  }
  .image-picker {
    width: 100%;
  }
  .image-placeholder {
    aspect-ratio: 16/7;
  }
  .image-preview-wrap {
    aspect-ratio: 16/7;
  }
  .ingredient-header {
    display: none;
  }
  .ing-unit {
    width: 90px;
  }
  .ing-amount {
    width: 56px;
  }
}
