/* ═══════════════════════════════════════════════════════════
   Asabsys Design System — shadcn/ui Inspired
   Modern · Dark · Premium · RTL-Ready
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Colors */
  --bg:           #09090b;
  --bg-card:      #18181b;
  --bg-card2:     #1c1c1f;
  --bg-hover:     #27272a;
  --border:       rgba(255,255,255,0.08);
  --border-focus: rgba(99,102,241,0.6);
  --text:         #fafafa;
  --text-muted:   #b4b4bc;
  --text-subtle:  #71717a;
  --primary:      #6366f1;
  --primary-h:    #4f46e5;
  --primary-glow: rgba(99,102,241,0.25);
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #3b82f6;
  --gold:         #f59e0b;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow:       0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow:  0 0 24px rgba(99,102,241,0.2);
  --transition:   0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid #818CF8; outline-offset: 2px; border-radius: 4px; }
button { cursor: pointer; }

/* ── Typography ── */
.ds-h1 { font-size: clamp(2rem,6vw,4.5rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; color: var(--text); }
.ds-h2 { font-size: clamp(1.5rem,4vw,2.8rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
.ds-h3 { font-size: 1.25rem; font-weight: 600; color: var(--text); }
.ds-lead { font-size: clamp(1rem,2.5vw,1.2rem); color: var(--text-muted); line-height: 1.7; }
.ds-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); }
.ds-gradient-text {
  background: linear-gradient(135deg, #818cf8, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ── */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.ds-btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 0 var(--primary-glow);
}
.ds-btn-primary:hover {
  background: var(--primary-h);
  box-shadow: 0 0 20px var(--primary-glow);
  transform: translateY(-1px);
}
.ds-btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}
.ds-btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.15);
}
.ds-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.ds-btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.ds-btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.ds-btn-lg { padding: 0.85rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }

/* ── Cards ── */
.ds-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  overflow: hidden;
}
.ds-card:hover {
  border-color: rgba(255,255,255,0.14);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.ds-card-glass {
  background: rgba(24,24,27,0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Badge ── */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.ds-badge-primary { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); }
.ds-badge-success { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.ds-badge-warning { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.ds-badge-danger  { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25);  }

/* ── Inputs ── */
.ds-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.ds-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.ds-input::placeholder { color: var(--text-subtle); }

/* ── Separators ── */
.ds-separator { height: 1px; background: var(--border); border: none; margin: 0; }

/* ── Skeleton ── */
.ds-skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 400% 100%;
  animation: ds-shimmer 1.4s ease infinite;
  border-radius: var(--radius);
}
@keyframes ds-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Navigation ── */
.ds-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: rgba(9,9,11,0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.ds-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.ds-nav-items {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-inline-start: auto;
}

/* ── Stats / KPI ── */
.ds-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.ds-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--primary));
  opacity: 0.8;
}
.ds-stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.ds-stat-label { font-size: 0.8rem; color: var(--text-muted); }
.ds-stat-change { font-size: 0.78rem; font-weight: 600; }
.ds-stat-change.up   { color: var(--success); }
.ds-stat-change.down { color: var(--danger); }

/* ── Sidebar ── */
.ds-sidebar {
  width: 260px;
  height: 100dvh;
  background: var(--bg-card);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  z-index: 50;
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}
.ds-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 1rem;
  margin: 0 0.5rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
  width: calc(100% - 1rem);
  text-align: start;
}
.ds-sidebar-item:hover { background: var(--bg-hover); color: var(--text); }
.ds-sidebar-item.active { background: rgba(99,102,241,0.15); color: #818cf8; }
.ds-sidebar-item i { font-size: 1.1rem; flex-shrink: 0; }
.ds-sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  padding: 0.75rem 1.5rem 0.3rem;
}

/* ── Tables ── */
.ds-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ds-table th {
  text-align: start;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border);
}
.ds-table td {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.ds-table tr:hover td { background: var(--bg-hover); }
.ds-table tr:last-child td { border-bottom: none; }

/* ── Grid Layouts ── */
.ds-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.ds-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ds-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.ds-grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
@media (max-width: 768px) {
  .ds-grid-2, .ds-grid-3, .ds-grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 640px) and (max-width: 1024px) {
  .ds-grid-3, .ds-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Hero Section ── */
.ds-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.5rem 3rem;
  overflow: hidden;
  text-align: center;
}
.ds-hero-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.ds-hero-glow::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(99,102,241,0.18) 0%, transparent 70%);
}
.ds-hero-glow::after {
  content: '';
  position: absolute;
  bottom: 10%;
  right: 10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(167,139,250,0.1) 0%, transparent 70%);
}
.ds-hero-content { position: relative; z-index: 1; max-width: 800px; }

