/*
#المسار: server/public/assets/admin.css
#فائده الصفحه: تصميم لوحة التحكم: RTL بخط Cairo، قائمة جانبية، بطاقات ومؤشرات، جداول، نماذج ومفاتيح تشغيل، ودعم الجوال
#الإصدار: 1.0.0
#النوع: Style
#الكاتب: Dr.Tridz
*/

@font-face {
  font-family: "Cairo";
  src: url("fonts/Cairo.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --bg: #f4f5f9;
  --card: #ffffff;
  --ink: #1b1f33;
  --muted: #6b7189;
  --line: #e6e8f0;
  --side: #161a2e;
  --side-ink: #c9cde0;
  --primary: #2f5bea;
  --primary-soft: #e8eeff;
  --gold: #f2b544;
  --green: #18a058;
  --red: #d63b4a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 50, .05), 0 4px 18px rgba(20, 24, 50, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Cairo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; line-height: 1.3; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 700; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--primary-soft); padding: 1px 6px; border-radius: 6px; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; display: block; margin-top: 6px; }

/* الإطار */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex: none; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 22px; text-decoration: none !important; }
.brand b { display: block; font-size: 18px; font-weight: 800; }
.brand small { display: block; font-size: 12px; color: var(--side-ink); margin-top: -4px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #e0703a); color: #2a1606; font-weight: 900; font-size: 20px;
}
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: var(--side-ink); padding: 9px 12px; border-radius: 10px; font-weight: 600; text-decoration: none; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: rgba(242, 181, 68, .14); color: var(--gold); }
.me { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me-name { color: #fff; font-weight: 700; text-decoration: none !important; }
.me-name small { display: block; color: var(--side-ink); font-weight: 400; font-size: 12px; }
.main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.menu-btn { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.crumbs { margin: 0 0 2px !important; font-size: 13px; }

/* بطاقات */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head.pad { padding: 16px 20px 0; }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .card { margin-bottom: 0; }
.narrow { max-width: 460px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi b { font-size: 28px; font-weight: 800; line-height: 1.25; margin: 2px 0; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.accent { background: linear-gradient(135deg, #22284a, #2f3b7a); color: #fff; }
.kpi.accent span, .kpi.accent small { color: #c9d1f5; }
.up { color: var(--green) !important; }
.kpi.accent .up { color: #7ee2a8 !important; }
.down { color: var(--red) !important; }
.kpi.accent .down { color: #ff9aa4 !important; }

/* الرسم */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--primary); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linejoin: round; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-start: 8px; }
.sw.a { background: var(--primary); }
.sw.b { background: var(--gold); }
.barcell { width: 32%; }
.barcell svg { width: 100%; height: 8px; display: block; transform: scaleX(-1); }
.barcell .track { fill: var(--line); }
.barcell .fill { fill: #b9c7fb; }
.barcell .fill2 { fill: var(--primary); }

/* جداول */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 520px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; position: sticky; top: 0; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbff; }
.table.compact td, .table.compact th { padding: 7px 12px; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.kv b { color: var(--ink); font-weight: 600; }
.stars { color: var(--gold); letter-spacing: 2px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.rank li:last-child { border-bottom: 0; }
.empty-line { color: var(--muted); padding: 18px 20px; margin: 0; }
.empty { text-align: center; padding: 60px 20px; }
.empty h1 { margin-bottom: 8px; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); vertical-align: middle; }
.tag.red { background: #fde8ea; color: var(--red); }
.tag.green { background: #e3f6ec; color: var(--green); }

/* نماذج */
input, select {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[readonly] { background: #f6f7fa; color: var(--muted); }
input.num { width: 110px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.btn {
  font: inherit; font-weight: 700; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none !important; transition: background .15s, transform .05s;
}
.btn:hover { background: #f4f6fb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #2549c8; }
.btn.ghost { background: transparent; border-color: rgba(127, 135, 170, .35); color: inherit; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input { width: 200px; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.alert.ok { background: #e3f6ec; color: #11683a; }
.alert.error { background: #fde8ea; color: #9b1c2a; }
.alert.info { background: var(--primary-soft); color: #23409e; font-weight: 500; }

.settings { padding: 0; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.setting-text label { font-size: 15px; }
.setting-text p { margin: 2px 0 0; }
.setting-input input[type=text] { width: 320px; max-width: 100%; }
.setting.has-error { background: #fff7f8; }
.field-error { color: var(--red); font-size: 13px; font-weight: 700; margin: 4px 0 0; }
.form-foot { padding: 16px 20px; display: flex; justify-content: flex-start; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cdd2e1; border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.switch input:disabled + span { opacity: .55; cursor: not-allowed; }

/* المتجر */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { background: var(--card); box-shadow: var(--shadow); padding: 7px 16px; border-radius: 99px; color: var(--ink); font-weight: 700; text-decoration: none; }
.tabs a small { color: var(--muted); font-weight: 600; }
.shop-head, .shop-row { display: grid; grid-template-columns: 2fr 2fr 120px 120px 120px 64px 80px; gap: 12px; align-items: center; padding: 10px 20px; }
.shop-head { font-size: 12px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); background: #fafbfd; margin-top: 12px; }
.shop-row { border-bottom: 1px solid var(--line); margin: 0; }
.shop-row:last-child { border-bottom: 0; }
.shop-row.off { background: #fafafa; }
.shop-row.off .item-id { opacity: .55; }
.shop-row input.num, .shop-row select, .shop-row input { width: 100%; }
.cell { gap: 4px; font-weight: 500; }
.cell small { display: none; color: var(--muted); font-size: 12px; }
.item-id { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.item-id img, .thumb { width: 40px; height: 40px; border-radius: 10px; background: #eef1f8; object-fit: cover; flex: none; }
.thumb { display: grid; place-items: center; font-style: normal; font-weight: 800; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

/* الدخول */
.bare { background: radial-gradient(1200px 600px at 80% -10%, #2f3b7a 0%, #161a2e 55%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { background: var(--card); width: 100%; max-width: 400px; border-radius: 20px; padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-card .brand { color: var(--ink); padding-bottom: 18px; }
.auth-card .brand small { color: var(--muted); }
.auth-title { font-size: 20px; margin-bottom: 14px; text-align: center; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 17px; font-weight: 700; letter-spacing: 1px; text-align: center; background: var(--primary-soft); color: #23409e; padding: 12px; border-radius: 12px; margin: 10px 0; cursor: copy; user-select: all; }
.code-input { font-family: ui-monospace, Consolas, monospace; font-size: 26px; text-align: center; letter-spacing: 8px; padding: 10px; }

@media (max-width: 1100px) {
  .grid2 { grid-template-columns: 1fr; }
  .shop-head { display: none; }
  .shop-row { grid-template-columns: 1fr 1fr; }
  .shop-row .item-id { grid-column: 1 / -1; }
  .cell small { display: block; }
}
@media (max-width: 760px) {
  .side { position: fixed; inset: 0 0 0 auto; z-index: 20; transform: translateX(100%); transition: transform .2s; box-shadow: -10px 0 40px rgba(0, 0, 0, .3); }
  .side.open { transform: none; }
  .main { padding: 16px 16px 40px; }
  .menu-btn { display: inline-flex; font-size: 20px; background: var(--card); border: 0; box-shadow: var(--shadow); border-radius: 10px; padding: 4px 12px; margin-bottom: 12px; cursor: pointer; }
  .setting { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-input input[type=text] { width: 100%; }
  .kpi b { font-size: 24px; }
}
