/* =============================================================
   Preloved Seller Portal — v1.2.2
   ============================================================= */
:root {
  --psp-green:      #2d4a3e;
  --psp-green-dark: #1e3329;
  --psp-amber:      #d4940a;
  --psp-bg:         #f6f5ef;
  --psp-border:     #deded4;
  --psp-text:       #1f241f;
  --psp-muted:      #6c716b;
  --psp-error:      #b42318;
  --psp-success:    #147a42;
  --psp-radius:     16px;
  --psp-shadow:     0 12px 35px rgba(20,30,25,.10);
}

/* ── Base card / wrapper ── */
.psp-card, .psp-listing, .psp-dashboard {
  max-width: 1080px;
  margin: 24px auto;
  background: #fff;
  border-radius: var(--psp-radius);
  box-shadow: var(--psp-shadow);
  overflow: hidden;
  color: var(--psp-text);
  /* FIX: use inherit so the theme font always wins */
  font-family: inherit;
}
/* FIX: ensure all child elements inherit the theme font */
.psp-card *, .psp-listing *, .psp-dashboard *, .psp-notice * {
  font-family: inherit;
}

.psp-card { display: flex; }

/* ── Sidebar ── */
.psp-side {
  width: 330px;
  background: var(--psp-green);
  color: #fff;
  padding: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.psp-side h2 { font-size: 34px; line-height: 1.1; margin: 18px 0; color: #fff; font-family: inherit; }
.psp-side h2 span { color: var(--psp-amber); }
.psp-side p, .psp-side li { opacity: .9; }
.psp-side ul { padding-left: 18px; }

.psp-logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--psp-amber);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px;
}

/* ── Main section ── */
.psp-main { flex: 1; padding: 38px; }
.psp-main h3,
.psp-listing h2,
.psp-dashboard h2 { margin: 0 0 18px; font-size: 30px; font-family: inherit; }

/* ── Progress bar ── */
.psp-progress {
  display: flex;
  gap: 8px;
  margin: 0 0 28px;
}
.psp-progress span {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 999px;
  background: var(--psp-bg);
  color: var(--psp-muted);
  font-size: 13px;
  font-weight: 700;
  /* FIX: prevent text from clipping — allow wrapping */
  white-space: normal;
  word-break: break-word;
}
.psp-progress span.active { background: var(--psp-green); color: #fff; }
.psp-progress span.done   { background: var(--psp-green); color: #fff; opacity: .85; }

/* ── Form elements ── */
.psp-form label {
  display: block;
  margin: 16px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
  color: var(--psp-muted);
}
.psp-form input,
.psp-form select,
.psp-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--psp-border);
  border-radius: 10px;
  padding: 13px 44px 13px 44px; /* left padding for icon, right for select arrow */
  font: inherit;
  background: #fff;
  min-height: 52px;
  /* Icons via background-image */
  background-repeat: no-repeat;
  background-position: 15px center;
  background-size: 17px 17px;
}
.psp-form textarea {
  min-height: 110px;
  padding-top: 14px;
  background-position: 15px 16px;
}
.psp-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
}
.psp-form input:focus,
.psp-form select:focus,
.psp-form textarea:focus {
  outline: 2px solid rgba(212,148,10,.2);
  border-color: var(--psp-amber);
}
.psp-form label + input,
.psp-form label + select,
.psp-form label + textarea { margin-bottom: 8px; }

