/* ============ MotorBekas design system ============ */
:root {
  --brand: #e02d2d;
  --brand-dark: #b92020;
  --brand-soft: #fdecec;
  --ink: #16181d;
  --muted: #667085;
  --line: #e5e7eb;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ok: #0f9960;
  --ok-soft: #e6f6ef;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.18);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; }
.brand-text span { color: var(--brand); }
.header-nav { display: flex; gap: 6px; align-items: center; }
.nav-link { padding: 8px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.nav-link:hover { background: var(--bg); color: var(--ink); }
.nav-link.active { color: var(--brand); background: var(--brand-soft); }

/* ---------- hero ---------- */
.hero {
  background: radial-gradient(1200px 500px at 85% -20%, rgba(224, 45, 45, 0.35), transparent 60%),
              linear-gradient(135deg, #191c23 0%, #23272f 55%, #2a1d1d 100%);
  color: #fff;
  padding: 56px 0 64px;
  margin-bottom: 28px;
}
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 10px; }
.hero h1 em { font-style: normal; color: #ff8f8f; }
.hero p { color: #c9ced9; max-width: 560px; margin: 0 0 24px; font-size: 16px; }
.hero-search { display: flex; gap: 10px; max-width: 640px; background: #fff; padding: 8px; border-radius: 14px; box-shadow: var(--shadow-lg); }
.hero-search input { flex: 1; border: 0; outline: 0; padding: 10px 14px; font-size: 15px; border-radius: 10px; color: var(--ink); background: transparent; }
.hero-stats { display: flex; gap: 28px; margin-top: 30px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.hero-stat span { color: #aab1bf; font-size: 13px; }

/* ---------- filter bar ---------- */
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px;
  transition: all 0.15s;
}
.chip:hover { border-color: #cfd4dc; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filterbar .spacer { flex: 1; }
.select {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
}

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; padding-bottom: 48px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform 0.18s, box-shadow 0.18s;
  display: flex; flex-direction: column; position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-img { aspect-ratio: 4 / 3; background: #eceef1; position: relative; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .badge { position: absolute; top: 10px; left: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-sold { background: #fee4e2; color: #b42318; }
.badge-brand { background: rgba(22, 24, 29, 0.78); color: #fff; backdrop-filter: blur(4px); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-weight: 700; font-size: 15px; line-height: 1.35; letter-spacing: -0.01em; }
.card-specs { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.card-specs span { display: inline-flex; align-items: center; gap: 5px; }
.card-foot { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: 8px; }
.price { font-weight: 800; font-size: 17px; color: var(--brand); letter-spacing: -0.02em; }
.card-loc { color: var(--muted); font-size: 12px; font-weight: 500; }

/* ---------- skeleton & empty ---------- */
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, #eceef1 40%, #f6f7f8 50%, #eceef1 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--line); }
.skeleton .sk-img { aspect-ratio: 4/3; }
.skeleton .sk-line { height: 13px; margin: 14px 16px; border-radius: 6px; }
.skeleton .sk-line.w60 { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty {
  grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted);
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty b { color: var(--ink); display: block; font-size: 17px; margin-bottom: 6px; }

/* ---------- detail ---------- */
.detail-wrap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; padding: 8px 0 48px; align-items: start; }
@media (max-width: 860px) { .detail-wrap { grid-template-columns: 1fr; } }
.crumb { color: var(--muted); font-size: 13px; margin: 18px 0 14px; font-weight: 500; }
.crumb a:hover { color: var(--brand); }
.gallery-main { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; background: #eceef1; border: 1px solid var(--line); position: relative; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button { border: 2px solid transparent; border-radius: 10px; overflow: hidden; width: 92px; flex: 0 0 auto; padding: 0; background: #eceef1; }
.gallery-thumbs button.active { border-color: var(--brand); }
.gallery-thumbs img { aspect-ratio: 4/3; object-fit: cover; width: 100%; height: 100%; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.price-panel { position: sticky; top: 78px; }
.price-big { font-size: 30px; font-weight: 800; color: var(--brand); letter-spacing: -0.03em; }
.price-note { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.spec-table td:first-child { color: var(--muted); width: 42%; font-weight: 500; }
.spec-table td:last-child { font-weight: 700; }
.spec-table tr:last-child td { border-bottom: 0; }
.desc { white-space: pre-wrap; color: #344054; }
.wa-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #16a34a; color: #fff; border: 0; border-radius: 12px;
  padding: 13px 18px; font-weight: 700; font-size: 15px; transition: background 0.15s;
}
.wa-btn:hover { background: #128a3e; }
.section-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; margin: 34px 0 14px; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 1120px; margin: 0 auto; padding: 26px 20px 60px; }
.login-card { max-width: 400px; margin: 60px auto; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 6px; background: #fff; border: 1px solid var(--line); padding: 5px; border-radius: 12px; width: max-content; }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.tab.active { background: var(--ink); color: #fff; }
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fafbfc; }
.tbl .row-title { font-weight: 700; }
.tbl .row-sub { color: var(--muted); font-size: 12px; }
.thumb-sm { width: 62px; height: 46px; object-fit: cover; border-radius: 8px; background: #eceef1; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 16px; font-weight: 700; font-size: 14px; transition: all 0.15s;
}
.btn:hover { background: #f6f7f8; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2b2f38; }
.btn-danger { color: #b42318; border-color: #fecdca; background: #fff; }
.btn-danger:hover { background: #fef3f2; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 13px; color: #344054; }
.field .hint { font-weight: 500; color: var(--muted); font-size: 12px; }
.input, .field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; color: var(--ink); outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.dropzone {
  border: 2px dashed #cfd4dc; border-radius: var(--radius); background: #fafbfc;
  padding: 26px 16px; text-align: center; color: var(--muted); cursor: pointer;
  transition: all 0.15s; font-weight: 600;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.dropzone b { color: var(--ink); }
.dz-hint { font-size: 12px; margin-top: 6px; font-weight: 500; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #eceef1; }
.thumb-item img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.thumb-item .badge { position: absolute; top: 6px; left: 6px; }
.thumb-actions { display: flex; border-top: 1px solid var(--line); background: #fff; }
.thumb-actions button { flex: 1; border: 0; background: transparent; padding: 7px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.thumb-actions button:hover { color: var(--ink); background: #f6f7f8; }
.thumb-actions button.del { color: #b42318; border-left: 1px solid var(--line); }
.thumb-actions button.del:hover { background: #fef3f2; }

.storage-card { display: flex; gap: 14px; align-items: center; }
.storage-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); font-size: 20px; font-weight: 800; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16, 20, 28, 0.55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 14px;
  overflow-y: auto; backdrop-filter: blur(3px);
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 720px;
  box-shadow: var(--shadow-lg); animation: pop 0.18s ease;
}
.modal.narrow { max-width: 440px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; border-radius: 16px 16px 0 0; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; border-radius: 0 0 16px 16px; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }

/* ---------- toast ---------- */
.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn 0.2s ease;
  max-width: 90vw; text-align: center;
}
.toast.err { background: #b42318; }
.toast.ok { background: #0f9960; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

/* ---------- footer ---------- */
.site-footer { background: #16181d; color: #9aa1af; padding: 34px 0; margin-top: 20px; font-size: 13.5px; }
.footer-inner { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.footer-inner b { color: #fff; display: block; margin-bottom: 4px; font-size: 14px; }

.view-root { min-height: calc(100vh - 62px - 130px); }
@media (max-width: 640px) {
  .hero { padding: 40px 0 48px; }
  .hero-stats { gap: 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .price { font-size: 15px; }
  .card-body { padding: 11px 12px 12px; }
  .card-title { font-size: 13.5px; }
}


/* Admin dashboard uses a standalone route and hides public-site navigation/footer. */
body.standalone-admin #siteHeader,
body.standalone-admin #siteFooter { display: none !important; }
body.standalone-admin .view-root { min-height: 100vh; padding-top: 24px; }
body.standalone-admin { background: var(--bg, #f7f8fa); }
