:root {
  --brand: #0f766e;
  --wa: #1fa855;
  --ink: #17212b;
  --muted: #64707d;
  --line: #e3e7ec;
  --bg: #f5f7f9;
  --card: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Cairo", system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; }
img, video, iframe { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.35; }

/* ---------- top bar ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.logo img { width: 34px; height: 34px; }
.topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: var(--ink); padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem; }
.topbar nav a:hover, .topbar nav a.on { background: var(--bg); }
.topbar nav a.btn-wa { color: #fff; }
.pill { background: #dc2626; color: #fff; border-radius: 99px; padding: 0 7px; font-size: .75rem; }

/* ---------- buttons ---------- */
.btn, .btn-wa { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 700; cursor: pointer; text-align: center; background: var(--brand); color: #fff; }
.btn-wa { background: var(--wa); color: #fff; }
.btn:hover, .btn-wa:hover { filter: brightness(1.07); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: #b91c1c; border: 1px solid #f3c4c4; }
.btn.sm, .btn-wa.sm { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }
.block { display: flex; width: 100%; margin-top: 10px; }

/* ---------- hero ---------- */
.hero { background: linear-gradient(135deg, var(--brand), #134e4a); color: #fff; padding: 36px 0 30px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 800; }
.hero h1 span { color: #a7f3d0; }
.hero p { margin: 0; max-width: 640px; opacity: .92; }
.hero.small { padding: 28px 0 24px; }

/* ---------- category tabs ---------- */
.tabs { display: flex; gap: 8px; margin: 20px 0 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs a { --c: var(--brand); flex: 0 0 auto; padding: 10px 18px; border-radius: 99px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); font-weight: 700; white-space: nowrap; }
.tabs a small { background: var(--bg); border-radius: 99px; padding: 0 8px; margin-inline-start: 4px; font-weight: 600; color: var(--muted); }
.tabs a.on { background: var(--c); border-color: var(--c); color: #fff; }
.tabs a.on small { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---------- filters ---------- */
.filters { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.filters summary { padding: 12px 16px; cursor: pointer; font-weight: 700; }
.filter-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 0 16px 16px; }
.filter-actions { display: flex; gap: 8px; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #cfd6de; border-radius: 9px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.results-count { color: var(--muted); margin: 6px 0 12px; font-weight: 600; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-bottom: 40px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--ink); transition: transform .15s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); }
.card.taken { opacity: .6; }
.card-img { position: relative; aspect-ratio: 4 / 3; background: #e9edf1; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 10px; right: 10px; color: #fff; padding: 3px 11px; border-radius: 99px; font-size: .82rem; font-weight: 700; }
.vid-badge { position: absolute; bottom: 10px; left: 10px; background: rgba(0, 0, 0, .65); color: #fff; padding: 2px 10px; border-radius: 99px; font-size: .8rem; }
.taken-badge { position: absolute; top: 10px; left: 10px; background: #111; color: #fff; padding: 3px 11px; border-radius: 99px; font-size: .82rem; font-weight: 700; }
.card-body { padding: 12px 14px 14px; }
.card-body h3 { margin: 2px 0 6px; font-size: 1rem; font-weight: 700; }
.price { color: var(--brand); font-weight: 800; font-size: 1.15rem; }
.price.big { font-size: 1.6rem; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .88rem; }
.code { margin-top: 6px; font-size: .78rem; color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; background: #fff; border-radius: var(--radius); margin-bottom: 40px; }

/* ---------- listing page ---------- */
.listing { padding-top: 16px; padding-bottom: 40px; }
.back { display: inline-block; margin-bottom: 12px; font-weight: 600; }
.listing-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.gallery { position: relative; border-radius: var(--radius); overflow: hidden; background: #e9edf1; aspect-ratio: 4 / 3; }
.gallery-main { width: 100%; height: 100%; object-fit: cover; }
.gnav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.gnav.prev { right: 10px; }
.gnav.next { left: 10px; }
.gcount { position: absolute; bottom: 10px; left: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .8rem; padding: 1px 9px; border-radius: 99px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; padding-bottom: 4px; }
.thumbs img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .6; flex: 0 0 auto; border: 2px solid transparent; }
.thumbs img.on { opacity: 1; border-color: var(--brand); }
.video { border-radius: var(--radius); overflow: hidden; background: #000; }
.video video { width: 100%; max-height: 75vh; }
.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.info { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: sticky; top: 76px; }
.info h1 { font-size: 1.25rem; margin: 4px 0; }
.area { color: var(--muted); margin: 0 0 12px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 6px; }
.specs div { background: var(--bg); border-radius: 9px; padding: 6px 10px; }
.specs dt { font-size: .75rem; color: var(--muted); }
.specs dd { margin: 0; font-weight: 700; }
.notice { background: #fef3c7; padding: 10px 12px; border-radius: 9px; margin-top: 10px; }
.sec-title { font-size: 1.15rem; margin: 26px 0 10px; }
.desc { background: #fff; padding: 16px; border-radius: var(--radius); }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.features li { background: #fff; padding: 8px 12px; border-radius: 9px; }

/* ---------- forms ---------- */
.visit { background: #fff; border-radius: var(--radius); padding: 20px; margin-top: 28px; box-shadow: var(--shadow); }
.visit h2 { margin: 0 0 4px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.form .full { grid-column: 1 / -1; }
.form .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.form .check input { width: auto; }
.form button.full { padding: 13px; font-size: 1.05rem; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 22px; }
.steps div { background: #fff; border-radius: var(--radius); padding: 14px; font-weight: 600; box-shadow: var(--shadow); }
.steps b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; margin-inline-end: 8px; }

/* ---------- footer ---------- */
.footer { background: #0f1a24; color: #c9d3dc; padding: 26px 0 90px; font-size: .92rem; margin-top: 30px; }
.footer strong { color: #fff; }
.wa-float { position: fixed; bottom: 18px; left: 18px; width: 58px; height: 58px; border-radius: 50%; background: var(--wa); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); z-index: 30; }

/* ---------- admin ---------- */
.admin-main { padding-top: 20px; padding-bottom: 60px; }
.admin-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-bar h1 { margin: 0; font-size: 1.4rem; flex: 1; }
.seg { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg a { padding: 6px 14px; color: var(--ink); font-weight: 600; }
.seg a.on { background: var(--brand); color: #fff; }
.card-box, .login { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.login { max-width: 380px; margin: 50px auto; display: grid; gap: 14px; }
.login h1 { margin: 0; font-size: 1.3rem; }
.error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 9px; }
.flash { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 9px; }
.admin-list { display: grid; gap: 10px; }
.arow { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; background: #fff; padding: 10px; border-radius: var(--radius); box-shadow: var(--shadow); }
.arow.taken { opacity: .65; }
.arow > img { width: 96px; height: 72px; object-fit: cover; border-radius: 9px; }
.arow .t { font-weight: 700; }
.arow small { color: var(--muted); }
.arow-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.arow-actions form { display: contents; }
.tag { display: inline-block; color: #fff; background: #475569; padding: 0 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.tag.star { background: #ca8a04; }
.tag.gray { background: #6b7280; }
.tag.owner { background: #7c3aed; }
.warn { color: #b45309; font-weight: 700; }
.edit-form { background: #fff; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.radio-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-cards label { --c: var(--brand); flex-direction: row; cursor: pointer; }
.radio-cards input { position: absolute; opacity: 0; width: 1px; }
.radio-cards span { padding: 9px 18px; border: 1.5px solid var(--line); border-radius: 99px; font-weight: 700; }
.radio-cards input:checked + span { background: var(--c); border-color: var(--c); color: #fff; }
.radio-cards input:focus-visible + span { outline: 2px solid var(--c); outline-offset: 2px; }
.img-manager { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.thumb { position: relative; width: 120px; height: 90px; border-radius: 9px; overflow: hidden; background: #e9edf1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:first-child { outline: 3px solid #ca8a04; }
.thumb:first-child::after { content: "الغلاف"; position: absolute; bottom: 0; right: 0; left: 0; background: rgba(202, 138, 4, .9); color: #fff; font-size: .72rem; text-align: center; }
.thumb button { position: absolute; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-size: .8rem; }
.thumb .t-del { left: 4px; }
.thumb .t-cover { right: 4px; }
.thumb:first-child .t-cover { display: none; }
.thumb.loading { display: grid; place-items: center; font-size: .8rem; color: var(--muted); }
.upload-btn { display: inline-flex; flex-direction: row; padding: 9px 16px; border: 2px dashed var(--brand); border-radius: 10px; color: var(--brand); font-weight: 700; cursor: pointer; width: max-content; }
.row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.row-btns form { display: contents; }
#videoBox video { max-height: 320px; border-radius: 10px; margin-bottom: 8px; background: #000; }
.progress { position: relative; height: 26px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .82rem; font-weight: 700; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 10px; }
.sticky-save { position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; display: flex; gap: 8px; border-top: 1px solid var(--line); }
.sticky-save .btn { padding: 12px 26px; }
.req-list { display: grid; gap: 12px; }
.req { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--brand); }
.req.done { opacity: .6; border-color: var(--line); }
.req-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.req-who { margin: 6px 0; }
.req-fields { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.req-fields div { background: var(--bg); border-radius: 8px; padding: 3px 10px; display: flex; gap: 6px; }
.req-fields dt { color: var(--muted); font-size: .85rem; }
.req-fields dd { margin: 0; font-weight: 700; font-size: .9rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .listing-grid { grid-template-columns: 1fr; }
  .info { position: static; }
}
@media (max-width: 600px) {
  .form { grid-template-columns: 1fr; }
  .topbar nav a:not(.btn-wa) { padding: 6px 7px; font-size: .88rem; }
  .arow { grid-template-columns: 72px 1fr; }
  .arow > img { width: 72px; height: 56px; }
  .arow-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .grid { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: 1fr 1fr; }
}
