/* Sell / Offer / My listings. Builds on theme.css, home.css, profile.css */

.form-page { max-width: none; margin: 0 auto; padding: 24px 21px 64px; }
@media (min-width: 761px) {
  .form-page:has(> .back-link) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .form-page:has(> .back-link) > * { grid-column: 2; }
  .form-page:has(> .back-link) > .back-link { grid-column: 1; grid-row: 1; margin: 0; position: sticky; top: 104px; }
}

.form-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.form-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.2px; }

.seg { display: inline-flex; padding: 4px; border-radius: 8px; background: var(--soft); }
.seg a, .seg button {
  height: 38px; padding: 0 18px; border-radius: 8px; border: 0; background: transparent;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; cursor: pointer;
}
.seg a[aria-current="page"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.seg .count { font-weight: 500; color: var(--muted); }

.field textarea {
  min-height: 120px; padding: 12px 14px; resize: vertical;
  border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface);
  font: inherit; font-size: 16px; line-height: 1.5; color: var(--ink);
}
.field textarea::placeholder { color: var(--placeholder); }
.field textarea:focus { outline: none; border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(20, 163, 94, .18); }
.field .invalid, .field textarea.invalid, .field select.invalid { border-color: var(--error) !important; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.counter { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: right; }

.money { display: flex; }
.money .prefix {
  display: flex; align-items: center; padding: 0 14px;
  border: 1.5px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px;
  background: var(--soft); color: var(--muted); font-weight: 600;
}
.money input { flex: 1; min-width: 0; border-radius: 0 8px 8px 0 !important; }

/* Condition chips */
.choice { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.choice legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding: 0; }
.choice label {
  position: relative; height: 40px; padding: 0 16px; border-radius: 8px;
  display: inline-flex; align-items: center; cursor: pointer;
  border: 1.5px solid var(--border); font-size: 14px; font-weight: 500;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--green-dark); outline-offset: 2px; }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.photo, .photo-add {
  position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .cover {
  position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.6); color: #FFFFFF; font-size: 11px; font-weight: 600;
}
.photo .remove {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #FFFFFF; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.photo .remove svg { width: 16px; height: 16px; }
.photo-add {
  border: 1.5px dashed var(--border); background: var(--soft); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.photo-add:hover { color: var(--ink); border-color: var(--ink); }
.photo-add svg { width: 24px; height: 24px; }
.photo-add:focus-within { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.photo-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.photos.single { grid-template-columns: minmax(0, 1fr); max-width: 360px; }
.photos.single .photo, .photos.single .photo-add { aspect-ratio: 16 / 11; }

/* Price list rows (services) */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 46px; gap: 10px; }
.row input {
  height: 46px; border: 1.5px solid var(--border); border-radius: 8px; padding: 0 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; min-width: 0;
}
.row input::placeholder { color: var(--placeholder); }
.row input:focus { outline: none; border-color: var(--green-dark); }
.row .del {
  width: 46px; height: 46px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.row .del:hover { color: var(--danger); border-color: var(--danger-border); }
.row .del svg { width: 18px; height: 18px; }
.add-row {
  margin-top: 10px; align-self: flex-start; height: 40px; padding: 0 14px; border-radius: 8px;
  border: 1.5px dashed var(--border); background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.add-row svg { width: 16px; height: 16px; }

.form-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 8px; padding-top: 20px;
}
.form-actions .right { display: flex; gap: 10px; margin-left: auto; }

/* My listings */
.list-tabs { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.mine-list { display: flex; flex-direction: column; gap: 12px; }
.mine {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px;
}
.mine img { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; background: var(--soft); display: block; }
.mine-info { min-width: 0; }
.mine-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); text-decoration: none; display: block; }
.mine-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.mine-price { font-size: 16px; font-weight: 700; margin-top: 2px; }
.mine-meta { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.pill { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--green-tint); color: var(--green-dark); }
.pill.off { background: var(--soft); color: var(--muted); }
.mine-actions { display: flex; gap: 8px; align-items: center; }
.mine-actions .btn-secondary { height: 40px; padding: 0 14px; font-size: 14px; }
.icon-del {
  width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-del:hover { color: var(--danger); border-color: var(--danger-border); }
.icon-del svg { width: 18px; height: 18px; }

.empty-state { padding: 56px 16px; text-align: center; border: 1.5px dashed var(--border); border-radius: 12px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); }

@media (max-width: 760px) {
  .form-page { padding: 12px 16px 120px; }
  .form-head h1 { font-size: 20px; }
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .photos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photos.single { max-width: none; }
  .row { grid-template-columns: minmax(0, 1fr) 110px 46px; }
  .form-actions .right { flex: 1; }
  .form-actions .right > * { flex: 1; }
  .mine { grid-template-columns: 72px minmax(0, 1fr); }
  .mine img { width: 72px; height: 72px; }
  .mine-actions { grid-column: 1 / -1; }
  .mine-actions .btn-secondary { flex: 1; }
}


/* Sell / Offer: Publish at the top, photos on the left (laptop), like Carousell */
.form-head:has(.head-actions) { justify-content: flex-start; }
.head-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.clear-btn { border: 0; background: none; padding: 8px 4px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.clear-btn:hover { color: var(--ink); }
@media (min-width: 761px) {
  .form-head:has(.head-actions) { position: sticky; top: 79px; z-index: 5; background: var(--bg); padding: 12px 0; margin: -12px 0 8px; }
}
@media (max-width: 760px) { .head-actions { display: none; } }

@media (min-width: 1000px) {
  .form-cols { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .col-media { position: sticky; top: 156px; }
  .col-media .photos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .col-media .photos.single { max-width: none; grid-template-columns: minmax(0, 1fr); }
}

/* Price: for sale or free */
.deal { display: inline-flex; gap: 6px; margin-bottom: 8px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; height: 20px; }
.label-row > label { margin-bottom: 0 !important; }
.label-row .deal { margin: 0; }
.field .deal label { margin: 0; font-size: 12px; }
.deal label { position: relative; padding: 2px 10px; line-height: 18px; border-radius: 6px; border: 1.5px solid var(--border-soft); font-size: 13px; font-weight: 600; cursor: pointer; }
.deal input { position: absolute; opacity: 0; pointer-events: none; }
.deal label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.deal label:has(input:focus-visible) { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.money.is-free { opacity: .45; }

/* What each condition means */
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Cover photo: drag to reorder, or "Make cover" */
.photo[draggable="true"] { cursor: grab; }
.photo.dragging { opacity: .4; }
.photo.drop-target { outline: 2px solid var(--green); outline-offset: 2px; }
.photo .make-cover {
  position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; border-radius: 6px; border: 0;
  background: rgba(0,0,0,.6); color: #FFFFFF; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
}
.photo .make-cover:hover { background: rgba(0,0,0,.8); }
.photo-tip { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
