:root {
  --bg-primary: #0f0f1a;
  --surface-1: #16162a;
  --surface-2: #1e1e35;
  --surface-3: #252540;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-purple: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-teal: #14b8a6;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-green: linear-gradient(135deg, #10b981, #14b8a6);
  --gradient-amber: linear-gradient(135deg, #f59e0b, #f97316);
  --gradient-red: linear-gradient(135deg, #ef4444, #dc2626);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 25px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.5);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface-1); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.header-brand-icon {
  font-size: 1.5rem;
}

.header-brand-text {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
}

.header-badge.admin {
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.3);
}

.header-badge.worker {
  background: rgba(16,185,129,0.15);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}

/* ===== LAYOUT ===== */
.main-layout {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card.purple::before { background: var(--gradient-primary); }
.stat-card.green::before { background: var(--gradient-green); }
.stat-card.amber::before { background: var(--gradient-amber); }
.stat-card.red::before { background: var(--gradient-red); }

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99,102,241,0.5);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.25);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-green);
  color: white;
  box-shadow: 0 4px 15px rgba(16,185,129,0.3);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16,185,129,0.5);
}

.btn-ghost {
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
  direction: rtl;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  background: var(--surface-1);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* ===== FILTER TABS ===== */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0;
  padding: 0.45rem 1rem;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-muted);
  transition: all 0.2s;
}

.filter-tab:hover {
  color: var(--text-secondary);
  border-color: rgba(255,255,255,0.15);
}

.filter-tab.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(99,102,241,0.3);
}

/* ===== PRODUCTS GRID ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: rgba(99,102,241,0.3);
  box-shadow: var(--shadow-lg);
}

.product-img-wrap {
  position: relative;
  padding-top: 75%;
  overflow: hidden;
  background: var(--surface-2);
}

.product-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-img {
  transform: scale(1.05);
}

.product-no-img {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2.5rem;
}

.product-no-img span {
  font-size: 0.7rem;
  margin-top: 0.3rem;
}

.product-qty-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.qty-ok { background: rgba(16,185,129,0.8); color: white; }
.qty-low { background: rgba(245,158,11,0.8); color: white; }
.qty-out { background: rgba(239,68,68,0.8); color: white; }

.product-body {
  padding: 1rem;
}

.product-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 900;
  background: var(--gradient-amber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

.product-qty {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.product-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0 1rem 1rem;
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.show {
  display: flex;
  animation: modalIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}
.modal-close:hover {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border-color: rgba(239,68,68,0.3);
}

/* ===== FORM ===== */
.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--surface-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
  direction: rtl;
}

.form-input:focus {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Image Upload */
.img-upload-area {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  background: var(--surface-1);
}

.img-upload-area:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.05);
}

.img-upload-area.has-img {
  padding: 0;
  border-style: solid;
  border-color: rgba(99,102,241,0.3);
}

.img-upload-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
  display: none;
}

.img-upload-area.has-img .img-upload-preview {
  display: block;
}

.img-upload-area.has-img .img-upload-placeholder {
  display: none;
}

.img-upload-placeholder {
  pointer-events: none;
}

.img-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.img-upload-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.img-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.img-change-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.7rem;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-footer {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

/* ===== CATEGORY INPUT ===== */
.category-wrap {
  position: relative;
}

.category-suggestions {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  z-index: 10;
  overflow: hidden;
  display: none;
}

.category-suggestions.show { display: block; }

.suggestion-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.suggestion-item:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  backdrop-filter: blur(15px);
  animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-success {
  background: rgba(16,185,129,0.9);
  color: white;
}

.toast-error {
  background: rgba(239,68,68,0.9);
  color: white;
}

.toast-info {
  background: rgba(99,102,241,0.9);
  color: white;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-desc {
  font-size: 0.85rem;
}

/* ===== DELETE CONFIRM ===== */
.delete-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.delete-modal.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.delete-box {
  background: var(--surface-2);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-xl);
  padding: 2rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.delete-icon { font-size: 3rem; margin-bottom: 0.8rem; }
.delete-title { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.5rem; }
.delete-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.delete-btns {
  display: flex;
  gap: 0.8rem;
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
  display: flex;
  background: var(--surface-1);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--glass-border);
}

.view-btn {
  width: 34px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.view-btn.active {
  background: var(--surface-3);
  color: var(--text-primary);
}

/* ===== LIST VIEW ===== */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.product-list-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem;
  transition: all 0.2s;
}

.product-list-item:hover {
  border-color: rgba(99,102,241,0.3);
  background: var(--surface-1);
}

.product-list-img {
  width: 65px;
  height: 65px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.product-list-no-img {
  width: 65px;
  height: 65px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.product-list-info {
  flex: 1;
  min-width: 0;
}

.product-list-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-list-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.product-list-price {
  font-size: 0.9rem;
  font-weight: 800;
  background: var(--gradient-amber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.product-list-qty {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.product-list-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .main-layout { padding: 1rem; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .header { padding: 0 1rem; }
  .header-brand-text { font-size: 1rem; }
}

@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== LOADING SHIMMER ===== */
.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== CATEGORY TAG ===== */
.category-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  background: rgba(99,102,241,0.1);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

/* ===== WORKER PAGE EXTRA ===== */
.worker-product-card .product-price {
  font-size: 1.25rem;
}

.price-unit {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  -webkit-text-fill-color: var(--text-muted);
}

/* ===== ANIMATE PRESENCE ===== */
.fade-in {
  animation: cardFadeIn 0.4s ease both;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== PULSE BADGE ===== */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* ===== SETTINGS PAGE ===== */
.settings-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.settings-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
}

.settings-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s;
  border: none;
  background: none;
  font-family: 'Tajawal', sans-serif;
}

.bottom-nav-item.active {
  color: #818cf8;
}

.bottom-nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 0.68rem;
  font-weight: 600;
}

.nav-indicator {
  position: absolute;
  top: 0;
  width: 30px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 3px 3px;
  transition: all 0.3s;
}

.with-bottom-nav {
  padding-bottom: 5rem;
}

/* ===== BARCODE SCANNER ===== */
.scanner-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  z-index: 500;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  overflow-y: auto;
}

.scanner-modal.show {
  display: flex;
  animation: scannerIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scannerIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.scanner-inner {
  width: 100%;
  max-width: 520px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.scanner-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scanner-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.scanner-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}
.scanner-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(1.1);
}

/* Camera Viewport */
.scanner-viewport-wrap {
  width: 100%;
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #000;
  border: 2px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.2);
}

#scannerViewport {
  width: 100%;
  min-height: 260px;
}

#scannerViewport video {
  width: 100% !important;
  height: auto !important;
  display: block;
}

