/* ===== CSS VARIABLES ===== */
:root {
  --primary: #1B8A4C;
  --primary-dark: #145E34;
  --primary-light: #E8F5EE;
  --primary-mid: #2da05a;
  --yellow: #F0B429;
  --yellow-light: #FFFBEB;
  --yellow-dark: #D4940A;
  --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;
  --danger: #EF4444;
  --success: #10B981;
  --blue: #3B82F6;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 8px 32px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.14);
  --header-h: 70px;
  --transition: 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.lang-ar { font-family: 'Noto Sans Arabic', 'Inter', sans-serif; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,138,76,0.12);
}
textarea { resize: vertical; }
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-green { color: var(--primary); }

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== HEADER ===== */
#main-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: var(--header-h);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-left { flex-shrink: 0; }
.header-center { flex: 1; max-width: 520px; margin: 0 auto; }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.logo-icon { font-size: 1.5rem; }
.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border-radius: 50px;
  padding: 0 16px;
  gap: 10px;
  border: 1.5px solid transparent;
  transition: all var(--transition);
}
.search-bar:focus-within {
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,138,76,0.10);
}
.search-icon { font-size: 1rem; color: var(--gray-400); }
.search-bar input {
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 0.9rem;
  box-shadow: none;
}
.search-bar input:focus { box-shadow: none; border: none; }

/* Buttons */
.lang-toggle {
  padding: 7px 16px;
  border-radius: 50px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition);
}
.lang-toggle:hover { background: var(--primary); color: var(--white); }

.cart-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
}
.cart-btn:hover { background: var(--primary-light); }
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--yellow);
  color: var(--gray-900);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
}

.login-btn {
  padding: 9px 22px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.login-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }

