/* لوحة التحكم — ألوان متوافقة مع الموقع العام */
:root {
  --p: #0b3d2e;
  --s: #145a41;
  --bg: #f5f7f6;
  --card: #fff;
  --err: #ce1126;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans Arabic", "Segoe UI", sans-serif; background: var(--bg); color: #1a2e28; }
.muted { color: #5a6f66; font-size: 0.9rem; }
.error { color: var(--err); font-weight: 600; }

.admin-login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(165deg, var(--p), var(--s));
}
.admin-login-card {
  background: var(--card); padding: 2rem; border-radius: 10px; width: 100%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.admin-login-card h1 { margin: 0 0 0.5rem; color: var(--p); font-size: 1.35rem; }
.admin-login-card label { display: block; margin-top: 1rem; font-weight: 600; font-size: 0.9rem; }
.admin-login-card input {
  width: 100%; margin-top: 0.35rem; padding: 0.6rem; border: 1px solid #d4e0db; border-radius: 8px; font-size: 1rem;
}
.admin-login-card button {
  width: 100%; margin-top: 1.25rem; padding: 0.65rem; background: var(--p); color: #fff; border: none;
  border-radius: 8px; font-weight: 700; cursor: pointer;
}
.admin-login-card button:hover { background: var(--s); }
.back { margin-top: 1.5rem; text-align: center; }
.back a { color: var(--s); }

.dash-top {
  background: var(--p);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
}
.dash-nav a { color: #fff; margin-inline-start: 1rem; text-decoration: none; opacity: 0.92; }
.dash-nav a:hover { text-decoration: underline; }
.dash-main { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--card); padding: 1rem; border-radius: 10px; text-align: center; box-shadow: 0 2px 12px rgba(11,61,46,.08);
  border-top: 4px solid var(--s);
}
.stat span { display: block; font-size: 1.75rem; font-weight: 700; color: var(--p); }
.stat small { color: #5a6f66; }

.data-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 12px rgba(11,61,46,.08); font-size: 0.88rem; }
.data-table th, .data-table td { padding: 0.5rem 0.45rem; border-bottom: 1px solid #e0e8e4; vertical-align: middle; }
.data-table th { background: rgba(11,61,46,.07); color: var(--p); text-align: start; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; }
.table-wrap { overflow-x: auto; }
.btn-sm { font-size: 0.8rem; padding: 0.3rem 0.5rem; background: var(--p); color: #fff; border: none; border-radius: 6px; cursor: pointer; margin-top: 0.25rem; }
.btn-sm:hover { background: var(--s); }

.btn-danger-outline {
  background: transparent;
  color: var(--err);
  border: 1px solid var(--err);
}

.btn-danger-outline:hover {
  background: rgba(206, 17, 38, 0.12);
}
.inline-form select { max-width: 130px; font-size: 0.8rem; }
.stack-form input[type=file] { max-width: 180px; font-size: 0.75rem; }
.msg { padding: 0.65rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.msg.ok { background: #e4f0ea; color: var(--p); }
.msg.err { background: #fce8ea; color: var(--err); }

.user-form { max-width: 420px; display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 2rem; }
.user-form input, .user-form select { padding: 0.5rem; border-radius: 8px; border: 1px solid #d4e0db; }
.card-like { background: var(--card); padding: 1.25rem; border-radius: 10px; box-shadow: 0 2px 12px rgba(11,61,46,.08); }

/* —— لوحة التحكم: شعار، شريط أدوات، درج موبايل، وضع داكن —— */
body.admin-dash {
  font-family: "Noto Sans Arabic", "Cairo", "Segoe UI", sans-serif;
}

html[lang="en"] body.admin-dash {
  font-family: "Noto Sans", "Noto Sans Arabic", "Segoe UI", sans-serif;
}

.dash-top-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 0;
  min-width: 0;
}

.dash-emblem {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  padding: 3px;
}

.dash-top-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dash-brand {
  font-size: 1.05rem;
  white-space: nowrap;
}

.dash-top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.dash-user-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.28rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  font-size: 0.8rem;
  line-height: 1.3;
}

.dash-user-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-user-role {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .dash-top {
    flex-wrap: wrap;
  }

  .dash-top-brand {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .dash-top-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.dash-nav--desktop a:first-child {
  margin-inline-start: 0;
}

.dash-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dash-lang {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  overflow: hidden;
}

.dash-lang-btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}

.dash-lang-btn.is-active {
  background: rgba(255, 255, 255, 0.22);
  font-weight: 700;
}

.dash-theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.dash-theme-toggle::after {
  content: "☽";
  font-size: 1.05rem;
  line-height: 1;
}

body.admin-dark .dash-theme-toggle::after {
  content: "☀";
}

.dash-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.dash-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dash-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.dash-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(88vw, 300px);
  z-index: 210;
  display: flex;
  flex-direction: column;
  background: var(--card);
  color: #1a2e28;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
}

html[dir="rtl"] .dash-drawer {
  right: 0;
  left: auto;
  transform: translateX(100%);
}

html[dir="ltr"] .dash-drawer {
  left: 0;
  right: auto;
  transform: translateX(-100%);
}

html[dir="rtl"] .dash-drawer.is-open,
html[dir="ltr"] .dash-drawer.is-open {
  transform: translateX(0);
}

html.dash-lang-switching .dash-drawer,
html.dash-lang-switching .dash-drawer-backdrop {
  transition: none !important;
}

.dash-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e0e8e4;
}

.dash-drawer-close {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  border-radius: 6px;
}

.dash-drawer-close:hover {
  background: rgba(11, 61, 46, 0.08);
}

.dash-drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.25rem;
}

.dash-drawer-nav a {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--p);
  font-weight: 600;
}

.dash-drawer-nav a:hover {
  background: rgba(11, 61, 46, 0.08);
}

body.dash-drawer-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .dash-menu-toggle {
    display: inline-flex;
  }

  .dash-nav--desktop {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .dash-drawer,
  .dash-drawer-backdrop {
    display: none !important;
  }

  .dash-menu-toggle {
    display: none !important;
  }
}

/* وضع داكن */
body.admin-dark {
  --p: #143d30;
  --s: #1e6b52;
  --bg: #0d1914;
  --card: #15231d;
  --text: #e8f0ec;
  --muted: #9eb5aa;
  --border: #2a3d34;
  --table-head: rgba(255, 255, 255, 0.06);
  background: var(--bg);
  color: var(--text);
}

body.admin-dark .muted {
  color: var(--muted) !important;
}

body.admin-dark .dash-top {
  background: linear-gradient(165deg, #0a241c, var(--p));
}

body.admin-dark .stat {
  background: var(--card);
  box-shadow: none;
  border-top-color: var(--s);
}

body.admin-dark .stat span {
  color: #dff5ea;
}

body.admin-dark .stat small {
  color: var(--muted);
}

body.admin-dark .data-table {
  background: var(--card);
  box-shadow: none;
}

body.admin-dark .data-table th,
body.admin-dark .data-table td {
  border-bottom-color: var(--border);
}

body.admin-dark .data-table th {
  background: var(--table-head);
  color: #c5e6d4;
}

body.admin-dark .btn-sm {
  background: var(--s);
  color: #fff;
}

body.admin-dark .btn-sm:hover {
  filter: brightness(1.08);
}

body.admin-dark .inline-form select,
body.admin-dark .stack-form input[type="file"] {
  background: #0f1a15;
  color: var(--text);
  border-color: var(--border);
}

body.admin-dark .msg.ok {
  background: #1a3528;
  color: #bff0d0;
}

body.admin-dark .msg.err {
  background: #3a2020;
  color: #ffb4b4;
}

body.admin-dark .dash-drawer {
  background: var(--card);
  color: var(--text);
}

body.admin-dark .dash-drawer-head {
  border-bottom-color: var(--border);
}

body.admin-dark .dash-drawer-nav a {
  color: #dff5ea;
}

body.admin-dark .dash-drawer-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.admin-dark .dash-drawer-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.admin-dark .btn-danger-outline {
  color: #ff8a8a;
  border-color: rgba(255, 100, 100, 0.65);
}

body.admin-dark .btn-danger-outline:hover {
  background: rgba(206, 17, 38, 0.2);
}

/* نافذة خريطة موقع البلاغ (لوحة التحكم) */
.admin-map-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-map-modal.hidden {
  display: none;
}

.admin-map-modal__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  margin: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.admin-map-modal__panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 560px);
  max-height: 90vh;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.admin-map-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e0e8e4;
}

body.admin-dark .admin-map-modal__head {
  border-bottom-color: var(--border);
}

.admin-map-modal__close {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  border-radius: 6px;
}

.admin-map-modal__close:hover {
  background: rgba(11, 61, 46, 0.1);
}

body.admin-dark .admin-map-modal__close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-map-host {
  width: 100%;
  height: min(55vh, 400px);
  min-height: 280px;
}

.td-map {
  white-space: nowrap;
}
