/* ============================================================
   topdevphone — Hagglr (classifieds) styles
   Price-forward marketplace cards, category chips, detail page,
   post form. All colors come from the shared CSS vars so the app
   reads correctly in BOTH the dark and light themes.
   ============================================================ */

/* ---------- search bar ---------- */
.hg-searchbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  margin: 0 14px 10px;
  padding: 8px 11px;
  background: var(--bg-secondary);
  border-radius: 12px;
}
.hg-searchbar .hg-sicon { color: var(--text-tertiary); font-size: 15px; display: flex; }
.hg-sinput {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  color: var(--text-primary); font-size: 14px;
}
.hg-sinput::placeholder { color: var(--text-tertiary); }
.hg-sclear {
  color: var(--text-tertiary); font-size: 13px; display: flex;
  padding: 2px; border-radius: 50%;
}

/* ---------- category chips ---------- */
.hg-chips {
  flex: 0 0 auto;
  display: flex; gap: 7px;
  padding: 0 14px 10px;
  overflow-x: auto; scrollbar-width: none;
}
.hg-chips::-webkit-scrollbar { height: 0; }
.hg-chip {
  flex: 0 0 auto;
  padding: 7px 13px; border-radius: 16px;
  background: var(--bg-secondary); color: var(--text-secondary);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.hg-chip .ic { width: 13px; height: 13px; margin-right: 3px; }
.hg-chip:active { transform: scale(0.95); }
.hg-chip.on {
  background: linear-gradient(140deg, #ff9500, #e0590b);
  color: #fff;
  box-shadow: 0 3px 10px rgba(224, 89, 11, 0.32);
}
.hg-chips.form { flex-wrap: wrap; overflow: visible; padding: 0 0 4px; }

/* ---------- listing grid ---------- */
.hg-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding-top: 2px;
}
.hg-card {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-card-lg);
  overflow: hidden; cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}
.hg-card:active { transform: scale(0.97); filter: brightness(0.9); }

.hg-thumb {
  position: relative;
  width: 100%; aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.85); font-size: 30px;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.hg-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.hg-thumb.ph::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 55%);
}
.hg-thumb.hero {
  aspect-ratio: 16 / 10; border-radius: var(--radius-card-lg);
  margin-bottom: 14px; font-size: 46px;
}

.hg-cbody { padding: 9px 11px 12px; }
.hg-price { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.hg-ctitle {
  font-size: 12.5px; font-weight: 500; color: var(--text-primary);
  margin-top: 2px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hg-cmeta {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 7px; font-size: 11px; color: var(--text-tertiary);
}
.hg-chip-sm {
  background: var(--bg-tertiary); color: var(--text-secondary);
  border-radius: 8px; padding: 3px 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px;
  white-space: nowrap;
}
.hg-mine-tag {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  border-radius: 8px; padding: 3px 7px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
  backdrop-filter: blur(6px);
}

/* ---------- floating post button ---------- */
.hg-fab {
  position: absolute; right: 16px; bottom: 84px; z-index: 5;
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  background: linear-gradient(140deg, #ff9500, #e0590b);
  box-shadow: 0 8px 20px rgba(224, 89, 11, 0.45);
  transition: transform 0.12s, filter 0.15s;
}
.hg-fab:active { transform: scale(0.92); filter: brightness(0.9); }

/* ---------- detail page ---------- */
.hg-dprice { font-size: 30px; font-weight: 800; letter-spacing: -0.8px; }
.hg-dtitle { font-size: 17px; font-weight: 600; margin-top: 3px; line-height: 1.3; }
.hg-dmeta {
  display: flex; align-items: center; gap: 9px;
  margin: 9px 0 4px; font-size: 12px; color: var(--text-tertiary);
}
.hg-desc {
  background: var(--bg-secondary); border-radius: var(--radius-card);
  padding: 13px; font-size: 13.5px; line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap; word-break: break-word;
  margin-bottom: 16px;
}
.hg-seller {
  display: flex; align-items: center; gap: 11px;
  background: var(--bg-secondary); border-radius: var(--radius-card);
  padding: 11px 13px; margin-bottom: 14px;
}
.hg-sav { width: 38px; height: 38px; font-size: 13px; }
.hg-smain { flex: 1; min-width: 0; }
.hg-sname { font-size: 14px; font-weight: 700; }
.hg-ssub { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }
.hg-act { margin-bottom: 10px; }
.hg-act#hg-contact { background: linear-gradient(140deg, #ff9500, #e0590b); }

.hg-revealed {
  background: var(--bg-secondary); border-radius: var(--radius-card);
  border: 1px solid color-mix(in srgb, var(--accent-orange) 45%, transparent);
  padding: 13px; margin-bottom: 14px; text-align: center;
  animation: hgReveal 0.28s cubic-bezier(0.32, 0.72, 0.35, 1);
}
@keyframes hgReveal { from { transform: translateY(-8px); opacity: 0; } }
.hg-rv-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-secondary);
}
.hg-rv-num { font-size: 21px; font-weight: 800; margin: 4px 0 10px; letter-spacing: 0.5px; }
.hg-rv-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 12px;
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 13px; font-weight: 700;
}
.hg-rv-btn .ic { width: 15px; height: 15px; }
.hg-rv-btn:active { filter: brightness(0.85); }

