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

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

button, input, select, textarea {
  font-family: inherit;
}

:root {
  --primary: #000000;
  --primary-light: #333333;
  --primary-dark: #000000;
  --accent: #000000;
  --success: #000000;
  --warning: #000000;
  --danger: #000000;
  --info: #000000;
  --bg: #ffffff;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
  --sidebar-width: 260px;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--gray-800);
  direction: rtl;
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ============ ADMIN LAYOUT ============ */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  position: fixed;
  top: 0; right: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: var(--transition);
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sidebar-header {
  padding: clamp(12px, 4vw, 20px);
  border-bottom: 1px solid var(--gray-100);
  text-align: center;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10;
}

.sidebar-header h2 {
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  word-break: break-word;
}

.sidebar-header small { color: var(--gray-400); font-size: 0.75rem; }

.sidebar-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 1.5rem;
  border-radius: 6px;
  transition: var(--transition);
}

.sidebar-close-btn:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

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

/* Show/open state for sidebar (both states for compatibility) */
.sidebar.show,
.sidebar.open {
  transform: translateX(0);
}

.sidebar-nav { 
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}

.nav-section {
  padding: clamp(6px, 2vw, 8px) clamp(12px, 3vw, 20px) clamp(3px, 1.5vw, 4px);
  font-size: clamp(0.6rem, 1vw, 0.7rem);
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 10px);
  padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 20px);
  color: var(--gray-600);
  font-size: clamp(0.8rem, 1.5vw, 0.9rem);
  font-weight: 500;
  transition: var(--transition);
  border-right: 3px solid transparent;
  word-break: break-word;
  overflow-wrap: break-word;
}

.nav-item.whatsapp-item {
  color: #25d366;
}

.nav-item.whatsapp-item:hover {
  background: rgba(37, 211, 102, 0.12);
  color: #16b654;
}

.nav-item:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.nav-item.active {
  background: rgba(37,99,235,0.05);
  color: var(--primary);
  border-right-color: var(--primary);
  font-weight: 600;
}

.nav-item svg { 
  width: clamp(16px, 3vw, 20px);
  height: clamp(16px, 3vw, 20px);
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
}

/* ============ TOP BAR ============ */
.topbar {
  background: var(--white);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 1.2rem; font-weight: 700; color: var(--gray-800); }

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

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ============ PAGE CONTENT ============ */
.page-content { padding: 24px 32px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }

/* ============ CARDS ============ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); }

/* ============ STAT CARDS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

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

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.stat-card .stat-icon.blue { background: rgba(37,99,235,0.1); color: var(--primary); }
.stat-card .stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-card .stat-icon.orange { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card .stat-icon.red { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-card .stat-icon.purple { background: rgba(99,102,241,0.1); color: var(--info); }

.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--gray-500); margin-top: 4px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(37,99,235,0.05); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ============ TABLES ============ */
.table-container { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: right;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tbody tr:hover { background: var(--gray-50); }

/* ============ FORMS ============ */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--white);
  color: var(--gray-800);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Small, non-intrusive toggle style for email notifications checkbox */
.toggle-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 24px;
  background: #e5e7eb;
  border-radius: 999px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.18s ease;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
}
.toggle-checkbox::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  transition: left 0.18s ease;
}
.toggle-checkbox:checked {
  background: #0d6efd;
}
.toggle-checkbox:checked::after {
  left: 23px;
}

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-info { background: rgba(99,102,241,0.1); color: var(--info); }
.badge-primary { background: rgba(37,99,235,0.1); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: rgba(16,185,129,0.1); color: #065f46; border: 1px solid rgba(16,185,129,0.2); }
.alert-danger { background: rgba(239,68,68,0.1); color: #991b1b; border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: #92400e; border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: rgba(99,102,241,0.1); color: #3730a3; border: 1px solid rgba(99,102,241,0.2); }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active { display: flex; }

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

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s ease;
}

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

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

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 1.2rem;
  color: var(--gray-500);
}

.modal-close:hover { background: var(--danger); color: white; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-start; }

