/* =====================================================
   DAH PHONES - نظام التصميم الاحترافي
   Dark Theme | RTL Arabic | Glassmorphism
   ===================================================== */

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

/* =================== CSS Variables =================== */
:root {
  /* Colors */
  --primary: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-light: #60A5FA;
  --primary-glow: rgba(59, 130, 246, 0.25);

  --accent: #F59E0B;
  --accent-dark: #D97706;
  --accent-light: #FCD34D;

  --success: #10B981;
  --success-dark: #059669;
  --success-light: rgba(16, 185, 129, 0.15);

  --danger: #EF4444;
  --danger-dark: #DC2626;
  --danger-light: rgba(239, 68, 68, 0.15);

  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.15);

  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.15);

  /* Backgrounds */
  --bg-root: #070B14;
  --bg-main: #0D1420;
  --bg-sidebar: #0A1020;
  --bg-card: #111827;
  --bg-card-hover: #1C2535;
  --bg-input: #1A2235;
  --bg-table-row: #0F1929;
  --bg-table-alt: #111827;
  --bg-modal: #0D1420;

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(59, 130, 246, 0.4);
  --border-input: rgba(255, 255, 255, 0.1);

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-link: #60A5FA;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* =================== Reset & Base =================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  direction: rtl;
  scroll-behavior: smooth;
  font-size: 14px;
}

body {
  font-family: 'Inter', 'Tajawal', 'Cairo', sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a { color: var(--text-link); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--primary-light); }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

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

#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}

#sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

#sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-text {
  flex: 1;
  overflow: hidden;
}

.logo-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

#sidebar-user {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.68rem; color: var(--accent); }
.user-branch { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; }

#sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 8px 12px 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary-dark), rgba(59, 130, 246, 0.3));
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}

.nav-item svg { flex-shrink: 0; }
.nav-label { font-size: 0.85rem; font-weight: 500; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

#sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

#main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

#topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--spacing-lg);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}

#topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

#page-content {
  flex: 1;
  padding: var(--spacing-lg);
  overflow-y: auto;
}

/* =================== Login Screen =================== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0D1B35 0%, #070B14 70%);
  padding: var(--spacing-md);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: slideUpFade 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  margin: 0 auto 16px;
  box-shadow: 0 8px 25px var(--primary-glow);
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

/* =================== Cards =================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: var(--transition);
}

.card:hover { border-color: var(--border-active); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { color: var(--primary); }

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60%;
  height: 100%;
  opacity: 0.04;
  background: radial-gradient(circle at top right, var(--primary), transparent);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-card.blue { border-top: 3px solid var(--primary); }
.stat-card.green { border-top: 3px solid var(--success); }
.stat-card.amber { border-top: 3px solid var(--accent); }
.stat-card.red { border-top: 3px solid var(--danger); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-icon.blue { background: var(--info-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--accent); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.stat-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 0.72rem; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Grid Layouts */
.grid { display: grid; gap: var(--spacing-md); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* =================== Buttons =================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn svg { flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 4px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: white;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-warning {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
}

.btn-warning:hover { filter: brightness(1.1); transform: translateY(-1px); }

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-xl { padding: 16px 36px; font-size: 1.05rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-md); }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* =================== Forms =================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: var(--spacing-md);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--bg-card);
}

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

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-card); color: var(--text-primary); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-control-lg { padding: 14px 18px; font-size: 1rem; }

.input-group { position: relative; display: flex; }
.input-group .form-control { flex: 1; }
.input-group .input-addon {
  background: var(--bg-card);
  border: 1px solid var(--border-input);
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.input-group .input-addon:first-child { border-left: none; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .input-addon:last-child { border-right: none; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-group .form-control:not(:first-child) { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-group .form-control:not(:last-child) { border-radius: var(--radius-md) 0 0 var(--radius-md); }

.search-input { position: relative; }
.search-input .form-control { padding-right: 40px; }
.search-input .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* =================== Tables =================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table tbody tr {
  background: var(--bg-table-row);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: var(--transition-fast);
}

.table tbody tr:nth-child(even) { background: var(--bg-table-alt); }
.table tbody tr:hover { background: var(--bg-card-hover); }

.table tbody td {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  vertical-align: middle;
}

/* =================== Badges =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-success { background: var(--success-light); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.badge-danger { background: var(--danger-light); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.badge-warning { background: var(--warning-light); color: var(--accent); border-color: rgba(245, 158, 11, 0.3); }
.badge-info { background: var(--info-light); color: var(--primary); border-color: rgba(59, 130, 246, 0.3); }
.badge-secondary { background: rgba(255,255,255,0.06); color: var(--text-secondary); border-color: var(--border); }

/* =================== Modals =================== */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: var(--spacing-md);
}

#modal-overlay.show { opacity: 1; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(59, 130, 246, 0.1);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }

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

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

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition-fast);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* =================== Toasts =================== */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 360px;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.toast.show { opacity: 1; transform: translateY(0); }

.toast-icon { font-size: 16px; font-weight: 800; }

.toast-success { background: rgba(16, 185, 129, 0.9); color: white; }
.toast-error { background: rgba(239, 68, 68, 0.9); color: white; }
.toast-warning { background: rgba(245, 158, 11, 0.9); color: white; }
.toast-info { background: rgba(59, 130, 246, 0.9); color: white; }

/* =================== POS Specific =================== */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh - 60px);
  overflow: hidden;
  gap: 0;
}