/* ---------- my listings ---------- */
.hg-sum {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.hg-sum > div {
  flex: 1; background: var(--bg-secondary);
  border-radius: var(--radius-card); padding: 12px 13px;
}
.hg-sum-n { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; }
.hg-sum-l {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-secondary); margin-top: 2px;
}
.hg-mprice { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.hg-icon-btn {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); color: var(--text-secondary); font-size: 13px;
}
.hg-icon-btn:active { filter: brightness(0.8); }
.hg-icon-btn.danger { color: var(--accent-red); }

/* ---------- post form ---------- */
.hg-photo {
  display: block; width: 100%; padding: 0; margin-bottom: 6px;
  cursor: pointer; position: relative; overflow: hidden;
  border-radius: var(--radius-card-lg); color: var(--text-primary);
  background: var(--bg-secondary); text-align: left;
}
.hg-photo:focus-visible,
.hg-inventory-item:focus-visible {
  outline: 2px solid var(--accent-blue); outline-offset: 2px;
}
.hg-photo-media {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.9); font-size: 34px;
}
.hg-photo-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  display: block; padding: 14px;
}
.hg-photo-caption {
  min-height: 52px; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
}
.hg-photo-caption > span:first-child { flex: 1; min-width: 0; }
.hg-photo-caption strong,
.hg-photo-caption small { display: block; }
.hg-photo-caption strong {
  font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hg-photo-caption small { color: var(--text-tertiary); font-size: 10.5px; margin-top: 2px; }
.hg-photo-caption > .ic { color: var(--text-tertiary); font-size: 13px; }
.hg-photo:active,
.hg-inventory-item:active { filter: brightness(0.88); }
.hg-photo:disabled,
.hg-inventory-item:disabled { opacity: 0.5; cursor: default; }
.hg-photo-ph small {
  color: rgba(255, 255, 255, 0.72); font-size: 10.5px;
}
.hg-photo-ph {
  aspect-ratio: 16 / 10; border-radius: var(--radius-card-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: rgba(255, 255, 255, 0.9); font-size: 30px;
}
.hg-photo-ph span { font-size: 12.5px; font-weight: 600; }

.hg-inventory-list {
  display: flex; flex-direction: column; gap: 8px;
}
.hg-inventory-item {
  width: 100%; min-height: 64px; padding: 8px 10px;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--radius-card); color: var(--text-primary);
  background: var(--bg-secondary); text-align: left;
}
.hg-inventory-thumb {
  position: relative; flex: 0 0 50px; width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 10px; font-size: 20px;
  color: var(--text-tertiary); background: var(--bg-tertiary);
}
.hg-inventory-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 4px;
}
.hg-inventory-main { flex: 1; min-width: 0; }
.hg-inventory-main strong,
.hg-inventory-main small { display: block; }
.hg-inventory-main strong {
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hg-inventory-main small {
  margin-top: 3px; color: var(--text-tertiary); font-size: 10.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hg-inventory-item > .ic { flex: 0 0 auto; color: var(--text-tertiary); font-size: 13px; }
.hg-priceinput {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-tertiary); border-radius: 11px; padding: 10px 13px;
}
.hg-priceinput span { font-size: 19px; font-weight: 800; color: var(--text-secondary); }
.hg-priceinput input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  color: var(--text-primary); font-size: 21px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hg-priceinput input::placeholder { color: var(--text-tertiary); }
.hg-textarea { min-height: 108px; line-height: 1.45; }
.hg-count {
  text-align: right; font-size: 11px; color: var(--text-tertiary);
  margin: 5px 2px 0; font-variant-numeric: tabular-nums;
}
.hg-post {
  margin-top: 18px;
  background: linear-gradient(140deg, #ff9500, #e0590b);
}
.hg-modal-note {
  text-align: center; color: var(--text-secondary);
  font-size: 13px; margin-bottom: 14px; word-break: break-word;
}

/* ---------- home-screen widget ---------- */
.hg-w { display: flex; flex-direction: column; gap: 7px; }
.hg-w-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.hg-w-title {
  flex: 1; min-width: 0; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hg-w-row b { font-size: 12.5px; font-weight: 800; }
.hg-w-empty { font-size: 12px; opacity: 0.65; }