/* ============ AUTH PAGES ============ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.auth-card p {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.auth-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }

/* ============ PORTAL ============ */
.portal-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-header-inner {
  max-width: 99%;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.portal-logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gray-900);
  white-space: nowrap;
  letter-spacing: -0.02em;
  transition: var(--transition);
}
.portal-logo:hover {
  opacity: 0.85;
}

.portal-search {
  flex: 1;
  max-width: 50%;
  position: relative;
}

.portal-search form {
  position: relative;
  margin: 0;
}

.portal-search input {
  width: 100%;
  height: 45px;
  padding-top: 0;
  padding-bottom: 0;
  padding-inline-start: 42px;
  padding-inline-end: 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 50px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--gray-50);
}

.portal-search input:focus {
  outline: none;
  border-color: var(--gray-900);
  background: white;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04), var(--shadow-sm);
}

.portal-search .search-icon {
  position: absolute;
  inset-inline-start: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  pointer-events: none;
  transition: var(--transition);
}

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

/* Language Selector */
.lang-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 40px;
  width: 78px;
  padding-top: 0;
  padding-bottom: 0;
  padding-inline-start: 32px;
  padding-inline-end: 22px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  background-color: var(--gray-50);
  color: var(--gray-800);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.lang-select:hover {
  border-color: var(--gray-400);
  background-color: var(--white);
  box-shadow: var(--shadow-sm);
}

.lang-select:focus {
  border-color: var(--gray-800);
}

.lang-globe-icon {
  width: 15px;
  height: 15px;
  position: absolute;
  inset-inline-start: 10px;
  color: var(--gray-500);
  pointer-events: none;
  transition: var(--transition);
}

.lang-chevron-icon {
  width: 12px;
  height: 12px;
  position: absolute;
  inset-inline-end: 8px;
  color: var(--gray-400);
  pointer-events: none;
  transition: var(--transition);
}

/* Premium Shopping Cart Header Icon */
.portal-cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--gray-700);
  box-shadow: var(--shadow-sm);
}

.portal-cart:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--primary, #000000);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.portal-cart svg.cart-svg-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.2s;
}

.portal-cart:hover svg.cart-svg-icon {
  transform: scale(1.05);
}

.cart-count {
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: Arial, sans-serif;
  border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

/* Header Buttons styling specifically */
.portal-actions .btn {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.portal-actions .btn-outline {
  background: var(--white);
  border-color: var(--gray-200);
  color: var(--gray-700);
}

.portal-actions .btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-900);
}

.portal-actions .btn-danger {
  background: var(--gray-900);
  color: var(--white);
}

.portal-actions .btn-danger:hover {
  background: #000000;
}

.portal-actions .btn-primary {
  background: var(--primary);
  color: var(--white);
}

.portal-actions .btn-primary:hover {
  background: var(--primary-dark);
}

.portal-container { max-width: 100%; margin: 0 auto; padding: 24px; }

/* Product Cards Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
  font-size: 3rem;
}

.product-card-img img { width: 100%; height: 100%; object-fit: cover; }

.product-card-body { padding: 16px; }
.product-card-body h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 8px; color: var(--gray-800); }

.product-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

.product-price small { font-size: 0.75rem; font-weight: 500; color: var(--gray-400); }

.product-stock { font-size: 0.8rem; margin-top: 4px; }
.product-stock.in-stock { color: var(--success); }
.product-stock.out-of-stock { color: var(--danger); }

/* ============ CHART OF ACCOUNTS TREE ============ */
.account-tree { list-style: none; padding: 0; }
.account-tree ul { list-style: none; padding-right: 24px; }

.account-tree li { margin: 2px 0; }

.account-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.9rem;
}

.account-node:hover { background: var(--gray-50); }
.account-code { font-weight: 700; color: var(--primary); min-width: 40px; }
.account-name { flex: 1; font-weight: 500; }
.account-type { font-size: 0.75rem; color: var(--gray-400); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; color: var(--gray-500); }
.empty-state p { font-size: 0.9rem; margin-bottom: 16px; }

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 24px; }