.logout-btn {
  padding: 9px 22px;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.logout-btn:hover { background: var(--gray-200); }

.btn-primary {
  padding: 10px 22px;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-outline {
  padding: 10px 22px;
  border: 2px solid rgba(255,255,255,0.6);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-outline:hover { background: rgba(255,255,255,0.15); }
.btn-outline-sm {
  padding: 7px 16px;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition);
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-outline-sm:hover { background: var(--primary-light); }
.btn-yellow {
  padding: 12px 28px;
  background: var(--yellow);
  color: var(--gray-900);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-yellow:hover { background: var(--yellow-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-green {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-green:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost {
  padding: 10px 22px;
  background: transparent;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-full { width: 100%; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

/* ===== CART SIDEBAR ===== */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }

.cart-sidebar {
  position: fixed; top: 0; right: -420px; bottom: 0; width: 420px;
  background: var(--white); z-index: 1001;
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.cart-sidebar.open { right: 0; }
[dir="rtl"] .cart-sidebar { right: auto; left: -420px; }
[dir="rtl"] .cart-sidebar.open { left: 0; }

.cart-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.cart-header h2 { font-size: 1.2rem; font-weight: 700; }
.close-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-500);
  font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.close-btn:hover { background: var(--gray-200); color: var(--gray-800); }

.cart-items { flex: 1; overflow-y: auto; padding: 16px 24px; }
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--gray-100);
}
.cart-item-emoji { font-size: 2.5rem; width: 56px; text-align: center; flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.cart-item-price { color: var(--primary); font-weight: 700; font-size: 0.9rem; }
.cart-item-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--gray-100); color: var(--gray-700);
  font-weight: 700; font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.qty-btn:hover { background: var(--primary-light); color: var(--primary); }
.qty-num { font-weight: 600; min-width: 20px; text-align: center; }
.remove-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: #FEF2F2; color: var(--danger); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.remove-btn:hover { background: var(--danger); color: var(--white); }

.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
  font-size: 1.1rem; font-weight: 700;
}

.cart-empty {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; padding: 40px; text-align: center; color: var(--gray-400);
}
.cart-empty.show { display: flex; }
.cart-empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== PRODUCT MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1100; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.product-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 1101; width: 90%; max-width: 680px;
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 32px;
  opacity: 0; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  max-height: 90vh; overflow-y: auto;
}
.product-modal.open { opacity: 1; pointer-events: all; transform: translate(-50%,-50%) scale(1); }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-500); font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
[dir="rtl"] .modal-close { right: auto; left: 16px; }

.modal-product-emoji { font-size: 5rem; text-align: center; margin-bottom: 16px; }
.modal-product-name { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.modal-product-vendor { color: var(--gray-500); font-size: 0.9rem; margin-bottom: 16px; }
.modal-product-price { font-size: 2rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.modal-product-desc { color: var(--gray-600); line-height: 1.7; margin-bottom: 24px; }
.modal-product-stock { font-size: 0.85rem; color: var(--gray-500); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn-primary { flex: 1; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #0d4a28 100%);
  min-height: 520px;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
  padding: 60px 24px;
  gap: 40px;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='30'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { max-width: 600px; margin: 0 auto; z-index: 1; position: relative; }
.hero-sub {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  padding: 6px 16px; border-radius: 50px;
  font-size: 0.85rem; font-weight: 500; margin-bottom: 16px;
  backdrop-filter: blur(4px);
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800; color: var(--white);
  line-height: 1.15; margin-bottom: 16px;
  letter-spacing: -1px;
}
.hero-title span { color: var(--yellow); }
.hero-desc { color: rgba(255,255,255,0.8); font-size: 1rem; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-visual {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 1; position: relative;
}
.hero-blob {
  width: 280px; height: 280px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
}
.floating-items { position: relative; width: 200px; height: 200px; }
.float-item {
  position: absolute; font-size: 2.5rem;
  animation: float 3s ease-in-out infinite;
}
.f1 { top: 0; left: 50%; transform: translateX(-50%); animation-delay: 0s; }
.f2 { top: 50%; right: 0; transform: translateY(-50%); animation-delay: 0.6s; }
.f3 { bottom: 0; left: 50%; transform: translateX(-50%); animation-delay: 1.2s; }
.f4 { top: 50%; left: 0; transform: translateY(-50%); animation-delay: 1.8s; }
.f5 { top: 30%; left: 30%; animation-delay: 2.4s; }
@keyframes float {
  0%, 100% { transform: translateY(0) translateX(-50%); }
  50% { transform: translateY(-12px) translateX(-50%); }
}
.f2 { animation: floatR 3s ease-in-out infinite 0.6s; }
.f4 { animation: floatR 3s ease-in-out infinite 1.8s; }
@keyframes floatR {
  0%, 100% { transform: translateY(-50%); }
  50% { transform: translateY(calc(-50% - 12px)); }
}

/* ===== STATS BAR ===== */
.stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; justify-content: center; gap: 0;
}
.stat-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 40px; border-right: 1px solid var(--gray-200);
}
.stat-item:last-child { border-right: none; }
.stat-num { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; }

/* ===== CATEGORIES ===== */
.categories-section {
  max-width: 1400px; margin: 0 auto;
  padding: 48px 24px 0;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--gray-900); }

.category-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  padding: 9px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  font-weight: 500; font-size: 0.875rem;
  color: var(--gray-600);
  transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.pill:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.pill.active {
  background: var(--primary); color: var(--white);
  border-color: var(--primary);
}

/* ===== PRODUCTS GRID ===== */
.products-section {
  max-width: 1400px; margin: 0 auto;
  padding: 24px 24px 48px;
}
.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: all var(--transition);
  cursor: pointer;
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.product-card-img {
  background: linear-gradient(135deg, var(--primary-light), var(--yellow-light));
  height: 180px;
  display: flex; align-items: center; justify-content: center;
  font-size: 4.5rem;
  position: relative;
}
.product-card-vendor {
  position: absolute; top: 10px; left: 10px;
  background: rgba(27,138,76,0.9); color: var(--white);
  font-size: 0.7rem; font-weight: 600; padding: 3px 10px;
  border-radius: 50px; backdrop-filter: blur(4px);
}
.product-card-body { padding: 16px; }
.product-card-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; line-height: 1.3; }
.product-card-desc { font-size: 0.8rem; color: var(--gray-500); margin-bottom: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.product-card-price { font-size: 1.05rem; font-weight: 800; color: var(--primary); }
.product-card-price small { font-size: 0.7rem; font-weight: 500; color: var(--gray-400); }
.add-to-cart-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--primary); color: var(--white);
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.add-to-cart-btn:hover { background: var(--primary-dark); transform: scale(1.1); }
.product-card-stock {
  font-size: 0.75rem; color: var(--gray-400); margin-bottom: 10px;
}
.stock-low { color: #F59E0B; }
.no-products {
  grid-column: 1/-1; text-align: center; padding: 80px 20px;
  color: var(--gray-400);
}
.no-products-icon { font-size: 3rem; margin-bottom: 12px; }
.no-products p { font-size: 1rem; }

/* ===== PROMO BANNER ===== */
.promo-banner {
  background: linear-gradient(135deg, var(--yellow-light), #FFF3CC);
  border-top: 2px solid var(--yellow);
  border-bottom: 2px solid var(--yellow);
  padding: 56px 24px;
  text-align: center;
}
.promo-content { max-width: 600px; margin: 0 auto; }
.promo-content h3 { font-size: 1.8rem; font-weight: 800; margin-bottom: 12px; color: var(--gray-900); }
.promo-content p { color: var(--gray-600); margin-bottom: 24px; font-size: 1rem; }

/* ===== FOOTER ===== */
.footer { background: var(--gray-900); color: var(--gray-300); }
.footer-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 48px 24px;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px;
}
.footer-brand .logo-text { color: var(--white); }
.footer-brand p { margin-top: 12px; font-size: 0.9rem; color: var(--gray-400); }
.footer-links h4, .footer-contact h4 { color: var(--white); margin-bottom: 16px; font-size: 0.9rem; font-weight: 700; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 0.875rem; color: var(--gray-400); transition: color var(--transition); }
.footer-links a:hover { color: var(--yellow); }
.footer-contact p { font-size: 0.875rem; color: var(--gray-400); margin-bottom: 6px; }
.footer-bottom {
  border-top: 1px solid var(--gray-800);
  padding: 16px 24px;
  text-align: center;
  font-size: 0.8rem; color: var(--gray-500);
}

/* ===== AUTH PAGE ===== */
.auth-container {
  min-height: calc(100vh - var(--header-h));
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--yellow-light) 100%);
  display: flex; align-items: center; justify-content: center; padding: 40px 20px;
}
.auth-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 460px;
}
.auth-logo {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; margin-bottom: 28px;
}
.auth-logo .logo-text { font-size: 1.8rem; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--gray-500); font-size: 0.9rem; margin-bottom: 24px; }
.auth-tabs { display: flex; background: var(--gray-100); border-radius: var(--radius-sm); padding: 4px; gap: 4px; margin-bottom: 28px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: 6px;
  font-weight: 600; font-size: 0.85rem; color: var(--gray-500);
  transition: all var(--transition); text-align: center;
}
.auth-tab.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow); }
.auth-tab:hover:not(.active) { color: var(--gray-700); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--gray-700); margin-bottom: 6px; }
.demo-hint {
  text-align: center; padding: 8px 16px; margin-bottom: 16px;
  background: var(--gray-100); border-radius: var(--radius-sm);
  font-size: 0.8rem; color: var(--gray-500);
}
.vendor-hint { background: var(--primary-light); color: var(--primary-dark); }
.login-error {
  background: #FEF2F2; color: var(--danger); padding: 10px 16px;
  border-radius: var(--radius-sm); font-size: 0.875rem; text-align: center;
  margin-bottom: 16px; border: 1px solid #FECACA;
}