/* Field icons */
.psp-form input[type="email"],
.psp-form input[name*="email"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='20' height='16' x='2' y='4' rx='2'/%3E%3Cpath d='m22 7-10 6L2 7'/%3E%3C/svg%3E");
}
.psp-form input[type="password"],
.psp-form input[name*="password"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}
.psp-form input[type="tel"],
.psp-form input[name*="phone"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2A19.8 19.8 0 0 1 3.08 5.18 2 2 0 0 1 5.06 3h3a2 2 0 0 1 2 1.72c.12.89.33 1.76.62 2.6a2 2 0 0 1-.45 2.11L9 10.7a16 16 0 0 0 4.3 4.3l1.27-1.23a2 2 0 0 1 2.11-.45c.84.29 1.71.5 2.6.62A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
}
.psp-form input[name*="first"],
.psp-form input[name*="last"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}
.psp-form input[name*="store"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 21h18'/%3E%3Cpath d='M5 21V7l8-4v18'/%3E%3Cpath d='M19 21V11l-6-4'/%3E%3Cpath d='M9 9v.01'/%3E%3Cpath d='M9 12v.01'/%3E%3Cpath d='M9 15v.01'/%3E%3C/svg%3E");
}
.psp-form input[name*="street"],
.psp-form input[name*="suburb"],
.psp-form input[name*="city"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}
.psp-form input[name*="title"],
.psp-form input[name*="subject"],
.psp-form input[name*="author"],
.psp-form input[name*="isbn"],
.psp-form input[name*="year"],
.psp-form input[name*="edition"],
.psp-form textarea {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M4 4.5A2.5 2.5 0 0 1 6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5z'/%3E%3C/svg%3E");
}
.psp-form input[name*="price"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8a5 5 0 0 1 0 10H6z'/%3E%3Cpath d='M6 13h8l4 8'/%3E%3Cpath d='M6 3v18'/%3E%3C/svg%3E");
}
.psp-form input[name*="stock"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7.5 4.27 9 5.15'/%3E%3Cpath d='M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z'/%3E%3Cpath d='m3.3 7 8.7 5 8.7-5'/%3E%3Cpath d='M12 22V12'/%3E%3C/svg%3E");
}
.psp-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 6h13'/%3E%3Cpath d='M8 12h13'/%3E%3Cpath d='M8 18h13'/%3E%3Cpath d='M3 6h.01'/%3E%3Cpath d='M3 12h.01'/%3E%3Cpath d='M3 18h.01'/%3E%3C/svg%3E");
}
.psp-form select[name*="province"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23889483' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}

/* ── Grid helpers ── */
.psp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.psp-row p { margin: 0; }

/* ── Step visibility ── */
.psp-step { display: none; }
.psp-step.active { display: block; }
.psp-step-label { text-transform: uppercase; font-size: 12px; font-weight: 800; color: var(--psp-amber); letter-spacing: .08em; }

/* ── Utility text ── */
.psp-hint { font-size: 13px; color: var(--psp-muted); margin-top: 6px; }
.psp-store-check { display: block; margin-top: 6px; }
.psp-store-check.ok  { color: var(--psp-success); }
.psp-store-check.bad { color: var(--psp-error); }
.psp-error { display: none; margin: 14px 0; font-weight: 700; color: var(--psp-error); }

/* ── Buttons ── */
.psp-btn, .psp-small {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--psp-green);
  color: #fff !important;
  padding: 13px 22px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  line-height: 1.2;
  /* FIX: no margin-top here — controlled by .psp-actions */
}
.psp-btn:hover, .psp-small:hover { background: var(--psp-green-dark); color: #fff; }
.psp-btn:disabled, .psp-small:disabled { opacity: .65; cursor: wait; }
.psp-btn-light {
  background: var(--psp-bg);
  color: var(--psp-text) !important;
  border: 1px solid var(--psp-border);
}
.psp-btn-light:hover { background: #ecebe3; color: var(--psp-text) !important; }

/* ── Actions row ── */
/* FIX: actions always have top spacing; buttons inside never need their own margin-top */
.psp-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  flex-wrap: wrap;
}
.psp-actions .psp-btn { margin-top: 0; }
.psp-dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.psp-dashboard-actions .psp-btn { margin-top: 0; }

/* ── Notices ── */
.psp-success {
  background: #eefaf3;
  border: 1px solid #bfe8cc;
  color: #123b24;
  border-radius: 14px;
  padding: 24px;
  margin-top: 18px;
}
.psp-notice {
  max-width: 900px;
  margin: 18px auto;
  padding: 14px 18px;
  border-radius: 12px;
  background: #eef3f0;
  border: 1px solid var(--psp-border);
}
.psp-notice-error   { background: #fff1f0; }
.psp-notice-warning { background: #fff8e6; }

/* ── Listing wrapper ── */
.psp-listing { padding: 34px; box-sizing: border-box; }

/* ── Condition / size choice cards ── */
.psp-choice-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 8px; }
.psp-size-grid   { grid-template-columns: repeat(5,1fr); }
.psp-choice-list { display: grid; gap: 12px; }
.psp-choice {
  display: block;
  border: 1px solid var(--psp-border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
}
.psp-choice input  { display: none; }
.psp-choice strong { display: block; }
.psp-choice small  { display: block; color: var(--psp-muted); margin-top: 4px; }
.psp-choice.selected {
  border-color: var(--psp-green);
  box-shadow: 0 0 0 2px rgba(45,74,62,.12);
  background: #f5faf7;
}

/* ── Commission panel ── */
.psp-commission {
  border-left: 4px solid var(--psp-amber);
  background: #fff8e8;
  padding: 14px;
  border-radius: 10px;
  margin: 14px 0;
}
.psp-commission strong,
.psp-commission small { display: block; }
.psp-commission small { color: var(--psp-muted); margin-top: 4px; }

/* ── Photo upload ── */
.psp-upload {
  border: 2px dashed var(--psp-border);
  border-radius: 14px;
  background: var(--psp-bg);
  padding: 34px;
  text-align: center;
  cursor: pointer;
}
.psp-upload strong,
.psp-upload small { display: block; }
.psp-upload small { color: var(--psp-muted); margin-top: 5px; }
.psp-upload input[type="file"] { display: none; }

.psp-preview {
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 10px;
  margin: 14px 0;
}
.psp-preview-item {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--psp-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 12px;
  color: var(--psp-muted);
  text-align: center;
}
.psp-preview-item img   { width: 100%; height: 100%; object-fit: cover; }
.psp-preview-item.error { color: var(--psp-error); padding: 6px; box-sizing: border-box; }

/* ── Summary panel ── */
.psp-summary { background: var(--psp-bg); border-radius: 12px; padding: 16px; margin-top: 16px; }
.psp-summary h4 { margin: 0 0 8px; }
.psp-summary span { display: block; margin: 3px 0; }

/* ── Dashboard ── */
.psp-dashboard { padding: 30px; box-sizing: border-box; }
.psp-dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.psp-table-wrap { overflow: auto; }
.psp-table { width: 100%; border-collapse: collapse; }
.psp-table th,
.psp-table td { text-align: left; border-bottom: 1px solid var(--psp-border); padding: 12px; vertical-align: middle; }
.psp-table th  { font-size: 12px; text-transform: uppercase; color: var(--psp-muted); }
.psp-thumb     { width: 58px; height: 58px; object-fit: cover; border-radius: 9px; }
.psp-no-thumb  { font-size: 12px; color: var(--psp-muted); background: var(--psp-bg); border-radius: 8px; padding: 10px; text-align: center; }
.psp-small     { font-size: 12px; padding: 8px 12px; margin: 2px; border-radius: 8px; }
.psp-delete    { background: #9b1c1c; }
.psp-status    { display: inline-block; background: var(--psp-bg); border-radius: 999px; padding: 5px 9px; font-size: 12px; }
.psp-empty     { background: var(--psp-bg); padding: 28px; border-radius: 14px; text-align: center; }

/* ── Responsive ── */
@media (max-width: 820px) {
  .psp-card        { display: block; }
  .psp-side        { width: auto; padding: 28px; }
  .psp-main,
  .psp-listing,
  .psp-dashboard   { padding: 24px; }
  .psp-row         { grid-template-columns: 1fr; }
  .psp-choice-grid,
  .psp-size-grid   { grid-template-columns: repeat(2,1fr); }
  .psp-preview     { grid-template-columns: repeat(3,1fr); }
  .psp-dashboard-header { display: block; }
  .psp-dashboard-actions { margin-top: 14px; }
  .psp-progress    { overflow: auto; }
  .psp-progress span { min-width: 80px; }
  .psp-side h2     { font-size: 28px; }
}
@media (max-width: 480px) {
  .psp-choice-grid,
  .psp-size-grid   { grid-template-columns: 1fr; }
  .psp-preview     { grid-template-columns: repeat(2,1fr); }
  .psp-actions .psp-btn { width: 100%; text-align: center; }
  .psp-main h3,
  .psp-listing h2,
  .psp-dashboard h2 { font-size: 25px; }
}


/* ── Registration-style listing layout ── */
.psp-listing-wrap.psp-card {
  display: flex;
  padding: 0;
}
.psp-listing-wrap .psp-listing-side {
  min-height: 560px;
}
.psp-listing-wrap .psp-listing-side h2 {
  font-size: 30px;
  line-height: 1.12;
}
.psp-listing-wrap .psp-listing-main {
  padding: 38px;
}
.psp-listing-wrap .psp-progress {
  margin-bottom: 28px;
}
.psp-listing-wrap .psp-choice-grid {
  grid-template-columns: repeat(3, 1fr);
}
.psp-listing-wrap .psp-size-grid {
  grid-template-columns: repeat(5, 1fr);
}
.psp-listing-wrap .psp-choice {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
}
.psp-listing-wrap .psp-choice strong {
  font-size: 13px;
}
.psp-listing-wrap .psp-actions .psp-btn:last-child {
  min-width: 180px;
}
.psp-select-search {
  margin-bottom: 0 !important;
}
.psp-select-search + .psp-search-results + select,
.psp-select-search + select {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
}
.psp-search-results {
  display: none;
  margin-top: 8px;
  margin-bottom: 14px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d9dfd8;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(16, 44, 33, 0.14);
  z-index: 30;
  position: relative;
}
.psp-search-results.open {
  display: block;
}
.psp-search-result {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #eef1ed;
  background: #fff;
  color: #183c2f;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.psp-search-result:last-child {
  border-bottom: 0;
}
.psp-search-result:hover,
.psp-search-result:focus {
  background: #f4f8f3;
}
.psp-search-result.is-empty {
  color: #7a857d;
  cursor: default;
}

/* ── Add School / University inline UI ── */
.psp-add-item-wrap {
  margin-top: 8px;
}
.psp-add-item-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--psp-amber);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.psp-add-item-toggle:hover { color: var(--psp-green); }
.psp-add-item-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.psp-add-item-form input[type="text"] {
  flex: 1;
  min-width: 180px;
  border-radius: 8px;
  border: 1px solid var(--psp-border);
  padding: 10px 14px;
  font: inherit;
  background: #fff;
  background-image: none;
  min-height: 44px;
  box-sizing: border-box;
}
.psp-add-item-form input[type="text"]:focus {
  outline: 2px solid rgba(212,148,10,.2);
  border-color: var(--psp-amber);
}
.psp-btn-sm {
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 8px;
  white-space: nowrap;
}
.psp-add-item-msg {
  font-size: 13px;
  font-weight: 700;
}
.psp-add-item-msg.ok  { color: var(--psp-success); }
.psp-add-item-msg.err { color: var(--psp-error); }

@media (max-width: 820px) {
  .psp-listing-wrap.psp-card { display: block; }
  .psp-listing-wrap .psp-listing-side { min-height: 0; }
  .psp-listing-wrap .psp-choice-grid,
  .psp-listing-wrap .psp-size-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .psp-listing-wrap .psp-choice-grid,
  .psp-listing-wrap .psp-size-grid { grid-template-columns: 1fr; }
}