.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.pagination a { color: var(--gray-600); }
.pagination a:hover { background: var(--gray-100); }
.pagination .active { background: var(--primary); color: white; }

/* ============ SEARCH & FILTERS ============ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  transition: var(--transition);
}

.search-input input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ============ INVOICE DETAIL ============ */
.invoice-detail { max-width: 800px; margin: 0 auto; }

.invoice-header-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.invoice-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid var(--gray-200);
}

.invoice-totals .total-row {
  display: flex;
  justify-content: space-between;
  width: 280px;
  font-size: 0.9rem;
}

.invoice-totals .total-row.grand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  padding-top: 8px;
  border-top: 2px solid var(--gray-300);
}

/* ============ UTILITY ============ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--gray-400); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
  .sidebar-header h2 { font-size: 1.15rem; }
  .nav-item { padding: 9px 16px; font-size: 0.85rem; gap: 9px; }
  .nav-section { padding: 7px 16px 3px; font-size: 0.65rem; }
  .nav-item svg { width: 18px; height: 18px; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 200px; }
  
  .sidebar { 
    transform: translateX(100%);
    width: min(280px, 90vw);
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
  }
  
  .sidebar.open { 
    transform: translateX(0);
  }
  
  .sidebar-header h2 { 
    font-size: 1.1rem;
    padding: 14px 10px;
  }
  
  .sidebar-nav { padding: 10px 0; }
  
  .nav-section { 
    padding: 6px 14px 3px;
    font-size: 0.6rem;
  }
  
  .nav-item { 
    padding: 9px 14px;
    font-size: 0.8rem;
    gap: 8px;
  }
  
  .nav-item svg { 
    width: 18px;
    height: 18px;
  }
  
  .main-content { margin-right: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 101;
    border-radius: 6px;
    transition: var(--transition);
  }
  
  .sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-800);
  }
  
  .sidebar-toggle:active {
    background: var(--gray-200);
  }
  
  .sidebar-close-btn {
    display: flex !important;
  }
  
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  
  .portal-header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    row-gap: 12px;
    column-gap: 8px;
  }
  .portal-logo {
    font-size: 1.15rem;
  }
  .portal-actions {
    gap: 8px;
  }
  .portal-actions .btn {
    height: 34px;
    padding: 0 10px;
    font-size: 0.75rem;
    border-radius: 8px;
  }
  .lang-select {
    height: 34px;
    width: 72px;
    padding-inline-start: 26px;
    padding-inline-end: 16px;
    font-size: 0.75rem;
    border-radius: 8px;
  }
  .lang-globe-icon {
    width: 12px;
    height: 12px;
    inset-inline-start: 8px;
  }
  .lang-chevron-icon {
    width: 10px;
    height: 10px;
    inset-inline-end: 4px;
  }
  .portal-cart {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .portal-cart svg.cart-svg-icon {
    width: 16px;
    height: 16px;
  }
  .portal-search {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }
  .portal-search input {
    height: 36px;
    padding-inline-start: 36px;
    padding-inline-end: 12px;
    font-size: 0.85rem;
  }
  .portal-search .search-icon {
    inset-inline-start: 12px;
    width: 16px;
    height: 16px;
  }
  .search-suggestions {
    max-height: 280px;
  }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .invoice-header-info { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  :root { --sidebar-width: 100vw; }
  
  .sidebar {
    width: 100%;
    max-width: 280px;
  }
  
  .sidebar-header h2 { 
    font-size: 1rem;
    padding: 12px 8px;
  }
  
  .sidebar-nav { padding: 8px 0; }
  
  .nav-section { 
    padding: 5px 12px 2px;
    font-size: 0.55rem;
    letter-spacing: 0.3px;
  }
  
  .nav-item { 
    padding: 8px 12px;
    font-size: 0.75rem;
    gap: 6px;
  }
  
  .nav-item svg { 
    width: 16px;
    height: 16px;
  }
  
  .stats-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; }
  
  .portal-header-inner {
    padding: 8px 12px;
    row-gap: 10px;
  }
  .portal-logo {
    font-size: 1.05rem;
  }
  .portal-actions {
    gap: 4px;
  }
  .portal-actions .btn {
    padding: 0 8px;
    font-size: 0.7rem;
    height: 30px;
  }
  .lang-select {
    width: 66px;
    height: 30px;
    font-size: 0.7rem;
    padding-inline-start: 22px;
    padding-inline-end: 12px;
  }
  .lang-globe-icon {
    width: 10px;
    height: 10px;
    inset-inline-start: 6px;
  }
  .lang-chevron-icon {
    width: 8px;
    height: 8px;
    inset-inline-end: 3px;
  }
  .portal-cart {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }
  .portal-cart svg.cart-svg-icon {
    width: 14px;
    height: 14px;
  }
  .sidebar-close-btn {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
  }
}

/* ============ SEARCH SUGGESTIONS ============ */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
  display: none;
}
.search-suggestions.active {
  display: block;
}
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--gray-800);
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover {
  background: var(--gray-50);
}
.suggestion-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--gray-100);
}
.suggestion-details {
  flex: 1;
}
.suggestion-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.suggestion-price {
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* ============ RESPONSIVE ORDERS PAGE ============ */
.orders-header-row {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  
  .orders-header-row {
    flex-direction: column;
    align-items: stretch !important;
    gap: 16px;
    text-align: center;
  }
  
  .orders-header-row h1 {
    font-size: 1.6rem !important;
    margin-bottom: 4px;
  }
  
  .orders-header-row .btn {
    justify-content: center;
    width: 100%;
  }

  .orders-mobile-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .order-mobile-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
  }

  .order-mobile-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }

  .order-card-header {
    padding: 14px 18px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .order-mobile-card .order-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
  }

  .order-card-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .order-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--gray-700);
  }

  .order-detail-row .detail-label {
    color: var(--gray-500);
    font-weight: 500;
  }

  .order-detail-row .detail-value {
    font-weight: 600;
  }
}