/* ===== VENDOR PORTAL ===== */
#view-vendor { min-height: 100vh; background: var(--gray-50); }
.vendor-layout { display: flex; min-height: calc(100vh - var(--header-h)); }

.vendor-sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--primary-dark);
  display: flex; flex-direction: column;
  padding: 0;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
}
.vendor-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 8px;
}
.vendor-brand .logo-text { color: var(--white); font-size: 1.2rem; }
.vendor-brand .logo-icon { font-size: 1.3rem; }
.vendor-badge {
  background: var(--yellow); color: var(--gray-900);
  font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
  border-radius: 50px; margin-left: 4px;
}

.vendor-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.vendor-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7); font-weight: 500; font-size: 0.9rem;
  cursor: pointer; transition: all var(--transition);
}
.vendor-nav-item:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.vendor-nav-item.active { background: rgba(255,255,255,0.18); color: var(--white); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; }

.vendor-logout {
  margin: 12px; padding: 11px 16px;
  color: rgba(255,255,255,0.6); font-size: 0.875rem;
  border-radius: var(--radius-sm); display: flex; align-items: center; gap: 10px;
  transition: all var(--transition);
}
.vendor-logout:hover { background: rgba(239,68,68,0.2); color: #FCA5A5; }

.vendor-main { flex: 1; padding: 0 32px 40px; overflow-y: auto; }
.vendor-topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--gray-200); margin-bottom: 28px;
}
.vendor-topbar-right { display: flex; align-items: center; gap: 12px; }
.vendor-page-title { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; }
.vendor-welcome { font-size: 0.875rem; color: var(--gray-500); }
.vendor-welcome strong { color: var(--primary); }

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

