/* ============================================================================
   التصميم العام للنظام - النظام الإداري والمحاسبي المتكامل
   خط Tajawal / Noto Kufi Arabic - RTL - وضع فاتح وداكن
   ============================================================================ */

:root {
  --color-bg: #f3f6fb;
  --color-surface: #ffffff;
  --color-text: #101828;
  --color-muted: #667085;
  --color-border: #e4e9f2;
  --color-primary: #1d4ed8;
  --color-primary-dark: #1e40af;
  --color-orange: #f97316;
  --color-orange-dark: #c2410c;
  --shadow-card: 0 10px 30px rgba(16, 24, 40, 0.06);
  --sidebar-width: 260px;
}

[data-theme="dark"] {
  --color-bg: #0b1220;
  --color-surface: #101a2e;
  --color-text: #e6ebf5;
  --color-muted: #93a2c0;
  --color-border: #223151;
  --color-primary: #38bdf8;
  --color-primary-dark: #0ea5e9;
  --color-orange: #fb923c;
  --color-orange-dark: #f97316;
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  font-family: 'Tajawal', 'Noto Kufi Arabic', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  direction: rtl;
  margin: 0;
}

.font-kufi { font-family: 'Noto Kufi Arabic', sans-serif; }

a { text-decoration: none; }

/* --------------------------- التخطيط العام --------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  position: fixed;
  top: 0; right: 0; bottom: 0;
  overflow-y: auto;
  z-index: 30;
  transition: transform .2s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem; border-bottom: 1px solid var(--color-border);
}
.sidebar-brand .logo-icon {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg,#1d4ed8,#f97316);
  display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800;
}
.sidebar-nav { padding: 1rem .75rem; display:flex; flex-direction:column; gap:.25rem; }
.sidebar-nav a {
  display:flex; align-items:center; gap:.65rem;
  padding:.65rem .85rem; border-radius:.75rem;
  color: var(--color-muted); font-weight:600; font-size:.9rem;
}
.sidebar-nav a:hover { background: var(--color-bg); color: var(--color-text); }
.sidebar-nav a.active { background: var(--color-primary); color:#fff; box-shadow: var(--shadow-card); }

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

.topbar {
  position: sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--color-border);
  padding: .75rem 1.5rem;
}

.page-wrap { padding: 1.5rem; max-width:1600px; margin:0 auto; }

/* --------------------------- البطاقات --------------------------- */
.card-aas {
  background: var(--color-surface);
  border:1px solid var(--color-border);
  border-radius:1rem;
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
}
.card-blue { background: linear-gradient(135deg, rgba(29,78,216,.12), rgba(29,78,216,.02)); border:1px solid rgba(29,78,216,.25); }
.card-orange { background: linear-gradient(135deg, rgba(249,115,22,.12), rgba(249,115,22,.02)); border:1px solid rgba(249,115,22,.25); }

.stat-icon {
  width:48px; height:48px; border-radius:14px;
  display:flex; align-items:center; justify-content:center; color:#fff; font-size:1.3rem;
}
.stat-icon.blue { background:#1d4ed8; }
.stat-icon.orange { background:#f97316; }

/* --------------------------- الجداول --------------------------- */
.table-aas { width:100%; border-collapse:collapse; font-size:.85rem; }
.table-aas th {
  text-align:right; padding:.75rem .9rem; background:var(--color-bg);
  color:var(--color-muted); font-weight:700; border-bottom:1px solid var(--color-border); white-space:nowrap;
}
.table-aas td { padding:.65rem .9rem; border-bottom:1px solid var(--color-border); vertical-align:middle; }
.table-aas tbody tr:hover { background: color-mix(in srgb, var(--color-primary) 6%, transparent); }

/* --------------------------- الأزرار والمدخلات --------------------------- */
.btn-aas {
  display:inline-flex; align-items:center; gap:.4rem;
  border-radius:.65rem; padding:.5rem 1.1rem; font-weight:700; font-size:.85rem; border:none; cursor:pointer;
}
.btn-aas-primary { background:var(--color-primary); color:#fff; }
.btn-aas-primary:hover { background:var(--color-primary-dark); color:#fff; }
.btn-aas-orange { background:var(--color-orange); color:#fff; }
.btn-aas-outline { background:transparent; border:1px solid var(--color-border); color:var(--color-text); }
.btn-aas-outline:hover { background: var(--color-bg); }

.form-control, .form-select {
  background: var(--color-surface); color: var(--color-text);
  border:1px solid var(--color-border); border-radius:.6rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
  background: var(--color-surface); color: var(--color-text);
}

.badge-aas { display:inline-flex; align-items:center; gap:.25rem; border-radius:999px; padding:.15rem .65rem; font-size:.72rem; font-weight:700; }
.badge-green { background: rgba(16,185,129,.12); color:#059669; }
.badge-red { background: rgba(239,68,68,.12); color:#dc2626; }
.badge-orange { background: rgba(249,115,22,.12); color:#c2410c; }
.badge-blue { background: rgba(29,78,216,.12); color:#1d4ed8; }
.badge-slate { background: rgba(100,116,139,.12); color:#475569; }

@media (max-width: 992px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
}

@media print {
  .no-print { display: none !important; }
  .main-content { margin-right: 0 !important; }
  body { background: #fff !important; }
}