.pos-products {
  padding: var(--spacing-md);
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.pos-cart {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  height: 100%;
  overflow: hidden;
}

.pos-cart-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 700;
}

.pos-cart-items { flex: 1; overflow-y: auto; padding: 8px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  transition: var(--transition-fast);
}

.cart-item:hover { border-color: var(--border-active); }
.cart-item-name { flex: 1; font-size: 0.82rem; font-weight: 600; }
.cart-item-price { font-size: 0.78rem; color: var(--accent); font-weight: 700; }

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

.cart-qty button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.cart-qty button:hover { background: var(--primary); }
.cart-qty span { width: 30px; text-align: center; font-size: 0.85rem; font-weight: 700; }

.pos-cart-total {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.total-row .label { color: var(--text-secondary); font-size: 0.85rem; }
.total-row .value { font-weight: 700; }
.total-row.grand { font-size: 1.1rem; color: var(--accent); padding-top: 8px; border-top: 1px solid var(--border); }

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.product-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.product-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }
.product-card .product-name { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.product-card .product-price { font-size: 0.9rem; font-weight: 800; color: var(--accent); }
.product-card .product-stock { font-size: 0.7rem; color: var(--text-muted); }
.product-card .product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
}

/* =================== Payment Methods =================== */
.payment-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.payment-method {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  font-size: 0.82rem;
  font-weight: 600;
}

.payment-method:hover { border-color: var(--primary); background: var(--info-light); }
.payment-method.active { border-color: var(--primary); background: var(--primary-glow); color: var(--primary-light); }
.payment-method.credit.active { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }

/* =================== Alerts =================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  border: 1px solid transparent;
  margin-bottom: var(--spacing-md);
}

.alert-success { background: var(--success-light); border-color: rgba(16, 185, 129, 0.3); color: var(--success); }
.alert-danger { background: var(--danger-light); border-color: rgba(239, 68, 68, 0.3); color: var(--danger); }
.alert-warning { background: var(--warning-light); border-color: rgba(245, 158, 11, 0.3); color: var(--accent); }
.alert-info { background: var(--info-light); border-color: rgba(59, 130, 246, 0.3); color: var(--primary-light); }

/* =================== Page Sections =================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.page-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title svg { color: var(--primary); }

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: var(--spacing-md);
}

/* =================== Empty State =================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 0.85rem; }

/* =================== Loading =================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =================== Invoice / Receipt =================== */
.receipt {
  background: white;
  color: #1a1a1a;
  padding: 20px;
  max-width: 320px;
  margin: 0 auto;
  font-family: 'Cairo', sans-serif;
  font-size: 12px;
}

.receipt-header { text-align: center; margin-bottom: 12px; border-bottom: 2px dashed #ccc; padding-bottom: 12px; }
.receipt-logo { font-size: 20px; font-weight: 900; color: #1a1a1a; }
.receipt-sub { font-size: 10px; color: #666; }
.receipt-info { margin: 10px 0; font-size: 11px; }
.receipt-items { width: 100%; margin: 10px 0; }
.receipt-items th { font-weight: 700; border-bottom: 1px dashed #ccc; padding: 4px 0; text-align: right; }
.receipt-items td { padding: 3px 0; vertical-align: top; }
.receipt-total { border-top: 2px dashed #ccc; margin-top: 10px; padding-top: 10px; }
.receipt-total-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 3px; }
.receipt-total-row.grand { font-size: 14px; font-weight: 900; }
.receipt-footer { text-align: center; margin-top: 12px; font-size: 10px; color: #888; border-top: 1px dashed #ccc; padding-top: 10px; }

/* =================== Misc =================== */
.divider { height: 1px; background: var(--border); margin: var(--spacing-md) 0; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--accent); }
.text-primary { color: var(--primary); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-sm { font-size: 0.78rem; }
.fs-lg { font-size: 1.1rem; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.flex-1 { flex: 1; }

/* =================== Animations =================== */
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.page-fade { animation: slideUpFade 0.3s ease; }

/* =================== Tabs =================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--spacing-lg); }

.tab-btn {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* =================== Progress Bar =================== */
.progress { height: 6px; background: var(--bg-input); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width 0.5s ease; }
.progress-bar.blue { background: var(--primary); }
.progress-bar.green { background: var(--success); }
.progress-bar.red { background: var(--danger); }

/* =================== Hidden / Responsive =================== */
.hidden { display: none !important; }
.visible { display: block !important; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  #sidebar { width: var(--sidebar-collapsed); }
  #sidebar .logo-text, #sidebar .nav-label, #sidebar .user-info, #sidebar .nav-section { display: none; }
  #main-content { margin-right: var(--sidebar-collapsed); }
  .pos-layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root { font-size: 13px; }
  #page-content { padding: var(--spacing-md); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* =================== LTR Support (French) =================== */
html[dir="ltr"] {
  direction: ltr;
}

html[dir="ltr"] #sidebar {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--border);
}

html[dir="ltr"] #main-content {
  margin-right: 0;
  margin-left: var(--sidebar-width);
}

@media (max-width: 900px) {
  html[dir="ltr"] #main-content {
    margin-right: 0;
    margin-left: var(--sidebar-collapsed);
  }
}

html[dir="ltr"] .search-input .form-control {
  padding-right: 14px;
  padding-left: 40px;
}

html[dir="ltr"] .search-input .search-icon {
  right: auto;
  left: 12px;
}

html[dir="ltr"] .table thead th {
  text-align: left;
}
