/* ============================================
   NUGEZZA — Mobile-First Web App UI
   Customer/Vendor/Delivery = Mobile priority
   Admin = Desktop priority
   ============================================ */

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-hover: #1a1a1a;
  --bg-input: #111111;
  --border: #262626;
  --border-light: #1e1e1e;
  --text: #e5e5e5;
  --text-dim: #737373;
  --text-muted: #525252;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: rgba(124,58,237,0.12);
  --success: #22c55e;
  --success-light: rgba(34,197,94,0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245,158,11,0.12);
  --danger: #ef4444;
  --danger-light: rgba(239,68,68,0.12);
  --info: #3b82f6;
  --info-light: rgba(59,130,246,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.5);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bottomnav-h: 64px;
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; opacity: 0.9; }
img { max-width: 100%; display: block; }

/* ---- Container ---- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ============================================
   TOP NAV BAR (mobile app-style)
   ============================================ */
.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; }
.nav-brand {
  font-size: 1.3rem; font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 0.85rem; padding: 6px 10px; border-radius: var(--radius-sm); transition: all 0.15s; }
.nav-links a:hover { color: var(--text); background: var(--bg-hover); }

/* Hide desktop nav links on mobile (customer/vendor use bottom nav) */
.mobile-hide { display: none; }

/* ============================================
   BOTTOM NAV (mobile app tab bar)
   ============================================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  height: var(--bottomnav-h);
  padding-bottom: var(--safe-bottom);
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.62rem; gap: 2px;
  padding: 6px 12px; text-decoration: none;
  min-width: 56px; transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bottom-nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a:hover { color: var(--text); }
.bottom-nav .nav-badge {
  position: absolute; top: 0; right: 4px;
  background: var(--danger); color: #fff;
  border-radius: 50%; width: 16px; height: 16px;
  font-size: 0.6rem; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* Body padding for bottom nav */
.has-bottom-nav { padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 16px); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-dim); background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-dim); padding: 8px 12px; }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; min-height: 36px; border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; min-height: 52px; }
.btn-block { width: 100%; }
.btn + .btn { margin-left: 8px; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.card-body { padding: 16px; }
.card + .card { margin-top: 12px; }

/* ============================================
   FORMS — touch-friendly
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em; }
.form-control {
  width: 100%; padding: 12px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color 0.15s;
  min-height: 48px;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23737373'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea.form-control { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-check { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-size: 0.9rem; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-active, .badge-success { background: var(--success-light); color: var(--success); }
.badge-pending, .badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }

/* ============================================
   ALERTS
   ============================================ */
.alert {
  padding: 14px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 0.9rem;
  display: flex; align-items: center; gap: 8px;
}
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.25); }

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  text-align: center;
}
.stat-card-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-card-label { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; }

/* ============================================
   SHOP GRID
   ============================================ */
.shop-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 16px 0; }
.shop-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.shop-card:active { transform: scale(0.98); }
.shop-card:hover { border-color: var(--primary); }
.shop-card-img {
  width: 100%; height: 140px;
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 2rem; font-weight: 700;
}
.shop-card-img img { width: 100%; height: 100%; object-fit: cover; }
.shop-card-body { padding: 14px; }
.shop-card-body h3 { font-size: 1rem; margin-bottom: 2px; }
.shop-card-body p { color: var(--text-dim); font-size: 0.82rem; line-height: 1.4; }
.shop-card-type { font-size: 0.7rem; color: var(--primary); text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; }

/* ============================================
   CART BADGE
   ============================================ */
.cart-badge {
  background: var(--primary); color: #fff;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 0.65rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 0 16px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.3rem; font-weight: 700; }

/* ============================================
   ORDER CARD (mobile)
   ============================================ */
.order-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  margin-bottom: 10px; transition: all 0.15s;
  display: block; color: inherit; text-decoration: none;
}
.order-card:active { background: var(--bg-hover); }
.order-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.order-card-id { font-weight: 700; font-size: 0.92rem; }
.order-card-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.order-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.order-card-total { font-size: 1.05rem; font-weight: 700; }

/* ============================================
   CART ITEM (mobile)
   ============================================ */
