/* ==========================================================
   주유소 장터 — 스타일
   색: 짙은 남색(신뢰) + 주황(주유소/행동 유도)
   ========================================================== */
:root {
  --navy: #0f2a44;
  --navy-2: #163a5c;
  --orange: #f26b1d;
  --orange-2: #d95a12;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1c2430;
  --muted: #6b7684;
  --green: #1a9c5b;
  --red: #d7343a;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(16, 32, 56, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard", "Noto Sans KR", -apple-system, "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- 상단바 ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--navy); white-space: nowrap; }
.logo-mark { font-size: 24px; }
.search { flex: 1; display: flex; max-width: 520px; }
.search input {
  flex: 1; padding: 10px 14px; border: 2px solid var(--line); border-right: 0;
  border-radius: 8px 0 0 8px; outline: none;
}
.search input:focus { border-color: var(--orange); }
.search button {
  padding: 10px 16px; border: 2px solid var(--orange); background: var(--orange); color: #fff;
  border-radius: 0 8px 8px 0; cursor: pointer; font-weight: 700;
}
.topnav { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.catbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.catbar::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); cursor: pointer; font-weight: 600;
}
.cat.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 700; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-2); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-lg { padding: 14px 22px; font-size: 17px; width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 본문 ---------- */
main { flex: 1; padding: 20px 16px 48px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 16px; flex-wrap: wrap; gap: 8px; }
.page-head h1 { margin: 0; font-size: 22px; color: var(--navy); }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* 안내 띠 */
.hero {
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.hero h2 { margin: 0 0 4px; font-size: 20px; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }

/* ---------- 상품 카드 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(16,32,56,.14); }
.thumb { aspect-ratio: 4/3; background: #dfe3e8; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 48px; color: #fff; }
.badge {
  position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--navy);
}
.badge.bid { background: var(--orange); }
.badge.sold { background: #555; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 700; font-size: 15px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 44px; }
.card-price { font-size: 18px; font-weight: 800; color: var(--navy); }
.card-price small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }

.empty { text-align: center; padding: 60px 0; color: var(--muted); }

/* ---------- 상세 ---------- */
.detail { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.gallery { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.gallery .main { aspect-ratio: 4/3; background: #dfe3e8; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; display: block; background: #111; }
.gallery .thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.gallery .thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.gallery .thumbs img.active { border-color: var(--orange); }

.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel h1 { font-size: 21px; margin: 0 0 6px; }
.panel h3 { font-size: 15px; margin: 0 0 10px; color: var(--navy); }
.price-big { font-size: 30px; font-weight: 900; color: var(--navy); margin: 8px 0; }
.price-big small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.kv { display: grid; grid-template-columns: 90px 1fr; row-gap: 6px; font-size: 14px; margin: 12px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.desc { white-space: pre-wrap; font-size: 15px; line-height: 1.7; }

.contact-box { background: #fff7f1; border: 1px dashed var(--orange); border-radius: 10px; padding: 14px; text-align: center; margin-top: 14px; }
.contact-box .phone { font-size: 24px; font-weight: 900; color: var(--orange-2); letter-spacing: .5px; }
.contact-box .note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.bid-row { display: flex; gap: 8px; margin-top: 10px; }
.bid-row input { flex: 1; padding: 12px; border: 2px solid var(--line); border-radius: 8px; font-size: 16px; font-weight: 700; }
.bid-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.bid-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bid-list li:first-child { color: var(--green); font-weight: 800; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #eef2f6; color: var(--navy); }
.tag.orange { background: #fff0e6; color: var(--orange-2); }

/* ---------- 폼 ---------- */
.form-card { max-width: 640px; margin: 0 auto; }
.form-card.narrow { max-width: 440px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field label .req { color: var(--red); }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="number"],
.field input[type="password"], .field input[type="date"], .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 2px solid var(--line); border-radius: 8px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--orange); }
.field textarea { min-height: 140px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field.row { display: flex; gap: 8px; }
.field.row > * { flex: 1; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.radio-group { display: flex; gap: 8px; }
.radio-group label {
  flex: 1; border: 2px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; font-weight: 600;
  display: flex; flex-direction: column; gap: 2px;
}
.radio-group label small { font-weight: 400; color: var(--muted); font-size: 12px; }
.radio-group input { display: none; }
.radio-group label.checked { border-color: var(--orange); background: #fff7f1; }
.photo-drop {
  border: 2px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer;
}
.photo-drop:hover { border-color: var(--orange); }
.photo-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-preview .p { position: relative; width: 90px; height: 68px; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.photo-preview button {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: var(--red); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; padding: 0;
}
.verify-ok { color: var(--green); font-weight: 700; font-size: 13px; }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert.info { background: #eef4ff; color: #1d4ed8; }
.alert.warn { background: #fff4e5; color: #9a5300; }
.form-foot { font-size: 13px; color: var(--muted); text-align: center; margin-top: 14px; }
.form-foot a { color: var(--orange-2); font-weight: 700; }

/* ---------- 마이페이지 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; }
.tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row img, .list-row .ph { width: 80px; height: 60px; border-radius: 6px; object-fit: cover; background: #dfe3e8; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.list-row .info { flex: 1; min-width: 0; }
.list-row .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .act { display: flex; gap: 6px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 하단 ---------- */
.footer { background: #fff; border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: 13px; }
.footer p { margin: 4px 0; }

/* ---------- 반응형 ---------- */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; gap: 8px; }
  .search { order: 3; width: 100%; max-width: none; }
  .topnav { margin-left: auto; }
  .topnav .btn { padding: 8px 12px; font-size: 14px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-title { font-size: 14px; min-height: 40px; }
  .card-price { font-size: 16px; }
  .card-price small { display: block; margin-left: 0; }
  .field.row { flex-direction: column; gap: 0; }
}
