/* Carflix — mobile-first stylesheet. One file, public site + admin.
   Design: deep navy brand, warm orange CTA, generous tap targets, single column. */

:root {
  --navy: #0b1f3a;
  --navy-2: #14315a;
  --orange: #ff6a2b;
  --orange-dark: #e85716;
  --ink: #1a2230;
  --muted: #6b7585;
  --line: #e6e9ef;
  --bg: #f4f6fa;
  --card: #ffffff;
  --green: #1f9d57;
  --red: #d23a3a;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(16, 30, 54, .07);
  --maxw: 760px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1rem;
  background: var(--navy);
  color: #fff;
}
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.brand-mark span { color: var(--orange); }
.header-cta { white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.1rem; border: 0; border-radius: 10px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  background: #e9edf3; color: var(--ink); transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:active { background: var(--orange-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-ghost   { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-block   { display: flex; width: 100%; }
.btn-sm { padding: .45rem .8rem; font-size: .9rem; }
.btn-lg { padding: .95rem 1.1rem; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- Sticky CTA + footer ---------- */
.sticky-cta {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 14px; z-index: 60;
  width: calc(100% - 2rem); max-width: calc(var(--maxw) - 2rem);
  background: var(--orange); color: #fff; text-align: center;
  padding: .9rem; border-radius: 12px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(255, 106, 43, .4);
}
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem 2rem; }

/* ---------- Cards / generic ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem;
}
.page-title { font-size: 1.5rem; margin: .2rem 0 .4rem; letter-spacing: -.02em; }
.section-title { font-size: 1.05rem; margin: 0 0 .6rem; }
.muted { color: var(--muted); font-size: .92rem; }
.center { text-align: center; }
.stack > * + * { margin-top: .6rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .95rem; }
.flash ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.flash-error   { background: #fdecec; color: #a12020; border: 1px solid #f3c6c6; }
.flash-success { background: #e7f7ee; color: #14603a; border: 1px solid #bfe8d1; }

/* ---------- Forms ---------- */
.form fieldset { border: 0; padding: 0; margin: 0 0 1.4rem; }
.form legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: .6rem; }
.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .3rem; color: #44505f; }
.field i { color: var(--orange); font-style: normal; }
input, select, textarea {
  width: 100%; padding: .75rem .8rem; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ---------- Photo slots ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.photo-slot { position: relative; display: block; cursor: pointer; }
.photo-slot input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-preview {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; border: 2px dashed #c7cfdb; border-radius: 12px;
  background-size: cover; background-position: center; color: #b3bccb;
}
.photo-plus { font-size: 1.8rem; line-height: 1; }
.photo-slot.filled .photo-preview { border-style: solid; border-color: var(--green); }
.photo-slot.filled .photo-plus { display: none; }
.photo-label { display: block; text-align: center; font-size: .78rem; margin-top: .25rem; color: #55606f; }

/* ---------- Hero + filter bar ---------- */
.hero { padding: .6rem .2rem 1rem; }
.hero h1 { font-size: 1.7rem; margin: 0 0 .2rem; letter-spacing: -.03em; }
.hero p { color: var(--muted); margin: 0; }
.filter-bar .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .6rem; }
.results-meta { font-size: .9rem; color: var(--muted); margin: .2rem .2rem 1rem; }
.results-meta span { color: var(--ink); font-weight: 700; }

/* ---------- Ad grid ---------- */
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.ad-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: block; }
.ad-thumb { aspect-ratio: 4 / 3; background: #d9dee7 center/cover no-repeat; }
.ad-body { padding: .6rem .7rem .8rem; }
.ad-body h3 { font-size: .98rem; margin: 0 0 .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-price { color: var(--orange-dark); font-weight: 800; font-size: 1.05rem; }
.ad-meta { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.ad-city { font-size: .8rem; color: var(--muted); }

/* ---------- Ad detail ---------- */
.breadcrumb { margin: .2rem 0 .8rem; font-size: .92rem; color: var(--muted); }
.gallery { margin-bottom: 1rem; }
.gallery-main img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: #d9dee7; cursor: zoom-in; }
.gallery-thumbs { display: grid; grid-auto-flow: column; grid-auto-columns: 64px; gap: .5rem; overflow-x: auto; padding: .6rem 0 .2rem; }
.gallery-thumb { width: 64px; height: 64px; border-radius: 8px; border: 2px solid transparent; background: #d9dee7 center/cover no-repeat; cursor: pointer; padding: 0; }
.gallery-thumb.active { border-color: var(--orange); }
.detail-head .detail-title { font-size: 1.35rem; margin: 0 0 .2rem; }
.detail-price { color: var(--orange-dark); font-weight: 800; font-size: 1.4rem; }
.detail-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.detail-tags span { background: #eef1f6; border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; color: #45505f; }
.spec-list { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .8rem; margin: 0; }
.spec-list > div { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px solid var(--line); gap: .5rem; }
.spec-list dt { color: var(--muted); font-size: .9rem; }
.spec-list dd { margin: 0; font-weight: 600; text-align: right; }
.desc { white-space: pre-line; }
.seller-card .seller-name { font-weight: 700; font-size: 1.05rem; margin: 0 0 .6rem; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 12px; right: 16px; background: none; border: 0; color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer; width: auto; }

.success-tick { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--green); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; }

/* ============ ADMIN ============ */
.admin { background: #eef1f6; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; background: var(--navy); color: #fff; flex-wrap: wrap; }
.admin-header .brand span { color: var(--orange); }
.admin-nav { display: flex; align-items: center; gap: .9rem; font-size: .92rem; }
.admin-nav a { color: #cdd7e6; }
.admin-nav a:hover { color: #fff; }
.admin-who { color: #8fa1ba; }
.admin-main { padding-bottom: 2rem; }

.login-wrap { max-width: 380px; margin: 2rem auto; }
.login-card .field { margin-bottom: 1rem; }

.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: .55rem .9rem; border-radius: 999px; background: #fff; color: #45505f; font-weight: 600; font-size: .92rem; white-space: nowrap; box-shadow: var(--shadow); }
.tab.active { background: var(--navy); color: #fff; }
.tab-count { display: inline-block; min-width: 1.4em; text-align: center; background: rgba(0,0,0,.12); border-radius: 999px; padding: 0 .35em; font-size: .82em; margin-left: .2rem; }
.tab.active .tab-count { background: rgba(255,255,255,.25); }

.admin-list { display: flex; flex-direction: column; gap: .6rem; }
.admin-row { display: flex; align-items: center; gap: .8rem; background: #fff; border-radius: 12px; padding: .6rem; box-shadow: var(--shadow); }
.admin-thumb { width: 72px; height: 56px; border-radius: 8px; background: #d9dee7 center/cover no-repeat; flex: none; }
.admin-row-body { flex: 1; min-width: 0; }
.admin-row-meta { font-size: .85rem; color: #55606f; }
.chev { color: #b3bccb; font-size: 1.5rem; }

.review-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.status-badge { font-size: .78rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; }
.status-pending { background: #fff3e0; color: #9a5b00; }
.status-approved { background: #e7f7ee; color: #14603a; }
.status-rejected { background: #fdecec; color: #a12020; }
.review-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.review-photos figure { margin: 0; }
.review-photos img { aspect-ratio: 1/1; object-fit: cover; border-radius: 10px; width: 100%; background: #d9dee7; }
.review-photos figcaption { text-align: center; font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.action-bar { display: flex; flex-direction: column; gap: .8rem; }
.reject-form { display: flex; flex-direction: column; gap: .5rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 600; }

/* ---------- Larger screens ---------- */
@media (min-width: 620px) {
  .ad-grid { grid-template-columns: repeat(3, 1fr); }
  .photo-grid, .review-photos { grid-template-columns: repeat(6, 1fr); }
}