.cart-item {
  display: flex; gap: 12px; padding: 14px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title { font-weight: 600; font-size: 0.9rem; }
.cart-item-shop { font-size: 0.78rem; color: var(--text-dim); }
.cart-item-price { font-weight: 600; text-align: right; white-space: nowrap; }
.cart-item-qty { font-size: 0.78rem; color: var(--text-dim); text-align: right; }

/* ============================================
   FILTER TABS (scrollable)
   ============================================ */
.filter-tabs {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 4px; margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  flex-shrink: 0; padding: 8px 16px;
  border-radius: 100px; font-size: 0.82rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-dim); white-space: nowrap;
  text-decoration: none; transition: all 0.15s;
  min-height: 36px; display: flex; align-items: center;
}
.filter-tab:hover { border-color: var(--text-dim); color: var(--text); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================
   ITEM ROW (order detail)
   ============================================ */
.item-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.item-row:last-child { border-bottom: none; }

/* ============================================
   TIMELINE (order tracking)
   ============================================ */
.timeline-steps {
  display: flex; gap: 0; margin-bottom: 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.timeline-step { flex: 1; text-align: center; position: relative; min-width: 50px; }
.timeline-dot {
  width: 28px; height: 28px; border-radius: 50%;
  margin: 0 auto 4px; display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700;
  background: var(--border); color: var(--text-dim);
}
.timeline-dot.reached { background: var(--success); color: #fff; }
.timeline-label { font-size: 0.6rem; color: var(--text-dim); }
.timeline-label.reached { color: var(--text); }

/* ============================================
   DELIVERY OPTION (checkout)
   ============================================ */
.delivery-option {
  display: flex; gap: 10px; align-items: center;
  padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s;
  min-height: 52px;
}
.delivery-option.selected { border-color: var(--primary); background: var(--primary-light); }

/* ============================================
   ACTION BAR
   ============================================ */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.action-bar form { display: contents; }

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-wrap {
  max-width: 400px; margin: 0 auto;
  padding: 40px 20px; min-height: calc(100vh - 60px);
  display: flex; flex-direction: column; justify-content: center;
}
.auth-wrap h1 { text-align: center; margin-bottom: 24px; font-size: 1.5rem; }

/* ============================================
   TABLES (admin/desktop)
   ============================================ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.table th { color: var(--text-dim); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table tbody tr:hover { background: var(--bg-hover); }

/* ============================================
   ADMIN LAYOUT — Desktop sidebar
   ============================================ */
.admin-layout { display: flex; min-height: calc(100vh - 53px); }
.admin-sidebar {
  width: 240px; background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 0; flex-shrink: 0;
}
.admin-sidebar a {
  display: block; padding: 10px 24px;
  color: var(--text-dim); font-size: 0.9rem;
  transition: all 0.15s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  color: var(--text); background: var(--bg-hover); text-decoration: none;
}
.admin-content { flex: 1; padding: 24px 32px; overflow-x: auto; }

/* ============================================
   NOTIFICATION TOAST
   ============================================ */
.toast {
  position: fixed; top: 16px; right: 16px; left: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  z-index: 1000; box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-warning { border-left: 3px solid var(--warning); }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================
   SECTION TITLE
   ============================================ */
.section-title {
  font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); margin: 20px 0 10px;
}

/* ============================================
   QUICK LINKS (vendor dashboard)
   ============================================ */
.quick-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 20px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  text-decoration: none; font-size: 0.85rem; font-weight: 500;
  transition: all 0.15s; min-height: 80px;
}
.quick-link:hover { border-color: var(--primary); background: var(--bg-hover); }
.quick-link svg { width: 24px; height: 24px; stroke: var(--primary); fill: none; stroke-width: 1.8; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 1rem; margin-bottom: 16px; }

/* ============================================
   PRODUCT CARD (mobile vendor)
   ============================================ */
.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  margin-bottom: 10px;
}
.product-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.product-card-title { font-weight: 600; font-size: 0.95rem; }
.product-card-price { font-weight: 700; color: var(--primary); }
.product-card-meta { font-size: 0.78rem; color: var(--text-dim); }
.product-card-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ============================================
   RESPONSIVE — Tablet (>=600px)
   ============================================ */
@media (min-width: 600px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .shop-card-img { height: 160px; }
}

/* ============================================
   RESPONSIVE — Desktop (>=768px)
   ============================================ */
@media (min-width: 768px) {
  .container { padding: 0 24px; }
  .page-header h1 { font-size: 1.5rem; }
  .mobile-hide { display: flex; }
  .desktop-hide { display: none !important; }
  .form-row { flex-direction: row; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .shop-card-img { height: 160px; }
  .bottom-nav { display: none; }
  .has-bottom-nav { padding-bottom: 0; }
}

/* ============================================
   RESPONSIVE — Large Desktop (>=1024px)
   ============================================ */
@media (min-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
}

/* ============================================
   Admin responsive
   ============================================ */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%; display: flex; overflow-x: auto;
    padding: 0; border-right: none; border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }
  .admin-sidebar::-webkit-scrollbar { display: none; }
  .admin-sidebar a { white-space: nowrap; padding: 12px 16px; }
  .admin-content { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }
}

/* ============================================
   Mobile form-row stack
   ============================================ */
@media (max-width: 600px) {
  .form-row { flex-direction: column; gap: 0; }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.p-2 { padding: 16px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
