/* ========== labbaytak PWA Styles — RTL, Phone-First ========== */
:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #d1fae5;
  --primary-glow: rgba(5,150,105,0.25);
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-stack: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  font-size: 15px;
}

/* ===== Typography Scale ===== */
h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.3px; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }

/* ===== Skeleton Loading & Pull-to-Refresh ===== */
@keyframes skeleton-pulse { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
@keyframes spin { to{transform:rotate(360deg)} }
.skeleton { background:linear-gradient(110deg,#e5e7eb 20%,#f3f4f6 40%,#e5e7eb 60%); background-size:200% 100%; animation:skeleton-pulse 1.6s ease-in-out infinite; border-radius:var(--radius-sm); }
.skeleton-text { height:14px; margin-bottom:8px; width:80%; }
.skeleton-title { height:20px; margin-bottom:10px; width:60%; }
.skeleton-avatar { width:48px; height:48px; border-radius:50%; }
.skeleton-card { height:120px; border-radius:var(--radius); }
.pull-refresh { display:flex; align-items:center; justify-content:center; height:0; overflow:hidden; transition:height .3s; color:var(--text-secondary); font-size:.8rem; gap:8px; }
.pull-refresh.active { height:48px; }
.pull-refresh::before { content:''; width:20px; height:20px; border:2.5px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:spin .7s linear infinite; }

/* ===== Header ===== */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.app-header h1 { font-size: 1.2rem; font-weight: 700; }
.app-header .logo { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; }
.btn-icon {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
  border: none;
  color: white;
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), transform var(--transition);
}
.btn-icon:active { transform: scale(0.92); background: rgba(255,255,255,0.3); }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 10px 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:active { transform: scale(0.985); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline { background: white; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; border-radius: 8px; }
.btn-block { width: 100%; display: flex; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; box-shadow: none; }

/* FAB — Floating Action Button */
.fab { position:fixed; bottom:100px; left:20px; width:56px; height:56px; border-radius:50%; background:linear-gradient(135deg,var(--primary),var(--primary-dark)); color:white; border:none; font-size:1.6rem; box-shadow:0 8px 24px var(--primary-glow); cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:190; transition:transform var(--transition),box-shadow var(--transition); }
.fab:active { transform:scale(.9); }
.fab-label {
  position: fixed; bottom: 108px; left: 82px;
  background: var(--text); color: white;
  font-size: 0.75rem; font-weight: 600;
  padding: 5px 12px; border-radius: 6px;
  white-space: nowrap; z-index: 189;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.fab:hover + .fab-label, .fab:active + .fab-label { opacity: 1; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; margin-bottom: 6px; font-weight: 600;
  font-size: 0.85rem; color: var(--text-secondary);
}
.form-input {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fafafa;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ===== Market Sections ===== */
.market-sections {
  display:flex; gap:6px; padding:12px 16px 8px;
  background: var(--card);
}
.market-tab {
  flex:1; border:1.5px solid var(--border); background:#fff;
  border-radius:var(--radius-sm); padding:12px 4px;
  color:var(--text); font-family:inherit; font-size:.9rem;
  font-weight:600; cursor:pointer;
  transition: all var(--transition);
}
.market-tab.active {
  border-color:var(--primary); background:var(--primary-light);
  color:var(--primary-dark);
  box-shadow: 0 2px 8px rgba(5,150,105,0.12);
}
.store-categories {
  display:flex; gap:7px; overflow-x:auto;
  padding:5px 16px 12px; background:var(--card);
  scrollbar-width:thin;
}
.store-categories button {
  flex:none; border:1.5px solid var(--border);
  border-radius:22px; background:#fff;
  color:var(--text-secondary); padding:8px 14px;
  font-family:inherit; font-size:.8rem; font-weight:600;
  cursor:pointer; transition: all var(--transition);
}
.store-categories button.active {
  border-color:var(--primary); color:var(--primary-dark);
  background:var(--primary-light);
}
.featured-section {
  background:#f0fdf4; padding:16px 0 14px;
  border-bottom:1px solid #bbf7d0;
}
.featured-heading {
  display:flex; justify-content:space-between;
  align-items:center; padding:0 16px 10px; gap:8px;
}
.featured-heading strong { font-size:1rem; color:#064e3b; }
.featured-heading small { color:#3f6c54; font-size:.72rem; }
.featured-rail {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px; padding:0 12px 5px;
}
.featured-product {
  min-width:0; text-align:right;
  border:1px solid #b6dfca; background:white;
  border-radius:var(--radius); overflow:hidden;
  cursor:pointer; color:var(--text); font:inherit; padding:0;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.featured-product:active { transform: scale(0.97); }
.featured-product img {
  width:100%; height:98px; object-fit:cover; display:block;
}
.featured-product .featured-copy { display:block; padding:8px; }
.featured-product b {
  display:block; overflow:hidden; white-space:nowrap;
  text-overflow:ellipsis; font-size:.84rem;
}
.featured-product small {
  display:block; overflow:hidden; white-space:nowrap;
  text-overflow:ellipsis; color:var(--text-secondary);
}
.featured-product em {
  display:inline-block; font-size:.66rem; font-style:normal;
  color:#065f46; margin-top:4px;
}
@media (prefers-reduced-motion: reduce) { .featured-rail { scroll-behavior:auto; } }

/* ===== Restaurant List ===== */
.restaurant-card {
  background: var(--card);
  margin: 8px 16px;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.restaurant-card:active { transform: scale(0.98); box-shadow: var(--shadow-lg); }
.restaurant-card .name { font-size: 1.05rem; font-weight: 700; }
.restaurant-card .meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.restaurant-card .category {
  background: var(--primary-light); color: var(--primary-dark);
  padding: 3px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}

/* ===== Menu Items ===== */
.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.menu-item:last-child { border-bottom: none; }
.menu-item .info { flex: 1; }
.menu-item .name { font-weight: 600; }
.menu-item .desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.menu-item .price { font-weight: 700; color: var(--primary); font-size: 1.05rem; }
.menu-item .add-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none;
  width: 38px; height: 38px; border-radius: 50%; font-size: 1.3rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.menu-item .add-btn:active { transform: scale(0.88); }

/* ===== Cart ===== */
.cart-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 2px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 201;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}
.cart-bar .total { font-weight: 700; font-size: 1.05rem; }
.cart-bar .count {
  background: var(--primary); color: white;
  border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
}

/* ===== Order Status ===== */
.status-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1px;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-accepted { background: #dbeafe; color: #1e40af; }
.status-preparing { background: #fef3c7; color: #92400e; }
.status-ready { background: #d1fae5; color: #065f46; }
.status-picked_up { background: #e0e7ff; color: #3730a3; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ===== Order Card ===== */
.order-card { margin-bottom: 10px; }
.order-card .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-card .id { font-weight: 700; color: var(--primary); }
.order-card .time { font-size: 0.75rem; color: var(--text-secondary); }
.order-card .items { font-size: 0.85rem; color: var(--text-secondary); }
.order-card .footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.order-card .total { font-weight: 700; }

/* ===== Tabs ===== */
.tabs { display: flex; border-bottom: 2px solid var(--border); }
.tab {
  flex: 1; min-width: 84px; white-space: nowrap; text-align: center; padding: 13px;
  font-weight: 600; cursor: pointer; color: var(--text-secondary);
  border-bottom: 2.5px solid transparent; margin-bottom: -2px;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Empty State ===== */
.empty { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty .icon { font-size: 3.2rem; margin-bottom: 14px; opacity: 0.5; }

/* ===== Login Page ===== */
.login-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background: linear-gradient(180deg, #f0fdf4 0%, var(--bg) 60%);
}
.login-page .brand { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.login-page .tagline { color: var(--text-secondary); margin-bottom: 32px; font-size: 0.95rem; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex; z-index: 200;
  max-width: 480px; margin: 0 auto;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
  padding: 4px 0 env(safe-area-inset-bottom, 4px);
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 6px 4px;
  color: var(--text-secondary); text-decoration: none; font-size: 0.68rem;
  transition: color var(--transition);
  position: relative;
}
.bottom-nav a::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--primary);
  opacity: 0; transition: opacity var(--transition);
}
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav a.active::before { opacity: 1; }
.bottom-nav a .icon { font-size: 1.35rem; display: block; margin-bottom: 1px; }

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-secondary); font-size: 0.85rem; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.pb-80 { padding-bottom: 80px; }

/* ===== Scroll Area ===== */
.scroll-area { padding-bottom: 130px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 90px; left: 16px; right: 16px;
  color: white; padding: 14px 18px;
  border-radius: var(--radius-sm); z-index: 999; text-align: center;
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 448px; margin: 0 auto;
  font-weight: 600; font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  background: #1f2937;
}
.toast.success { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from{transform:translateY(16px) scale(.96); opacity:0} to{transform:translateY(0) scale(1); opacity:1} }
@keyframes toastOut { from{transform:translateY(0) scale(1); opacity:1} to{transform:translateY(12px) scale(.96); opacity:0} }

/* ===== Order Tracker ===== */
.tracker { display: flex; justify-content: space-between; padding: 20px 4px; position: relative; }
.tracker::before {
  content: ''; position: absolute; top: 30px; left: 20px; right: 20px; height: 3px;
  background: var(--border); z-index: 0; border-radius: 2px;
}
.tracker-step { display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; flex: 1; }
.tracker-dot {
  width: 26px; height: 26px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.tracker-step.active .tracker-dot { background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--primary-glow); }
.tracker-step.done .tracker-dot { background: var(--primary-light); color: var(--primary-dark); }
.tracker-label { font-size: 0.65rem; color: var(--text-secondary); text-align: center; transition: color 0.25s; }
.tracker-step.active .tracker-label, .tracker-step.done .tracker-label { color: var(--primary); font-weight: 600; }

/* ===== Role Selector ===== */
.role-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.role-card {
  flex: 1; min-width: 90px; text-align: center;
  padding: 14px 8px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 600;
  font-size: 0.85rem; transition: all var(--transition);
  background: white; user-select: none;
}
.role-card:hover { border-color: #6ee7b7; }
.role-card.selected {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary-dark);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ===== Expat banner ===== */
.expat-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 12px 16px 0; padding: 12px 14px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 100%);
  color: white; border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.3);
}
.expat-banner-content { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.expat-icon { font-size: 1.6rem; flex-shrink: 0; }
.expat-text { display: flex; flex-direction: column; min-width: 0; }
.expat-text strong { font-size: 0.95rem; }
.expat-text span { font-size: 0.78rem; opacity: 0.9; line-height: 1.4; }
.expat-close {
  background: rgba(255,255,255,0.2); border: none; color: white;
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  font-size: 0.8rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.expat-close:active { background: rgba(255,255,255,0.35); }

/* ===== Search ===== */
.search-bar {
  padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 48px; z-index: 50;
}
.search-input {
  width: 100%; padding: 11px 18px; border: 2px solid var(--border);
  border-radius: 25px; font-size: 0.9rem; font-family: inherit;
  background: #f9fafb;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search-input:focus {
  outline: none; border-color: var(--primary);
  background: white; box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ===== Animation: slideUp (legacy compat) ===== */
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

/* ===== Notification Badge ===== */
.has-badge { position: relative; }
.has-badge::after {
  content: attr(data-badge);
  position: absolute;
  top: -5px; right: -5px;
  background: var(--danger);
  color: white;
  font-size: 0.58rem;
  font-weight: 700;
  width: 19px; height: 19px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: pulse 2s infinite;
  box-shadow: 0 1px 3px rgba(220,38,38,0.4);
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.18)} }

/* ===== Page Fade-In ===== */
.page-enter { animation: fadeIn .25s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateX(6px)} to{opacity:1;transform:translateX(0)} }

/* ===== Admin Sidebar (desktop) ===== */
@media (min-width: 769px) {
  body { max-width: 100%; }
  .app-header { max-width: 100%; }
  .admin-layout { display: flex; }
  .admin-sidebar { width: 240px; background: var(--card); min-height: 100vh; border-left: 1px solid var(--border); padding: 16px; }
  .admin-content { flex: 1; padding: 20px; }
  .bottom-nav, .cart-bar { max-width: 100%; }
}