/* ── Store Cards (index page) ── */
.ds-store-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.ds-store-card:hover {
  border-color: rgba(99,102,241,0.35);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.15);
  transform: translateY(-3px);
}
.ds-store-banner {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: var(--bg-hover);
  display: block;
}
.ds-store-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.ds-store-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 2px solid var(--bg);
  margin-top: -28px;
  background: var(--bg-card2);
  flex-shrink: 0;
}
.ds-store-name { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.ds-store-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.ds-store-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ── Product Cards (shop page) ── */
.ds-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.ds-product-card:hover {
  border-color: rgba(255,255,255,0.14);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.ds-product-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-hover);
  display: block;
}
.ds-product-body { padding: 0.9rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.ds-product-name { font-size: 0.92rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.ds-product-price { font-size: 1.05rem; font-weight: 800; color: var(--primary); }
.ds-product-price-old { font-size: 0.8rem; color: var(--text-subtle); text-decoration: line-through; }
.ds-product-footer { padding: 0.75rem; border-top: 1px solid var(--border); }
.ds-add-to-cart {
  width: 100%;
  padding: 0.6rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ds-add-to-cart:hover { background: var(--primary-h); transform: translateY(-1px); }

/* ── Animations ── */
@keyframes ds-fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ds-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ds-pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50%      { box-shadow: 0 0 20px 4px var(--primary-glow); }
}
.ds-animate-up { animation: ds-fadeUp 0.5s ease both; }
.ds-animate-in { animation: ds-fadeIn 0.4s ease both; }
[data-delay="1"] { animation-delay: 0.1s; }
[data-delay="2"] { animation-delay: 0.2s; }
[data-delay="3"] { animation-delay: 0.3s; }
[data-delay="4"] { animation-delay: 0.4s; }
[data-delay="5"] { animation-delay: 0.5s; }

/* ── Utility ── */
.ds-flex     { display: flex; }
.ds-flex-col { display: flex; flex-direction: column; }
.ds-items-center { align-items: center; }
.ds-justify-between { justify-content: space-between; }
.ds-gap-1 { gap: 0.5rem; }
.ds-gap-2 { gap: 1rem; }
.ds-gap-3 { gap: 1.5rem; }
.ds-p-1 { padding: 0.5rem; }
.ds-p-2 { padding: 1rem; }
.ds-p-3 { padding: 1.5rem; }
.ds-px-2 { padding-inline: 1rem; }
.ds-py-2 { padding-block: 1rem; }
.ds-rounded { border-radius: var(--radius); }
.ds-rounded-lg { border-radius: var(--radius-lg); }
.ds-text-center { text-align: center; }
.ds-w-full { width: 100%; }
.ds-truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ── Dashboard Layout ── */
.ds-dashboard-layout {
  display: flex;
  min-height: 100dvh;
  background: var(--bg);
}
.ds-main-content {
  flex: 1;
  margin-inline-start: 260px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ds-topbar {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.ds-page { padding: 1.5rem; overflow-y: auto; flex: 1; }
@media (max-width: 768px) {
  .ds-sidebar { transform: translateX(100%); }
  .ds-sidebar.open { transform: translateX(0); }
  .ds-main-content { margin-inline-start: 0; }
}

/* ── Search Bar ── */
.ds-search {
  position: relative;
  display: flex;
  align-items: center;
}
.ds-search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}
.ds-search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.ds-search-icon {
  position: absolute;
  inset-inline-start: 0.75rem;
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 1rem;
}

/* ── Scrollbar ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 10px; }

/* ── Grid pattern background ── */
.ds-grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── RTL support ── */
[dir="rtl"] .ds-sidebar { right: 0; left: auto; border-inline-end: none; border-inline-start: 1px solid var(--border); }
[dir="rtl"] .ds-main-content { margin-inline-start: 260px; }

/* ════════════════════════════════════════════════════════════
   Unified Button Components — v1.0
   أزرار موحدة عبر كل صفحات المشروع
   ════════════════════════════════════════════════════════════ */

/* ① زر إغلاق المودال (X) — يُستخدم في رأس كل modal */
.btn-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #CBD5E1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  font-size: 1.2rem;
  line-height: 1;
}
.btn-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #F1F5F9;
}
.btn-modal-close:active {
  background: rgba(255, 255, 255, 0.18);
}

/* ② زر "إلغاء" داخل المودالات — بديل موحد لـ .btn-gold-ghost و .btn-secondary */
.btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #94A3B8;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
  color: #CBD5E1;
}
.btn-cancel:active {
  background: rgba(255, 255, 255, 0.12);
}

/* ③ زر "تسجيل الخروج" في الـ Sidebar — موحد بدون gradient */
.btn-logout-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  align-self: stretch;
  box-sizing: border-box;
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #F87171;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  width: 100%;
}
.btn-logout-sidebar:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FCA5A5;
}
.btn-logout-sidebar:active {
  background: rgba(239, 68, 68, 0.26);
}

/* ④ زر إغلاق الـ Sidebar على الموبايل */
.btn-sidebar-close-mobile {
  display: none; /* يُظهره JS عند فتح الـ sidebar على موبايل */
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #CBD5E1;
  cursor: pointer;
  font-size: 1.25rem;
  z-index: 20;
  transition: background 0.18s, border-color 0.18s;
}
.btn-sidebar-close-mobile:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}
/* JS يضع display:flex عند الحاجة */
