/* =========================
   Admin (Scoped)
========================= */
body.admin {
  background: var(--bg);
  color: var(--text);
}

/* Top bar */
.admin-top {
  position: sticky;
  top: 0;
  z-index: 80;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 4%;

  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);

  /* خليه متناسق مع الهيدر الداكن + الموقع */
  background: linear-gradient(180deg, rgba(17, 17, 17, .92), rgba(22, 22, 22, .82));
  color: #fff;
}

.brand {
  font-weight: 950;
  letter-spacing: .2px;
  color: #fff;
}

/* Shell */
/* .admin-shell{
  display:grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 64px);
} */

/* Sidebar */
.admin-side {
  padding: 14px;
  background: rgba(255, 255, 255, .6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-top: 0;

  border-radius: 0 0 18px 18px;
  margin: 0 0 14px 0;
}

/* في RTL الحدود الصح غالباً تكون يمين */
html[dir="rtl"] .admin-side {
  border-left: 0;
  border-right: 1px solid var(--line);
}

/* Side links */
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 11px 12px;
  margin: 6px 0;

  border-radius: 14px;
  border: 1px solid transparent;

  color: var(--muted);
  font-weight: 900;
  font-size: 13px;

  background: transparent;
  transition: .18s ease;
}

.side-link:hover {
  border-color: rgba(155, 13, 13, .18);
  background: rgba(155, 13, 13, .06);
  color: var(--text);
  transform: translateY(-1px);
}

/* Active state: لو بتحط class="active" أو aria-current */
.side-link.active,
.side-link[aria-current="page"] {
  border-color: rgba(155, 13, 13, .22);
  background: rgba(155, 13, 13, .10);
  color: var(--brand);
}



/* Pills */
.pill-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  border-radius: 999px;

  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);

  color: var(--muted);
  font-size: 12px;
  font-weight: 900;

  transition: .18s ease;
}

.pill:hover {
  color: var(--text);
  border-color: rgba(155, 13, 13, .18);
  background: rgba(155, 13, 13, .06);
}

.pill .muted {
  color: var(--muted);
}

/* Auth */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 30px 0;
}

.auth-card {
  width: min(420px, 92%);
}

/* Inputs */
.label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;

  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);

  color: var(--text);
  outline: none;

  transition: .18s ease;
}

.input:focus {
  border-color: rgba(155, 13, 13, .28);
  box-shadow: 0 0 0 3px rgba(155, 13, 13, .18);
}

/* Alerts */
.alert {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin: 12px 0;
  background: rgba(255, 255, 255, .75);
}

.alert--danger {
  border-color: rgba(239, 68, 68, .25);
  background: rgba(239, 68, 68, .08);
}

.alert--success {
  border-color: rgba(34, 197, 94, .25);
  background: rgba(34, 197, 94, .08);
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 10px 0 16px;
}

.kpi {
  background: rgba(255, 255, 255, .75);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;

  box-shadow: 0 16px 38px rgba(0, 0, 0, .06);
}

.kpi__n {
  font-size: 26px;
  font-weight: 950;
  color: var(--text);
}

/* Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;

  overflow: hidden;
  border-radius: 18px;

  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .06);
}

.table th,
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, .06);
  text-align: right;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  background: rgba(0, 0, 0, .02);
}

.table tr:hover td {
  background: rgba(155, 13, 13, .04);
}

.title-col strong {
  display: block;
}

/* Filters / Layout helpers */
.filters {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.filters .input {
  width: auto;
  min-width: 240px;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.row {
  display: flex;
  gap: 12px;
}

.col {
  flex: 1;
}

.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

.thumb {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
  background: rgba(0, 0, 0, .04);
}

.editor-grid {
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  gap: 12px;
}

/* Responsive */
@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-side {
    display: flex;
    gap: 10px;
    overflow: auto;

    border-radius: 18px;
    margin-top: 12px;
  }

  .side-link {
    white-space: nowrap;
    margin: 0;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 981px) {
  .admin-side {
    position: sticky;
    top: 74px;
    height: fit-content;
  }
}


/* =========================
   Auth (Admin Login)
========================= */
.auth-card {
  padding: 18px 18px 16px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -.2px;
}

.auth-card .muted {
  margin: 0 0 12px;
}

.auth-card form {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.auth-card .btn {
  margin-top: 8px;
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.auth-linkBtn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 900;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-linkBtn:hover {
  opacity: .9;
}

/* =========================
   Modal (Reset Password)
========================= */
.sw-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}

.sw-modal.is-open {
  display: block;
}

.sw-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
}

.sw-modal__dialog {
  position: relative;
  width: min(520px, calc(100% - 22px));
  margin: 12vh auto 0;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
  padding: 16px;
}

.sw-modal__dialog h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 950;
}

.sw-modal__x {
  position: absolute;
  top: 10px;
  left: 10px;
  /* RTL لطيف */
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  cursor: pointer;
  font-weight: 950;
}

.sw-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.sw-modal__actions .btn {
  flex: 1;
}

@media (max-width: 420px) {
  .sw-modal__actions {
    flex-direction: column;
  }
}

/* =========================
   Auth v2 (Premium Login)
   ضع هذا البلوك في آخر ملف CSS
========================= */

body.admin .auth-wrap {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: clamp(28px, 4vw, 56px) 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 80% -20%, rgba(155, 13, 13, .20), transparent 60%),
    radial-gradient(900px 520px at -10% 20%, rgba(0, 0, 0, .10), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(247, 247, 247, .92));
}

body.admin .auth-wrap::before,
body.admin .auth-wrap::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(28px);
  opacity: .55;
  pointer-events: none;
}

body.admin .auth-wrap::before {
  top: -240px;
  right: -240px;
  background: radial-gradient(circle at 30% 30%, rgba(155, 13, 13, .55), transparent 60%);
}