/* ============ MOBILE SIDEBAR & OVERLAY ============ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  z-index: 999;
  display: none;
  animation: fadeInOverlay 0.2s ease;
}

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

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-right: 0 !important;
  }
  .sidebar-toggle {
    display: inline-flex !important;
  }
}

/* ============ MODERN SHOPPING CART PAGE ============ */
.cart-page-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 28px;
  position: relative;
  display: inline-block;
}

.cart-page-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 0;
  width: 40px;
  height: 4px;
  background: var(--primary, #000000);
  border-radius: 2px;
}

.cart-grid {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 32px;
  align-items: flex-start;
}

.cart-items-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.cart-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border-color: var(--gray-300);
}

.cart-item-image {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-item-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  text-decoration: none;
  transition: color 0.2s;
  line-height: 1.4;
}

.cart-item-name:hover {
  color: var(--primary, #000000);
}

.cart-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--gray-500);
}

.cart-item-price-each {
  font-weight: 500;
}

.cart-qty-controls {
  display: inline-flex;
  align-items: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 30px;
  padding: 3px;
  gap: 4px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  color: var(--gray-700);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.qty-btn:hover:not(:disabled) {
  background: var(--primary, #000000);
  color: var(--white);
  transform: scale(1.05);
}

.qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  min-width: 28px;
  text-align: center;
  font-family: Arial, sans-serif;
}

.cart-item-total-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary, #000000);
  min-width: 120px;
  text-align: left;
}