/* Stats Cards */
.stats-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--gray-200); box-shadow: var(--shadow);
}
.stat-card.green { border-left: 4px solid var(--primary); }
.stat-card.yellow { border-left: 4px solid var(--yellow); }
.stat-card.blue { border-left: 4px solid var(--blue); }
.stat-card.red { border-left: 4px solid var(--danger); }
.stat-card-icon { font-size: 2rem; }
.stat-card-num { display: block; font-size: 1.3rem; font-weight: 800; color: var(--gray-900); }
.stat-card-label { font-size: 0.8rem; color: var(--gray-500); }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-card {
  background: var(--white); border-radius: var(--radius);
  padding: 24px; border: 1px solid var(--gray-200); box-shadow: var(--shadow);
}
.dash-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--gray-900); }
.dash-hint { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 16px; }

.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th {
  font-size: 0.75rem; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0 0 10px; border-bottom: 1px solid var(--gray-200); text-align: left;
}
.mini-table td { padding: 12px 0; font-size: 0.875rem; border-bottom: 1px solid var(--gray-100); }
[dir="rtl"] .mini-table th, [dir="rtl"] .mini-table td { text-align: right; }

.badge-success { background: #DCFCE7; color: #166534; padding: 3px 10px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.badge-warning { background: #FEF9C3; color: #854D0E; padding: 3px 10px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.badge-info { background: #DBEAFE; color: #1E40AF; padding: 3px 10px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.badge-danger { background: #FEE2E2; color: #991B1B; padding: 3px 10px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }

/* Add Product Form */
.add-product-form {
  background: var(--white); border-radius: var(--radius);
  padding: 32px; border: 1px solid var(--gray-200); box-shadow: var(--shadow);
}
.add-product-form h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }
.form-hint { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.form-grid .form-group { margin-bottom: 0; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.product-success {
  margin-top: 16px; padding: 12px 20px;
  background: #DCFCE7; color: #166534; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.9rem;
  border: 1px solid #86EFAC;
}

/* Inventory Table */
.inventory-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.inventory-header h3 { font-size: 1.1rem; font-weight: 700; }
.table-wrap { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); overflow: hidden; box-shadow: var(--shadow); }
.inventory-table { width: 100%; border-collapse: collapse; }
.inventory-table th {
  background: var(--gray-50); padding: 12px 16px;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200); text-align: left;
}
[dir="rtl"] .inventory-table th { text-align: right; }
.inventory-table td { padding: 14px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.inventory-table tr:last-child td { border-bottom: none; }
.inventory-table tr:hover td { background: var(--gray-50); }
.table-product-cell { display: flex; align-items: center; gap: 12px; }
.table-emoji { font-size: 1.8rem; }
.table-product-name { font-weight: 600; }
.table-product-cat { font-size: 0.75rem; color: var(--gray-400); }
.action-btn {
  padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
  transition: all var(--transition);
}
.action-edit { background: var(--primary-light); color: var(--primary); margin-right: 6px; }
.action-edit:hover { background: var(--primary); color: var(--white); }
.action-delete { background: #FEE2E2; color: var(--danger); }
.action-delete:hover { background: var(--danger); color: var(--white); }

/* ===== CHECKOUT ===== */
.checkout-container {
  max-width: 1100px; margin: 0 auto; padding: 32px 24px 60px;
}
.back-btn {
  color: var(--primary); font-weight: 600; font-size: 0.9rem;
  margin-bottom: 20px; display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.back-btn:hover { color: var(--primary-dark); }
.checkout-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 28px; }
.checkout-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.checkout-card {
  background: var(--white); border-radius: var(--radius);
  padding: 24px; border: 1px solid var(--gray-200); box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.checkout-card:last-child { margin-bottom: 0; }
.checkout-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-200); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.full-width { grid-column: 1/-1; }

/* Payment Options */
.payment-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.payment-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200); cursor: pointer;
  transition: all var(--transition); position: relative;
}
.payment-option:hover { border-color: var(--primary); background: var(--primary-light); }
.payment-option.active { border-color: var(--primary); background: var(--primary-light); }
.payment-option input { position: absolute; opacity: 0; }
.pay-content { display: flex; align-items: center; gap: 12px; flex: 1; }
.pay-icon { font-size: 1.5rem; }
.pay-content strong { display: block; font-size: 0.9rem; }
.pay-content small { color: var(--gray-500); font-size: 0.8rem; }
.pay-check { color: var(--primary); font-weight: 700; opacity: 0; }
.payment-option.active .pay-check { opacity: 1; }
.card-details { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-200); }

