/* ==========================================================================
   نظام إدارة المكتبة والمبيعات والحضور الذكي - التصميم الاحترافي الفاخر (RTL)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Theme Colors */
  --bg-dark: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-glow: rgba(99, 102, 241, 0.3);

  /* Brand Accents */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-light: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.15);
  --rose: #f43f5e;
  --rose-light: rgba(244, 63, 94, 0.15);
  --cyan: #06b6d4;
  --cyan-light: rgba(6, 182, 212, 0.15);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Shadows & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px -5px rgba(99, 102, 241, 0.35);
  --shadow-glow-emerald: 0 0 25px -5px rgba(16, 185, 129, 0.35);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

body {
  direction: rtl;
  text-align: right;
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.95) 0px, transparent 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.8);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: rgba(13, 19, 33, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition-smooth);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-glass);
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
}

.logo-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px 12px;
  margin-top: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: var(--transition-fast);
  position: relative;
}

.nav-item i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transform: translateX(-3px);
}

.nav-item.active {
  background: var(--primary-light);
  color: #a5b4fc;
  border-right: 3px solid var(--primary);
}

.nav-item.active i {
  color: var(--primary);
}

/* Sidebar User Info */
.sidebar-footer {
  padding: 18px;
  border-top: 1px solid var(--border-glass);
  background: rgba(10, 15, 26, 0.5);
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: white;
}

.user-meta h4 {
  font-size: 0.88rem;
  font-weight: 700;
}

.user-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 2px;
}

.badge-owner {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-staff {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.btn-logout:hover {
  color: var(--rose);
  background: var(--rose-light);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-right: 280px;
  padding: 28px 36px;
  max-width: calc(100vw - 280px);
  min-height: 100vh;
}

/* Topbar Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.page-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Cards & Glass Containers */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Responsive Layout Grid Utilities */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.grid-2-1-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.grid-3-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.grid-form-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Mobile Topbar */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(13, 19, 33, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 950;
  width: 100%;
}

.mobile-topbar-right, .mobile-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  box-shadow: var(--shadow-glow);
}

.mobile-brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.mobile-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mobile-btn-icon:hover, .mobile-btn-icon:active {
  background: var(--primary-light);
  color: #a5b4fc;
  border-color: var(--border-glass-glow);
}

/* Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar Close Button */
.sidebar-close-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-right: auto;
  transition: var(--transition-fast);
}

.sidebar-close-btn:hover {
  color: var(--rose);
  background: var(--rose-light);
}

/* Mobile Bottom Navigation Bar */
.bottom-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(13, 19, 33, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  z-index: 990;
  justify-content: space-around;
  align-items: center;
  padding: 4px 6px env(safe-area-inset-bottom, 4px) 6px;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.6);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  flex: 1;
  max-width: 78px;
  text-align: center;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  transition: var(--transition-fast);
}

.bottom-nav-item:hover, .bottom-nav-item.active {
  color: #fff;
}

.bottom-nav-item.active i {
  color: var(--primary);
  transform: translateY(-2px);
}

.bottom-nav-item.active span {
  color: #a5b4fc;
}

/* POS Mobile Tabs */
.pos-mobile-tabs {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.pos-tab-btn {
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.pos-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* Inventory Filters Bar */
.inventory-filters-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.inventory-inputs-group {
  display: flex;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}

@media (max-width: 640px) {
  .inventory-filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .inventory-inputs-group {
    flex-direction: column;
    min-width: 100%;
    gap: 8px;
  }
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::after { background: var(--primary); }
.stat-card.emerald::after { background: var(--emerald); }
.stat-card.amber::after { background: var(--amber); }
.stat-card.cyan::after { background: var(--cyan); }
.stat-card.rose::after { background: var(--rose); }

.stat-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.5);
}

.stat-info h5 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-info .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 6px 0;
  color: #fff;
}

