/* IsaMarket base styles. Logical properties only (margin-inline, inset-inline...) so one file serves LTR and RTL. */
:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #e6f4f2;
  --ink: #16212b;
  --muted: #5d6b78;
  --line: #e4e9ee;
  --surface: #ffffff;
  --bg: #f6f8fa;
  --radius: 14px;
  --bottom-bar-h: 64px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
  font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, Arial, sans-serif;
  padding-block-end: calc(var(--bottom-bar-h) + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { body { padding-block-end: 0; } }

.page-body { padding-block: 1.25rem 2rem; }

/* Header */
.site-header { background: var(--surface); border-block-end: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: .75rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; }
.header-search { position: relative; flex: 1 1 auto; max-width: 560px; }
.header-search i { position: absolute; inset-inline-start: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.header-search .form-control { border-radius: 999px; padding-inline-start: 2.4rem; min-height: 42px; background: var(--bg); border-color: var(--line); }
.header-links { display: flex; align-items: center; gap: 1rem; margin-inline-start: auto; }
.header-links a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 600; }
.header-links a.active { color: var(--brand); }
.lang-switch { margin: 0; }
@media (max-width: 767.98px) { .brand-name { display: none; } }

/* Buttons */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; border-radius: 999px; padding-inline: 1.1rem; min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-lg { min-height: 52px; border-radius: 999px; }

/* Hero and sections */
.hero { background: linear-gradient(135deg, var(--brand), #14b8a6); color: #fff; border-radius: var(--radius); padding: 1.75rem 1.25rem; margin-block-end: 1.5rem; }
.hero h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 .4rem; }
.hero p { margin: 0 0 1.1rem; opacity: .95; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
@media (min-width: 768px) { .hero { padding: 2.75rem 2.25rem; } .hero h1 { font-size: 2.2rem; } }
.section { margin-block-end: 1.75rem; }
.chip-row { display: flex; gap: .5rem; overflow-x: auto; padding-block-end: .25rem; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .45rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .55rem .95rem; color: var(--ink); text-decoration: none; min-height: 44px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* Listing cards and skeletons */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 768px) { .card-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }
.listing-skeleton { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.sk-img, .sk-line { background: linear-gradient(90deg, #eef1f4 25%, #f7f9fb 37%, #eef1f4 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 10px; }
.sk-img { aspect-ratio: 4 / 3; }
.sk-line { height: .8rem; margin-block-start: .6rem; }
.sk-line.short { width: 55%; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk-img, .sk-line { animation: none; } }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state > i { font-size: 2.4rem; color: var(--brand); margin-block-end: 1rem; }

/* Mobile bottom bar: Home | Explore | [+ Sell] | Messages | Profile */
.bottom-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: calc(var(--bottom-bar-h) + env(safe-area-inset-bottom)); padding-block-end: env(safe-area-inset-bottom); background: var(--surface); border-block-start: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.bottom-bar a { display: flex; flex-direction: column; align-items: center; gap: .15rem; color: var(--muted); text-decoration: none; font-size: .72rem; min-height: 48px; justify-content: center; }
.bottom-bar a.active { color: var(--brand); }
.bottom-bar a i { font-size: 1.15rem; }
.bottom-bar .sell-fab { width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: #fff; margin-inline: auto; margin-block-start: -18px; box-shadow: 0 6px 16px rgba(15, 118, 110, .35); justify-content: center; }
.bottom-bar .sell-fab i { font-size: 1.3rem; }

/* Admin */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; }

/* Prices and phone numbers keep their direction inside Arabic text */
.ltr-isolate { unicode-bidi: isolate; direction: ltr; display: inline-block; }

/* Sign-in and profile */
.auth-card, .profile-card { max-width: 440px; margin-inline: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.profile-card { max-width: 560px; }
.auth-btn { min-height: 52px; border-radius: 999px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.auth-or { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin-block: 1rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.otp-input { text-align: center; letter-spacing: .5em; font-size: 1.6rem; }
.profile-facts { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 1.5rem 0 0; }
.profile-facts dt { color: var(--muted); font-weight: 500; }
.profile-facts dd { margin: 0; }

/* Admin lists and forms */
.admin-nav { display: flex; gap: .25rem; overflow-x: auto; margin-block-end: 1rem; border-block-end: 1px solid var(--line); }
.admin-nav a { padding: .6rem .9rem; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; border-block-end: 3px solid transparent; }
.admin-nav a.active { color: var(--brand); border-block-end-color: var(--brand); }
.admin-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-row { display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem; border-block-end: 1px solid var(--line); min-height: 52px; }
.admin-row:last-child { border-block-end: 0; }
.admin-row.root { background: #fbfcfd; font-weight: 600; }
.admin-row.child { padding-inline-start: 2.6rem; font-weight: 400; }
.admin-row.inactive .admin-name { opacity: .55; }
.admin-icon { width: 1.5rem; text-align: center; color: var(--brand); }
.admin-form { max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.stat-link { text-decoration: none; color: inherit; flex-direction: row; justify-content: space-between; align-items: center; }
.stat-link:hover { border-color: var(--brand); }

/* Selling */
.wizard-steps { display: flex; gap: .5rem; margin-block-end: 1rem; font-size: .85rem; }
.wizard-steps .step { flex: 1; text-align: center; padding: .4rem .2rem; border-block-end: 3px solid var(--line); color: var(--muted); }
.wizard-steps .step.done { border-block-end-color: var(--brand); color: var(--brand); }
.wizard-steps .step.active { border-block-end-color: var(--brand); color: var(--ink, #111827); font-weight: 700; }
.category-group { margin-block-end: 1.25rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; }
.photo-tile, .photo-add { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove { position: absolute; inset-block-start: .3rem; inset-inline-end: .3rem; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(17,24,39,.75); color: #fff; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; border-style: dashed; color: var(--brand); cursor: pointer; font-size: .85rem; }
.photo-add i { font-size: 1.5rem; }
.my-list { display: grid; gap: .75rem; }
.my-item { display: flex; gap: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.my-thumb { flex: 0 0 84px; height: 84px; border-radius: .6rem; overflow: hidden; background: #eef2f4; display: flex; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; }
.my-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-body { flex: 1; min-width: 0; }
.my-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-price { color: var(--brand); font-weight: 700; }
.my-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-block-start: .5rem; }
.badge-status { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; background: #e5e7eb; color: #374151; }
.status-published { background: #d1fae5; color: #065f46; }
.status-reserved, .status-pendingreview { background: #fef3c7; color: #92400e; }
.status-rejected, .status-removed { background: #fee2e2; color: #991b1b; }
.gallery { display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); }
.gallery img { flex: 0 0 100%; max-height: 420px; object-fit: contain; background: #f3f4f6; scroll-snap-align: center; }
.item-price { font-size: 1.4rem; font-weight: 700; color: var(--brand); }
.item-note { font-size: .9rem; font-weight: 400; color: var(--muted); }
.item-facts { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .35rem; color: var(--muted); }
.item-facts i { width: 1.25rem; text-align: center; color: var(--brand); }
.item-desc { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Browsing */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem .9rem; }
.filters summary { cursor: pointer; padding: .7rem 0; font-weight: 600; color: var(--brand); list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filter-form { padding-block-end: 1rem; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-block-start: .75rem; }
.listing-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.listing-card .card-link { display: block; color: inherit; text-decoration: none; }
.card-photo { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: #eef2f4; color: var(--muted); font-size: 2rem; overflow: hidden; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-badge { position: absolute; inset-block-end: .4rem; inset-inline-start: .4rem; }
.card-body { display: flex; flex-direction: column; gap: .15rem; padding: .55rem .7rem .7rem; }
.card-price { font-weight: 700; color: var(--brand); }
.card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: .8rem; color: var(--muted); }
.card-fav { position: absolute; inset-block-start: .4rem; inset-inline-end: .4rem; margin: 0; }
.fav-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--muted); text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.fav-btn.on { color: #dc2626; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-block: 1.25rem; }
.seller-head { display: flex; gap: 1rem; align-items: center; padding-block: .5rem; }
.seller-avatar { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 1.6rem; }