/* Order Summary */
.checkout-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--gray-100);
}
.checkout-item:last-child { border-bottom: none; }
.checkout-item-emoji { font-size: 2rem; }
.checkout-item-info { flex: 1; }
.checkout-item-name { font-weight: 600; font-size: 0.875rem; }
.checkout-item-qty { font-size: 0.8rem; color: var(--gray-500); }
.checkout-item-price { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.order-totals { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.order-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 0.9rem;
}
.total-row { padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--gray-200); font-size: 1rem; }
.secure-badge {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 12px; font-size: 0.8rem; color: var(--gray-400);
}

/* Order Success */
.order-success-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.success-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 48px; text-align: center; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg); animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.success-icon { font-size: 4rem; margin-bottom: 16px; }
.success-card h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 12px; color: var(--gray-900); }
.success-card p { color: var(--gray-500); margin-bottom: 12px; line-height: 1.6; }
.order-num { font-size: 0.9rem; font-weight: 700; color: var(--primary); margin-bottom: 24px; }

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .header-inner { flex-direction: row-reverse; }
[dir="rtl"] .hero-content { text-align: right; }
[dir="rtl"] .hero-actions { justify-content: flex-start; }
[dir="rtl"] .footer-inner { direction: rtl; }
[dir="rtl"] .vendor-sidebar { border-right: none; border-left: 1px solid rgba(255,255,255,0.1); }
[dir="rtl"] .stat-card.green { border-left: none; border-right: 4px solid var(--primary); }
[dir="rtl"] .stat-card.yellow { border-left: none; border-right: 4px solid var(--yellow); }
[dir="rtl"] .stat-card.blue { border-left: none; border-right: 4px solid var(--blue); }
[dir="rtl"] .stat-card.red { border-left: none; border-right: 4px solid var(--danger); }
[dir="rtl"] .vendor-brand { flex-direction: row-reverse; }
[dir="rtl"] .vendor-nav-item { flex-direction: row-reverse; }
[dir="rtl"] .action-edit { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .search-bar { flex-direction: row-reverse; }
[dir="rtl"] .cart-sidebar { right: auto; left: -420px; }
[dir="rtl"] .cart-sidebar.open { left: 0; right: auto; }
[dir="rtl"] .modal-close { right: auto; left: 16px; }
[dir="rtl"] .payment-option { flex-direction: row-reverse; }
[dir="rtl"] .pay-content { flex-direction: row-reverse; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { flex-direction: column; text-align: center; }
  .hero-visual { display: none; }
  .hero-actions { justify-content: center; }
  .header-center { display: none; }
  .stats-bar { flex-wrap: wrap; }
  .stat-item { padding: 14px 20px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .footer-inner { grid-template-columns: 1fr; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .vendor-sidebar { width: 220px; }
  .checkout-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .vendor-layout { flex-direction: column; }
  .vendor-sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .vendor-nav { flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .vendor-main { padding: 16px; }
  .stats-cards { grid-template-columns: 1fr 1fr; }
}