body.admin .auth-wrap::after {
  bottom: -260px;
  left: -260px;
  background: radial-gradient(circle at 60% 40%, rgba(0, 0, 0, .22), transparent 62%);
}

body.admin .auth-card {
  width: min(460px, 92%);
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(0, 0, 0, .08);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, .10),
    0 1px 0 rgba(255, 255, 255, .70) inset;
  transform: translateY(0);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

body.admin .auth-card:hover {
  transform: translateY(-2px);
  border-color: rgba(155, 13, 13, .18);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, .14),
    0 1px 0 rgba(255, 255, 255, .75) inset;
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(155, 13, 13, 1), rgba(198, 40, 40, 1));
  box-shadow: 0 14px 30px rgba(155, 13, 13, .20);
  position: relative;
}

.auth-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
  transform: rotate(12deg);
}

.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.2px;
  color: var(--text);
  line-height: 1.2;
}

.auth-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(155, 13, 13, .16);
  background: rgba(155, 13, 13, .06);
  color: var(--brand);
  font-weight: 950;
  font-size: 12px;
  white-space: nowrap;
}

body.admin .auth-card form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

body.admin .auth-card .label {
  margin: 6px 0 4px;
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

.field {
  position: relative;
}

body.admin .auth-card .input {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .05);
  transition: .18s ease;
}

html[dir="rtl"] body.admin .auth-card .input {
  padding-right: 44px;
}

html[dir="ltr"] body.admin .auth-card .input {
  padding-left: 44px;
}

.field::before {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: .65;
  background-size: 18px 18px;
  background-repeat: no-repeat;
}

html[dir="rtl"] .field::before {
  right: 14px;
}

html[dir="ltr"] .field::before {
  left: 14px;
}

.field--email::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16v16H4z'/%3E%3Cpath d='m22 6-10 7L2 6'/%3E%3C/svg%3E");
}

.field--pass::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}

body.admin .auth-card .input:focus {
  border-color: rgba(155, 13, 13, .30);
  box-shadow: 0 0 0 4px rgba(155, 13, 13, .14), 0 12px 26px rgba(0, 0, 0, .06);
  background: rgba(255, 255, 255, .94);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.auth-linkBtn {
  font-weight: 950;
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px dashed rgba(155, 13, 13, .45);
}

.auth-linkBtn:hover {
  opacity: .9;
}

body.admin .auth-card .btn.w-full {
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 950;
  box-shadow: 0 16px 34px rgba(155, 13, 13, .20);
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  border: 1px solid rgba(155, 13, 13, .18);
}

.btn--ghost {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, .10);
  box-shadow: none;
  color: var(--brand);
  border-bottom: 1px dashed rgba(155, 13, 13, .45);
}

body.admin .auth-card .btn.w-full:hover {
  transform: translateY(-1px);
}

body.admin .auth-card .btn.w-full:active {
  transform: translateY(0);
}

body.admin .auth-card .alert {
  border-radius: 16px;
  font-weight: 850;
}

/* Modal polish */
.sw-modal {
  display: none;
}

.sw-modal.is-open {
  display: block;
}

.sw-modal__dialog {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px);
  border-radius: 22px;
  border: 1px solid rgba(0, 0, 0, .10);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .30);
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: .18s ease;
}

.sw-modal.is-open .sw-modal__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.sw-modal__x {
  border-radius: 14px;
  transition: .18s ease;
}

.sw-modal__x:hover {
  transform: rotate(-4deg);
  border-color: rgba(155, 13, 13, .20);
}

/* ✅ Fix: اجعل الأعمدة ثابتة مهما كان ترتيب العناصر */
/* .admin-shell{
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-areas: "side main";
  min-height: calc(100vh - 64px);
} */

.admin-side {
  grid-area: side;
}

.admin-main {
  grid-area: main;
  max-width: 1400px;
  padding: 5px 10px;
  margin: 0 auto;
}

/* RTL: السايدبار يمين */
html[dir="rtl"] .admin-shell {
  grid-template-columns: 1fr 260px;
  grid-template-areas: "main side";
}

/* =========================
   Modal v2 (Reset Password)
========================= */
.sw-modal {
  position: fixed;
  inset: 0;
  z-index: 120;

  /* بدل display none عشان الأنيميشن */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}

.sw-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sw-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, .55);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .18s ease;
}

.sw-modal.is-open .sw-modal__backdrop {
  opacity: 1;
}

/* Dialog */
.sw-modal__dialog {
  position: relative;
  width: min(520px, calc(100% - 22px));
  margin: 10vh auto 0;

  border-radius: 22px;
  padding: 18px;

  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, .10);

  box-shadow: 0 40px 120px rgba(0, 0, 0, .32);

  transform: translateY(16px) scale(.985);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.sw-modal.is-open .sw-modal__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Title + text */
.sw-modal__dialog h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.2px;
}

.sw-modal__dialog .muted {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 800;
}

/* Close button (أشيك + أنعم) */
.sw-modal__x {
  position: absolute;
  top: 12px;
  left: 12px;
  /* RTL تمام */
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: rgba(255, 255, 255, .78);

  cursor: pointer;
  font-size: 20px;
  font-weight: 950;

  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.sw-modal__x:hover {
  transform: rotate(-6deg) scale(1.02);
  border-color: rgba(155, 13, 13, .20);
  background: rgba(155, 13, 13, .06);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .12);
}

/* Form inside modal */
.sw-modal__dialog form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

/* Actions */
.sw-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.sw-modal__actions .btn {
  flex: 1;
  height: 46px;
}

@media (max-width: 420px) {
  .sw-modal__actions {
    flex-direction: column;
  }
}

.tox-tinymce{
  height: 450px !important;
}