.stat-info .stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.stat-card.primary .stat-icon { background: var(--primary-light); color: #818cf8; }
.stat-card.emerald .stat-icon { background: var(--emerald-light); color: #34d399; }
.stat-card.amber .stat-icon { background: var(--amber-light); color: #fbbf24; }
.stat-card.cyan .stat-icon { background: var(--cyan-light); color: #38bdf8; }
.stat-card.rose .stat-icon { background: var(--rose-light); color: #fb7185; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.6);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--emerald), #059669);
  color: #fff;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.4);
}
.btn-emerald:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--rose-light);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.btn-danger:hover {
  background: var(--rose);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
  transition: var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(20, 29, 50, 0.9);
}

.input-with-icon {
  position: relative;
}
.input-with-icon i {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.1rem;
}
.input-with-icon .form-control {
  padding-right: 42px;
}

/* Modern Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.custom-table th {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.custom-table th:first-child {
  border-top-right-radius: var(--radius-md);
}
.custom-table th:last-child {
  border-top-left-radius: var(--radius-md);
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: var(--transition-fast);
}

.custom-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

/* Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
}

.pill-success {
  background: var(--emerald-light);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pill-warning {
  background: var(--amber-light);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pill-danger {
  background: var(--rose-light);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.pill-info {
  background: var(--cyan-light);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #0f172a;
  border: 1px solid var(--border-glass-glow);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: scale(0.95) translateY(10px);
  transition: var(--transition-smooth);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.modal-close:hover {
  color: var(--rose);
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 18px 24px;
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-100%);
  animation: slideIn 0.3s forwards ease-out;
  border-right: 4px solid var(--primary);
}

.toast.success { border-color: var(--emerald); }
.toast.error { border-color: var(--rose); }
.toast.warning { border-color: var(--amber); }

@keyframes slideIn {
  to { transform: translateX(0); }
}

/* POS Specific Layout */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  height: calc(100vh - 120px);
}

.pos-catalog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-cart {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.cart-item-info h5 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}
.cart-item-info span {
  font-size: 0.8rem;
  color: var(--emerald);
  font-weight: 600;
}

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover {
  background: var(--primary);
}

/* Quick Barcode Scanner Visual */
.barcode-box {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  color: #0f172a;
}

.barcode-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 3px;
  margin-top: 6px;
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsive Engine
   ========================================================================== */

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(100%);
    z-index: 1050;
    width: 290px;
    max-width: 85vw;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.7);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .mobile-topbar {
    display: flex;
  }

  .main-wrapper {
    margin-right: 0;
    max-width: 100vw;
    padding: 20px;
  }

  .grid-2-col, .grid-2-1-col {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

@media (max-width: 768px) {
  .bottom-nav-bar {
    display: flex;
  }

  .main-wrapper {
    padding: 12px 14px 84px 14px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-title h2 {
    font-size: 1.35rem;
  }

  .page-title p {
    font-size: 0.82rem;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    font-size: 0.82rem;
    padding: 9px 10px;
    white-space: nowrap;
  }

  /* Compact 2-column Stat Grid on Mobile */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 14px 12px;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 8px;
    border-radius: var(--radius-md);
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    border-radius: 8px;
  }

  .stat-info {
    width: 100%;
  }

  .stat-info h5 {
    font-size: 0.76rem;
  }

  .stat-info .stat-value {
    font-size: 1.28rem;
    margin: 3px 0;
  }

  .stat-info .stat-sub {
    font-size: 0.68rem;
    line-height: 1.3;
  }

  /* All Responsive Layout Grids collapse cleanly on Mobile */
  .grid-2-col, .grid-2-1-col, .grid-3-col, .grid-form-2 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin-bottom: 20px !important;
  }

  .glass-panel {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }

  /* POS Specific Mobile Handling */
  .pos-mobile-tabs {
    display: grid;
  }

  .pos-layout {
    gap: 14px;
  }

  #posBooksGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    max-height: 62vh !important;
  }

  .pos-book-card {
    padding: 12px !important;
  }

  .pos-catalog.mobile-hidden {
    display: none !important;
  }

  .pos-cart.mobile-hidden {
    display: none !important;
  }

  .cart-item-row {
    padding: 10px;
  }

  .cart-item-info h5 {
    font-size: 0.85rem;
  }

  /* Mobile Tables */
  .table-responsive {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    -webkit-overflow-scrolling: touch;
    margin-bottom: 4px;
  }

  .custom-table {
    font-size: 0.8rem;
  }

  .custom-table th, .custom-table td {
    padding: 10px 8px;
    white-space: nowrap;
  }

  /* Mobile Bottom Sheets / Modals */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-content {
    border-radius: 20px 20px 12px 12px;
    max-height: 88vh;
    transform: translateY(30px);
    width: 100%;
    margin: 0;
  }

  .modal-overlay.active .modal-content {
    transform: translateY(0);
  }

  .modal-header {
    padding: 14px 18px;
  }

  .modal-header h3, .modal-header h4 {
    font-size: 1.05rem;
  }

  .modal-body {
    padding: 16px 14px;
    max-height: 68vh;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Toast position */
  #toast-container {
    top: 14px;
    left: 14px;
    right: 14px;
    max-width: calc(100% - 28px);
  }
}

@media (max-width: 480px) {
  .stat-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 12px 10px;
  }

  .stat-info .stat-value {
    font-size: 1.15rem;
  }

  #posBooksGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .form-control {
    font-size: 0.88rem;
    height: 42px;
  }

  .btn {
    font-size: 0.84rem;
  }

  .login-card {
    padding: 24px 18px !important;
    margin: 12px !important;
    border-radius: var(--radius-lg) !important;
  }
}

/* Print Optimization */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar, .page-header, .pos-layout, .modal-header, .modal-footer, .btn, #toast-container, .mobile-topbar, .bottom-nav-bar, .sidebar-backdrop {
    display: none !important;
  }
  .modal-overlay:not(.active) {
    display: none !important;
  }
  .modal-overlay.active {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .modal-content {
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
  #receiptPrintArea, #barcodePrintCard, #badgePrintBox {
    border: none !important;
    box-shadow: none !important;
    padding: 10px 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  img {
    max-width: 100% !important;
    display: block !important;
    visibility: visible !important;
  }
}