/* Scanner Laser Line */
.scanner-laser {
  position: absolute;
  left: 15%;
  right: 15%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #6366f1, #a78bfa, #6366f1, transparent);
  border-radius: 2px;
  top: 50%;
  transform: translateY(-50%);
  animation: laserScan 2s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.8);
}

@keyframes laserScan {
  0%, 100% { top: 35%; opacity: 1; }
  50%       { top: 65%; opacity: 0.7; }
}

/* Corner Guides */
.scanner-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.scanner-corners::before,
.scanner-corners::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: #6366f1;
  border-style: solid;
}

.scanner-corners::before {
  top: 20%;
  left: 15%;
  border-width: 3px 0 0 3px;
  border-radius: 6px 0 0 0;
  box-shadow: -2px -2px 8px rgba(99,102,241,0.4);
}

.scanner-corners::after {
  bottom: 20%;
  right: 15%;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 6px 0;
  box-shadow: 2px 2px 8px rgba(99,102,241,0.4);
}

.scanner-corner-tr {
  position: absolute;
  top: 20%;
  right: 15%;
  width: 30px;
  height: 30px;
  border-top: 3px solid #6366f1;
  border-right: 3px solid #6366f1;
  border-radius: 0 6px 0 0;
  box-shadow: 2px -2px 8px rgba(99,102,241,0.4);
}

.scanner-corner-bl {
  position: absolute;
  bottom: 20%;
  left: 15%;
  width: 30px;
  height: 30px;
  border-bottom: 3px solid #6366f1;
  border-left: 3px solid #6366f1;
  border-radius: 0 0 0 6px;
  box-shadow: -2px 2px 8px rgba(99,102,241,0.4);
}

/* Status Text */
.scanner-status {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  width: 100%;
}

/* Hint */
.scanner-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Result Box */
.scan-result-box {
  width: 100%;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  display: none;
  align-items: center;
  gap: 1rem;
  animation: resultPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes resultPop {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.scan-result-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.scan-result-info {
  flex: 1;
  min-width: 0;
}

.scan-result-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.scan-result-code {
  font-size: 1.1rem;
  font-weight: 800;
  color: #34d399;
  word-break: break-all;
  font-family: monospace;
}

/* Scanner Actions */
.scanner-actions {
  display: flex;
  gap: 0.8rem;
  width: 100%;
}

/* Barcode field in form */
.barcode-field-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.barcode-field-wrap .form-input {
  flex: 1;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.barcode-scan-btn {
  flex-shrink: 0;
  padding: 0 1rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 50px;
}

.barcode-scan-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

/* FAB Scan Button */
.scan-fab {
  position: fixed;
  bottom: 5.5rem;
  right: 1rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 90;
}

.scan-fab:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.7);
}

.scan-fab:active {
  transform: scale(0.95);
}

/* Barcode badge on product */
.barcode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 50px;
  font-size: 0.7rem;
  color: #818cf8;
  font-family: monospace;
  margin-top: 0.3rem;
  cursor: pointer;
  transition: all 0.2s;
}

.barcode-badge:hover {
  background: rgba(99, 102, 241, 0.2);
}

/* Scanner search result overlay */
.barcode-found-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(15px);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.barcode-found-overlay.show {
  display: flex;
  animation: fadeInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.barcode-found-card {
  background: var(--surface-2);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.barcode-found-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
}

.barcode-found-no-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 1rem;
}

.barcode-found-name {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.barcode-found-price {
  font-size: 1.8rem;
  font-weight: 900;
  background: var(--gradient-amber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.barcode-found-meta {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.barcode-found-meta-item {
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.barcode-not-found {
  text-align: center;
  padding: 1rem;
}

.barcode-not-found-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
}

.barcode-not-found-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.5rem;
}

.barcode-not-found-code {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
  background: var(--surface-1);
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 1rem;
}

/* ===== PWA INSTALL BUTTON ===== */
.pwa-install-btn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  white-space: nowrap;
}

.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.pwa-install-btn:active {
  transform: translateY(0);
}

@keyframes pulseInstall {
  0%, 100% { box-shadow: 0 4px 15px rgba(99,102,241,0.4); }
  50% { box-shadow: 0 4px 25px rgba(99,102,241,0.8), 0 0 0 4px rgba(99,102,241,0.15); }
}

.pwa-install-btn.pulse-install {
  animation: pulseInstall 2s ease-in-out infinite;
}

/* ===== NOTIFICATION BADGE ===== */
.notif-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-primary);
  animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: 'Tajawal', sans-serif;
}

@keyframes badgePop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

