/* ============================================================
   لوحة تحكم روعية — Admin
   ============================================================ */
:root {
  --a-bg: #f4f1f6;
  --a-side: #2b2330;
  --a-side-2: #362c3d;
  --a-rose: #b76e79;
  --a-gold: #c9a961;
  --a-ink: #322a36;
  --a-muted: #8a8090;
  --a-line: #e7e1ec;
  --a-white: #fff;
  --a-success: #2f8a72;
  --a-warning: #b7791f;
  --a-danger: #c0392b;
  --a-radius: 14px;
  --a-shadow: 0 6px 24px rgba(43,35,48,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: var(--a-bg); color: var(--a-ink); direction: rtl; line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }

.admin-wrap { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }

/* الشريط الجانبي */
.sidebar { background: linear-gradient(180deg, var(--a-side), var(--a-side-2)); color: #ddd4e2; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 16px; }
.sidebar .brand .mark { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--a-rose), var(--a-gold)); display: grid; place-items: center; font-size: 20px; color: #fff; }
.sidebar .brand b { color: #fff; font-size: 19px; }
.sidebar .brand small { display: block; color: #a99fb2; font-size: 11px; letter-spacing: 2px; }
.nav-group { font-size: 12px; color: #8a8094; padding: 14px 10px 6px; letter-spacing: .5px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: #ccc2d4; font-size: 15px; font-weight: 600; margin-bottom: 3px; transition: background .18s, color .18s; }
.sidebar nav a .ico { font-size: 18px; width: 22px; text-align: center; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: linear-gradient(135deg, var(--a-rose), #92505b); color: #fff; box-shadow: 0 6px 16px rgba(183,110,121,.35); }

/* المحتوى */
.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-top { background: #fff; border-bottom: 1px solid var(--a-line); padding: 14px 26px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; }
.admin-top h1 { font-size: 21px; }
.admin-top .spacer { margin-inline-start: auto; }
.admin-top .who { display: flex; align-items: center; gap: 10px; color: var(--a-muted); font-size: 14px; }
.admin-top .avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--a-rose), var(--a-gold)); color: #fff; display: grid; place-items: center; font-weight: 700; }
.admin-body { padding: 26px; }

/* بطاقات الإحصائيات */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat { background: #fff; border-radius: var(--a-radius); padding: 20px; box-shadow: var(--a-shadow); display: flex; align-items: center; gap: 16px; }
.stat .ico { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; color: #fff; }
.stat .ico.rose { background: linear-gradient(135deg, #b76e79, #92505b); }
.stat .ico.gold { background: linear-gradient(135deg, #c9a961, #a8873f); }
.stat .ico.green { background: linear-gradient(135deg, #2f8a72, #1f6b57); }
.stat .ico.purple { background: linear-gradient(135deg, #7d6a9c, #5c4c78); }
.stat b { font-size: 28px; display: block; line-height: 1.1; }
.stat span { color: var(--a-muted); font-size: 14px; }

/* البطاقات والجداول */
.card { background: #fff; border-radius: var(--a-radius); box-shadow: var(--a-shadow); overflow: hidden; margin-bottom: 22px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--a-line); display: flex; align-items: center; gap: 12px; }
.card-head h2 { font-size: 17px; }
.card-head .spacer { margin-inline-start: auto; }
.card-body { padding: 20px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 620px; }
table.data th, table.data td { padding: 13px 16px; text-align: start; font-size: 14.5px; border-bottom: 1px solid var(--a-line); }
table.data th { background: #faf7fb; color: var(--a-muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fbf9fc; }
.tprod { display: flex; align-items: center; gap: 12px; }
.tprod img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: #f0eaf2; }
.tprod b { font-size: 14.5px; }
.tprod small { color: var(--a-muted); }

/* شارات */
.pill { display: inline-block; padding: 4px 12px; border-radius: 50px; font-size: 12.5px; font-weight: 700; }
.pill.pending { background: #fdf3e2; color: var(--a-warning); }
.pill.confirmed { background: #e6eefb; color: #2b5fb3; }
.pill.shipped { background: #ede6fb; color: #6a4bb3; }
.pill.delivered { background: #e5f4ef; color: var(--a-success); }
.pill.cancelled { background: #fbeaea; color: var(--a-danger); }
.pill.on { background: #e5f4ef; color: var(--a-success); }
.pill.off { background: #f0edf2; color: var(--a-muted); }

/* أزرار الأدمن */
.abtn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; transition: opacity .2s, transform .1s; }
.abtn:active { transform: translateY(1px); }
.abtn-primary { background: linear-gradient(135deg, var(--a-rose), #92505b); color: #fff; }
.abtn-gold { background: linear-gradient(135deg, var(--a-gold), var(--a-gold-dark, #a8873f)); color: #fff; }
.abtn-light { background: #f2edf4; color: var(--a-ink); }
.abtn-light:hover { background: #e9e1ec; }
.abtn-danger { background: #fbeaea; color: var(--a-danger); }
.abtn-danger:hover { background: #f6d9d9; }
.abtn:hover { opacity: .93; }
.abtn-sm { padding: 7px 13px; font-size: 13px; }
.actions-row { display: flex; gap: 7px; flex-wrap: wrap; }

/* نماذج الأدمن */
.afield { margin-bottom: 16px; }
.afield label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.afield input, .afield textarea, .afield select { width: 100%; padding: 11px 13px; border: 1.5px solid var(--a-line); border-radius: 10px; font-family: inherit; font-size: 14.5px; background: #faf8fb; transition: border-color .2s; }
.afield input:focus, .afield textarea:focus, .afield select:focus { outline: none; border-color: var(--a-rose); background: #fff; }
.afield textarea { min-height: 100px; resize: vertical; }
.afield .err { color: var(--a-danger); font-size: 13px; margin-top: 5px; }
.agrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.agrid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.check-row { display: flex; align-items: center; gap: 10px; }
.check-row input { width: auto; }

.a-alert { padding: 13px 18px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; font-size: 14.5px; }
.a-alert.success { background: #e5f4ef; color: var(--a-success); }
.a-alert.danger { background: #fbeaea; color: var(--a-danger); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--a-muted); }
.empty-state .emoji { font-size: 50px; margin-bottom: 12px; }

/* تسجيل الدخول */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #2b2330, #4a3c52); padding: 20px; }
.login-card { background: #fff; border-radius: 22px; padding: 38px 34px; width: 100%; max-width: 410px; box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; text-align: center; }
.login-card .brand .mark { width: 60px; height: 60px; border-radius: 16px; background: linear-gradient(135deg, var(--a-rose), var(--a-gold)); display: grid; place-items: center; font-size: 30px; color: #fff; }
.login-card .brand b { font-size: 24px; }
.login-card .brand span { color: var(--a-muted); font-size: 14px; }
.login-hint { margin-top: 18px; padding: 12px; background: #faf7fb; border: 1px dashed var(--a-line); border-radius: 10px; font-size: 13px; color: var(--a-muted); text-align: center; }

@media (max-width: 860px) {
  .admin-wrap { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .agrid, .agrid-3 { grid-template-columns: 1fr; }
}
