/* RozBazaar — mobile-first styles */
:root {
  --primary: #177a3d;
  --primary-dark: #0f5c2d;
  --primary-light: #e8f5ec;
  --accent: #f5a623;
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #1c1c1c;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,.07);
  --nav-h: 64px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--nav-h) + 16px);
}
/* Header */
.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 16px 16px 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.topbar h1 .ur { font-weight: 400; font-size: 16px; opacity: .9; }
.topbar p { font-size: 12px; opacity: .85; margin-top: 2px; text-align: center; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; }
.back-btn {
  background: rgba(255,255,255,.18); color: #fff; border: none;
  border-radius: 10px; padding: 8px 12px; font-size: 14px; cursor: pointer;
}
/* Language toggle — one language at a time; layout stays LTR always */
.lang-toggle {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex: 0 0 auto;
}
/* Urdu text flows naturally inside the unchanged LTR layout */
h1, h2, h3, h4, p, span, a, button, label, .small { unicode-bidi: plaintext; }
/* Hamburger button (left of header) + left slide-in drawer — LTR always */
.hamburger-btn {
  background: rgba(255,255,255,.18); color: #fff; border: none;
  border-radius: 10px; padding: 8px 12px; font-size: 19px; line-height: 1;
  cursor: pointer; flex: 0 0 auto;
}
.side-drawer {
  position: fixed; top: 0; left: 0; height: 100%; width: 272px; max-width: 82vw;
  background: var(--card); z-index: 1001; transform: translateX(-105%);
  transition: transform .28s ease; display: flex; flex-direction: column;
  box-shadow: 2px 0 14px rgba(0,0,0,.2);
}
.side-drawer.open { transform: translateX(0); }
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--primary); color: #fff;
  font-weight: 700; font-size: 16px;
}
.drawer-x {
  background: rgba(255,255,255,.18); color: #fff; border: none;
  border-radius: 8px; width: 32px; height: 32px; font-size: 15px; cursor: pointer;
}
.drawer-userblock {
  padding: 12px 16px 10px; background: var(--primary-light);
}
.drawer-user {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-settings {
  display: inline-block; margin-top: 3px; font-size: 12px;
  color: var(--muted); text-decoration: none;
}
.drawer-settings:active { text-decoration: underline; }
.drawer-hr { border: none; border-top: 1px solid var(--border); margin: 0; }
.drawer-spacer { flex: 1 1 auto; }
.drawer-logout {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 20px; margin: 4px 0; background: none; border: none;
  color: var(--danger); font-size: 15px; font-weight: 600;
  cursor: pointer; text-align: left; font-family: inherit;
}
.drawer-logout:active { background: var(--primary-light); }
.drawer-nav { display: flex; flex-direction: column; padding: 8px; gap: 4px; }
.drawer-link {
  display: flex; align-items: center; gap: 12px; padding: 13px 12px;
  border-radius: 10px; text-decoration: none; color: var(--text);
  font-size: 15px; font-weight: 600;
}
.drawer-link:active { background: var(--primary-light); }
.drawer-ico { font-size: 20px; width: 28px; text-align: center; }
/* Content */
.page { padding: 14px 14px 0; }
.section-title {
  font-size: 16px; font-weight: 700; margin: 16px 2px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title .ur { font-size: 13px; color: var(--muted); font-weight: 400; }
.section-title a { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 600; }
/* City tabs */
.city-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.city-tab {
  flex: 0 0 auto; border: 1.5px solid var(--border); background: var(--card);
  border-radius: 999px; padding: 8px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; color: var(--muted);
}
.city-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.city-tab:disabled { opacity: .45; cursor: default; }
/* Area chips */
.area-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; margin-top: 8px; }
.area-chip {
  flex: 0 0 auto; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--text);
}
.area-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }
/* Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 4px 10px; text-align: center; text-decoration: none; color: var(--text);
  display: block; border: 1px solid var(--border);
}
.cat-card .emoji { font-size: 28px; display: block; margin-bottom: 6px; }
.cat-card .lbl { font-size: 11.5px; font-weight: 600; line-height: 1.3; display: block; }
.cat-card:active { transform: scale(.97); }
/* Shop cards */
.shop-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--border); padding: 14px; margin-bottom: 12px;
  text-decoration: none; color: var(--text); display: block;
}
.shop-card h3 { font-size: 16px; margin-bottom: 2px; }
.shop-card .meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
  display: inline-block;
}
.badge.delivery-yes { background: #dcfce7; color: #166534; }
.badge.delivery-no { background: #f3f4f6; color: #4b5563; }
.badge.booking { background: #dbeafe; color: #1e40af; }
.badge.rating { background: #fef3c7; color: #92400e; }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.open-yes { background: #dcfce7; color: #166534; }
.badge.open-no { background: #fee2e2; color: #991b1b; }
.badge.status-placed { background: #e0e7ff; color: #3730a3; }
.badge.status-accepted { background: #dbeafe; color: #1e40af; }
.badge.status-preparing { background: #fef3c7; color: #92400e; }
.badge.status-on_way { background: #ffedd5; color: #9a3412; }
.badge.status-delivered { background: #dcfce7; color: #166534; }
.badge.status-cancelled { background: #f3f4f6; color: #4b5563; }
.open-dot { font-size: 14px; vertical-align: -1px; }
.star-btn { font-size: 34px; background: none; border: none; cursor: pointer; padding: 2px 4px; color: #d1d5db; }
.star-btn.lit { color: #f59e0b; }
.avatar-img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid #dcfce7; }
.tab-row { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-btn { flex: 1; padding: 10px; border-radius: 10px; border: 2px solid #e5e7eb; background: #fff; font-weight: 700; cursor: pointer; }
.tab-btn.active { border-color: var(--primary); color: var(--primary); background: #f0fdf4; }
.role-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.review-row { border-top: 1px solid #f3f4f6; padding: 10px 2px; }
.timings-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
/* Filters */
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-bar select, .filter-bar input {
  flex: 1; min-width: 0; padding: 10px; border-radius: 10px;
  border: 1px solid var(--border); font-size: 14px; background: #fff;
}
.search-box { display: flex; gap: 8px; margin-bottom: 12px; }
.search-box input {
  flex: 1; padding: 12px; border-radius: 12px; border: 1.5px solid var(--border);
  font-size: 15px;
}
.search-box input:focus { outline: none; border-color: var(--primary); }
/* Item rows */
.item-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; margin-bottom: 8px;
}
.item-row .iname { font-weight: 600; font-size: 14.5px; }
.item-row .iunit { font-size: 12px; color: var(--muted); }
.item-row .price { font-weight: 800; color: var(--primary-dark); font-size: 15px; white-space: nowrap; }
.qty-ctrl { display: flex; align-items: center; gap: 10px; }
.qty-ctrl button {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--primary);
  background: #fff; color: var(--primary); font-size: 18px; font-weight: 700;
  cursor: pointer; line-height: 1;
}
.qty-ctrl button.add { background: var(--primary); color: #fff; }
.qty-ctrl .q { font-weight: 700; min-width: 18px; text-align: center; }
/* Buttons */
.btn {
  display: block; width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.danger { background: var(--danger); }
.btn + .btn { margin-top: 10px; }
/* Cart bar */
.cart-bar {
  position: fixed; bottom: var(--nav-h); left: 50%; transform: translateX(-50%);
  width: min(480px, 100%); background: var(--primary-dark); color: #fff;
  padding: 12px 16px; display: none; align-items: center; justify-content: space-between;
  z-index: 30; box-shadow: 0 -2px 12px rgba(0,0,0,.2);
}
.cart-bar.show { display: flex; }
.cart-bar button {
  background: var(--accent); border: none; border-radius: 10px; color: #1c1c1c;
  font-weight: 800; padding: 10px 18px; font-size: 14px; cursor: pointer;
}
/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(480px, 100%); height: var(--nav-h);
  background: #fff; border-top: 1px solid var(--border);
  display: flex; z-index: 40;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; gap: 2px;
}
.bottom-nav a .ico { font-size: 20px; }
.bottom-nav a.active { color: var(--primary); }
/* Forms */
.form-card { background: var(--card); border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 5px; }
.field label .ur { font-weight: 400; color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px; border-radius: 10px; border: 1.5px solid var(--border); font-size: 15px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); }
.field .err { color: var(--danger); font-size: 12px; margin-top: 3px; display: none; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); }
.item-form-row { display: flex; gap: 8px; margin-bottom: 8px; }
.item-form-row input { flex: 1; min-width: 0; padding: 10px; border-radius: 10px; border: 1.5px solid var(--border); font-size: 14px; }
.item-form-row input.rate { max-width: 110px; }
.item-form-row .rm {
  background: #fee2e2; color: var(--danger); border: none; border-radius: 10px;
  width: 42px; font-size: 18px; cursor: pointer; flex: 0 0 auto;
}
/* Orders */
.order-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.order-card .ohead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-card .ohead .oid { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.order-card .ohead .odate { font-size: 12.5px; color: var(--muted); }
.order-card h3 { font-size: 15.5px; margin-bottom: 6px; }
.order-card .oline { font-size: 13.5px; color: var(--muted); display: flex; justify-content: space-between; padding: 2px 0; }
.order-card .ototal { display: flex; justify-content: space-between; font-weight: 800; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
/* Empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 48px; margin-bottom: 10px; }
/* CTA banner */
.cta-banner {
  background: linear-gradient(135deg, #f5a623, #e8890c); border-radius: var(--radius);
  padding: 16px; margin-top: 16px; color: #1c1c1c; text-decoration: none; display: block;
  box-shadow: var(--shadow);
}
.cta-banner h3 { font-size: 16px; margin-bottom: 2px; }
.cta-banner p { font-size: 13px; }
/* Toast */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1c1c1c; color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 100;
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Success box */
.success-box {
  background: #dcfce7; border: 1.5px solid #86efac; border-radius: var(--radius);
  padding: 18px; text-align: center; margin-bottom: 14px;
}
.success-box .big { font-size: 44px; margin-bottom: 8px; }
.success-box p { font-size: 14.5px; color: #14532d; margin-bottom: 4px; }
/* Info rows */
.info-row { display: flex; gap: 10px; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); min-width: 110px; font-weight: 600; }
.shop-hero { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 16px; margin-bottom: 6px; }
.shop-hero h2 { font-size: 20px; margin-bottom: 2px; }
.shop-hero .meta { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.result-group { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 14px 2px 8px; }
.hidden { display: none !important; }
.mt { margin-top: 14px; }
.small { font-size: 12.5px; color: var(--muted); }
.center { text-align: center; }

/* ---- Order notification badges (shopkeepers) ---- */
.hamburger-btn { position: relative; }
.burger-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #d32f2f; color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  display: inline-block; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.burger-badge[hidden] { display: none; }
.drawer-order-badge {
  margin-left: auto;
  min-width: 22px; height: 22px; padding: 0 7px;
  background: #d32f2f; color: #fff; border-radius: 11px;
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
  display: inline-block;
}
.drawer-order-badge[hidden] { display: none; }

/* ================================================================
   Responsive: tablet + desktop (mobile-first base above is untouched)
   Only min-width media queries; dir stays "ltr"; green theme kept.
   ================================================================ */

/* ---------- Tablet: 768px – 1023.98px ---------- */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .app-shell { max-width: 760px; }
  .bottom-nav, .cart-bar { width: min(760px, 100%); }

  .page { padding: 18px 20px 0; }
  .section-title { font-size: 17px; }

  /* categories: 4 -> 6 columns */
  .cat-grid { grid-template-columns: repeat(6, 1fr); }

  /* card lists: single column -> 2 columns */
  #nearbyShops, #shopList, #orderList, #bookList, #results {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  }
  #nearbyShops > .shop-card, #shopList > .shop-card,
  #orderList > .order-card, #bookList > .order-card,
  #results > .shop-card { margin-bottom: 0; }
  #results > .result-group, #results > .empty,
  #nearbyShops > .empty, #shopList > .empty,
  #orderList > .empty, #bookList > .empty { grid-column: 1 / -1; }
  #results > .result-group { margin-top: 4px; }

  /* forms don't stretch edge to edge */
  .form-card { max-width: 640px; margin-left: auto; margin-right: auto; }

  .side-drawer { width: 300px; }
}

/* ---------- Desktop: 1024px and up ---------- */
@media (min-width: 1024px) {
  .app-shell { max-width: 1140px; }
  .bottom-nav, .cart-bar { width: min(1140px, 100%); }

  .page { padding: 22px 28px 0; }
  .topbar { padding: 20px 28px 16px; }
  .topbar h1 { font-size: 26px; }
  .section-title { font-size: 18px; }

  /* categories: 4 -> 8 columns (one row for all 8) */
  .cat-grid { grid-template-columns: repeat(8, 1fr); gap: 12px; }

  /* shop cards: 3 columns */
  #nearbyShops, #shopList {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  }
  /* orders / bookings / search results: 2 columns */
  #orderList, #bookList, #results {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  }
  #nearbyShops > .shop-card, #shopList > .shop-card,
  #orderList > .order-card, #bookList > .order-card,
  #results > .shop-card { margin-bottom: 0; }
  #results > .result-group, #results > .empty,
  #nearbyShops > .empty, #shopList > .empty,
  #orderList > .empty, #bookList > .empty { grid-column: 1 / -1; }
  #results > .result-group { margin-top: 4px; }

  /* forms + search/filter stay a comfortable width, centered */
  .form-card { max-width: 640px; margin-left: auto; margin-right: auto; }
  .search-box, .filter-bar { max-width: 640px; }

  /* dashboard content breathes but stays centered */
  #dashPage { max-width: 1000px; margin: 0 auto; }

  /* drawer a touch wider on desktop; still left slide-in, LTR */
  .side-drawer { width: 320px; }
}

/* ---- RozBazaar brand lockup (professional logo in header + drawer) ---- */
.topbar h1.brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-icon { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.brand-name { color: #fff; }
.drawer-brand { display: inline-flex; align-items: center; gap: 8px; }
.drawer-brand-icon { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