.cart-remove-btn {
  background: transparent;
  border: none;
  color: var(--gray-400);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.cart-remove-btn:hover {
  background: #fef2f2;
  color: #ef4444;
  transform: rotate(8deg);
}

.cart-remove-btn svg {
  width: 20px;
  height: 20px;
}

/* Cart Summary */
.cart-summary-card {
  position: sticky;
  top: 100px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.cart-summary-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: var(--gray-600);
}

.summary-row.total {
  border-top: 1px dashed var(--gray-200);
  margin-top: 18px;
  padding-top: 18px;
  color: var(--gray-900);
  font-size: 1.1rem;
}

.summary-row.total .price {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary, #000000);
}

.checkout-btn {
  width: 100%;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 14px;
  margin-top: 24px;
  background: var(--primary, #000000);
  color: var(--white);
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  background: var(--primary-light, #333333);
}

.continue-shopping {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--gray-500);
  font-size: 0.95rem;
  font-weight: 600;
  transition: color 0.2s;
}

.continue-shopping:hover {
  color: var(--primary, #000000);
}

/* Empty Cart State */
.empty-cart-container {
  text-align: center;
  padding: 60px 24px;
  background: var(--white);
  border-radius: 24px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  max-width: 600px;
  margin: 40px auto;
}

.empty-cart-icon {
  width: 100px;
  height: 100px;
  background: #f8fafc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--gray-400);
}

.empty-cart-icon svg {
  width: 48px;
  height: 48px;
}

.empty-cart-container h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 12px;
}

.empty-cart-container p {
  color: var(--gray-500);
  font-size: 1.05rem;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ============ RESPONSIVE BREAKPOINTS ============ */
@media (max-width: 991px) {
  .cart-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .cart-summary-card {
    position: static;
  }
}

@media (max-width: 768px) {
  .cart-page-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
  }
  .cart-item-card {
    display: grid;
    grid-template-areas: 
      "image details remove"
      "image qty remove"
      "total total total";
    grid-template-columns: 76px 1fr auto;
    gap: 16px;
    padding: 16px;
    align-items: center;
    position: relative;
  }
  .cart-item-image {
    grid-area: image;
    width: 76px;
    height: 76px;
    margin: 0;
  }
  .cart-item-details {
    grid-area: details;
    min-width: 0;
  }
  .cart-item-name {
    font-size: 1rem;
  }
  .cart-qty-form {
    grid-area: qty;
    display: block;
    margin: 0;
  }
  .cart-remove-form {
    grid-area: remove;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .cart-item-total-price {
    grid-area: total;
    width: 100%;
    text-align: right;
    font-size: 1.15rem;
    padding-top: 8px;
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .cart-item-total-price::before {
    content: 'المجموع:';
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
  }
}

@media (max-width: 480px) {
  .cart-item-card {
    grid-template-areas: 
      "image details remove"
      "qty qty qty"
      "total total total";
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
  }
  .cart-item-image {
    width: 64px;
    height: 64px;
    padding: 4px;
  }
  .cart-qty-controls {
    width: fit-content;
  }
  .qty-btn {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }
  .qty-value {
    font-size: 0.9rem;
    min-width: 24px;
  }
  .cart-item-total-price {
    margin-top: 8px;
  }
}

/* ============ SEARCH SUGGESTIONS (AUTOCOMPLETE) ============ */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 400px;
  overflow-y: auto;
}

.search-suggestions.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--gray-800);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--gray-50);
}

.suggestion-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  object-fit: contain;
  padding: 4px;
}

.suggestion-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.suggestion-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suggestion-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary, #2563eb);
}

/* ============ LTR SUPPORT FOR ADMIN DASHBOARD ============ */
html[dir="ltr"] body {
  direction: ltr;
}

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

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

html[dir="ltr"] .nav-item {
  border-right: none;
  border-left: 3px solid transparent;
}

html[dir="ltr"] .nav-item.active {
  border-left-color: var(--primary);
}

@media (max-width: 768px) {
  html[dir="ltr"] .sidebar {
    transform: translateX(-100%);
  }
  html[dir="ltr"] .sidebar.show {
    transform: translateX(0);
  }
}

/* ============ SUPPORT TICKETS STYLING ============ */
.support-tickets-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.support-table th {
  background: var(--gray-50);
  padding: 16px 20px;
  font-weight: 700;
  color: var(--gray-700);
  font-size: 0.85rem;
  border-bottom: 2px solid var(--gray-200);
}

.support-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-150);
  vertical-align: top;
}

.ticket-number-badge {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
}

.ticket-desc-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--gray-800);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.client-info-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--gray-700);
}

.client-info-item svg {
  width: 15px;
  height: 15px;
  color: var(--gray-400);
  flex-shrink: 0;
}

