@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
  --bg: #111a22;
  --panel: #1a2631;
  --panel-2: #22313d;
  --ink: #eef4f8;
  --muted: #afbcc7;
  --line: rgba(221,234,240,.14);
  --gold: #d98945;
  --teal: #4fc3c7;
  --danger: #de6b82;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(135deg, #101922 0%, #17222c 54%, #1d2427 100%);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem;
  border-inline-end: 1px solid var(--line);
  background: #121d26;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1rem;
  font-weight: 900;
}

.admin-brand img { width: 42px; height: 42px; object-fit: contain; }
.admin-sidebar nav { display: grid; gap: .35rem; }
.admin-sidebar nav a {
  padding: .75rem .8rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 750;
}
.admin-sidebar nav a:hover { background: var(--panel); color: var(--ink); }

.admin-main { padding: 1.2rem; min-width: 0; }
.admin-topbar {
  display: flex;
  align-items: center;
  gap: .8rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28,41,52,.76);
}
.admin-topbar div { display: grid; gap: .2rem; }
.admin-topbar span, .muted { color: var(--muted); font-size: .92rem; }
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
}

.panel, .table-wrap, form.panel {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28,41,52,.76);
}
.grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(4, 1fr); }
.stat strong { display: block; font-size: 2rem; color: var(--gold); }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0; }
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.btn.primary, button.primary { background: linear-gradient(135deg, var(--gold), #e2a462); border: 0; color: #101820; }
.btn.danger, button.danger { background: rgba(222,107,130,.15); color: #ffd2dc; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
th { color: var(--muted); font-size: .88rem; }

label { display: block; margin: .55rem 0 .28rem; color: var(--ink); font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #121d26;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 120px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.full { grid-column: 1 / -1; }

.alert { margin-bottom: 1rem; padding: .8rem; border-radius: var(--radius); border: 1px solid var(--line); }
.alert.success { border-color: rgba(148,242,208,.4); }
.alert.error { border-color: rgba(255,89,119,.5); }

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}
.login-card { width: min(420px, 100%); }

.thumb { width: 72px; height: 52px; object-fit: cover; border-radius: var(--radius); background: #121d26; }

.settings-page {
  display: grid;
  gap: 1rem;
}

.settings-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background:
    linear-gradient(135deg, rgba(217, 137, 69, .12), rgba(79, 195, 199, .07)),
    rgba(28,41,52,.78);
}

.settings-hero h2 {
  margin: .2rem 0;
}

.media-settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.settings-preview {
  display: block;
  width: 100%;
  max-width: 160px;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  margin-bottom: .6rem;
  padding: .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #121d26;
}

.notice-list {
  display: grid;
  gap: .55rem;
  margin: .75rem 0 0;
  padding: 0;
  list-style: none;
}

.notice-list li {
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(221,234,240,.045);
}

.code-box {
  overflow: auto;
  max-height: 260px;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d151c;
  color: #d9eef0;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .admin-body { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .stats, .form-grid, .media-settings-grid { grid-template-columns: 1fr; }

  .settings-hero {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Softer admin pass for long working sessions. */
.admin-sidebar,
.admin-topbar,
.panel,
.table-wrap,
form.panel,
.notice-list li {
  box-shadow: 0 16px 36px rgba(0, 0, 0, .16);
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a:focus-visible {
  background: rgba(79, 195, 199, .1);
  color: var(--ink);
}

th {
  color: #c0ccd5;
}

td,
label {
  color: #e8f0f4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 137, 69, .72);
  box-shadow: 0 0 0 .2rem rgba(217, 137, 69, .14);
  outline: 0;
}

.btn:hover,
button:hover {
  filter: brightness(1.05);
}

/* Fortify CMS refresh: bright, calm admin workspace aligned with the public site. */
:root {
  color-scheme: light;
  --bg: #f6f9fc;
  --panel: #ffffff;
  --panel-2: #f1f6fb;
  --ink: #0a2540;
  --muted: #607186;
  --line: rgba(10, 37, 64, .1);
  --gold: #f5a33d;
  --teal: #00b8c8;
  --blue: #0066ff;
  --green: #18a979;
  --danger: #d94862;
  --shadow: 0 18px 48px rgba(10, 37, 64, .1);
}

body {
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fbff 36%, #f4f8fb 100%);
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(112deg, transparent 0 8%, rgba(0, 184, 200, .16) 8% 17%, transparent 17% 100%),
    linear-gradient(105deg, transparent 0 62%, rgba(245, 163, 61, .16) 62% 72%, transparent 72% 100%);
}

.admin-body {
  grid-template-columns: 286px 1fr;
}

.admin-sidebar {
  margin: 14px;
  height: calc(100vh - 28px);
  border: 1px solid rgba(10, 37, 64, .08);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(247, 251, 255, .92)),
    linear-gradient(135deg, rgba(0, 184, 200, .1), rgba(245, 163, 61, .08));
  box-shadow: var(--shadow);
  overflow: auto;
}

.admin-brand {
  min-height: 62px;
  padding: .7rem;
  border: 1px solid rgba(10, 37, 64, .08);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(10, 37, 64, .08);
}

.admin-brand img {
  padding: .2rem;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(10, 37, 64, .1);
}

.admin-sidebar nav {
  gap: .45rem;
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid transparent;
  color: #53677c;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a:focus-visible,
.admin-sidebar nav a.is-active {
  border-color: rgba(0, 184, 200, .18);
  background:
    linear-gradient(135deg, rgba(0, 184, 200, .1), rgba(0, 102, 255, .06)),
    #ffffff;
  color: var(--ink);
  box-shadow: 0 12px 26px rgba(10, 37, 64, .08);
}

.admin-sidebar nav a.is-active {
  color: var(--blue);
}

.admin-main {
  padding: 14px 18px 28px 4px;
}

html[dir="ltr"] .admin-main {
  padding: 14px 4px 28px 18px;
}

.admin-topbar {
  min-height: 76px;
  border-color: rgba(10, 37, 64, .08);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.admin-topbar strong {
  color: var(--ink);
  font-size: 1.16rem;
}

.admin-topbar span,
.muted {
  color: var(--muted);
}

.topbar-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: .5rem .75rem;
  border: 1px solid rgba(10, 37, 64, .08);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(10, 37, 64, .06);
}

.topbar-actions a:hover {
  border-color: rgba(0, 184, 200, .22);
  color: var(--blue);
}

.panel,
.table-wrap,
form.panel,
.notice-list li,
.settings-hero {
  border-color: rgba(10, 37, 64, .08);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.settings-hero {
  background:
    linear-gradient(135deg, rgba(0, 184, 200, .1), rgba(245, 163, 61, .11)),
    rgba(255, 255, 255, .94);
}

.panel h2,
.panel h3,
.table-wrap h2,
.table-wrap h3,
.settings-hero h2 {
  color: var(--ink);
}

.stat {
  position: relative;
  overflow: hidden;
  min-height: 124px;
}

.stat::after {
  position: absolute;
  inset: auto -32px -42px auto;
  width: 112px;
  height: 112px;
  content: "";
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0, 184, 200, .18), transparent 68%);
}

.stat strong {
  color: var(--blue);
}

.stats .stat:nth-child(2) strong {
  color: var(--teal);
}

.stats .stat:nth-child(3) strong {
  color: var(--green);
}

.stats .stat:nth-child(4) strong {
  color: #c87117;
}

.actions {
  align-items: center;
}

.btn,
button {
  border-color: rgba(10, 37, 64, .1);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(10, 37, 64, .06);
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease,
    color .18s ease;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 184, 200, .24);
  filter: none;
  box-shadow: 0 14px 26px rgba(10, 37, 64, .1);
}

.btn.primary,
button.primary {
  border: 0;
  background: linear-gradient(135deg, var(--ink), var(--blue) 52%, var(--teal));
  color: #fff;
  box-shadow: 0 16px 34px rgba(0, 102, 255, .18);
}

.btn.danger,
button.danger {
  border-color: rgba(217, 72, 98, .16);
  background: rgba(217, 72, 98, .08);
  color: #b62540;
}

.table-wrap {
  overflow: auto;
}

table {
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  color: #607186;
  background: #f6f9fc;
  font-size: .84rem;
  font-weight: 900;
}

td,
label {
  color: var(--ink);
}

tr:hover td {
  background: rgba(0, 184, 200, .035);
}

th,
td {
  border-bottom-color: rgba(10, 37, 64, .08);
}

input,
select,
textarea {
  border-color: rgba(10, 37, 64, .12);
  background: #fff;
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #8b9aae;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 184, 200, .72);
  box-shadow: 0 0 0 .2rem rgba(0, 184, 200, .14);
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  accent-color: var(--blue);
}

.alert {
  border-color: rgba(10, 37, 64, .08);
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(10, 37, 64, .08);
}

.alert.success {
  border-color: rgba(24, 169, 121, .24);
  background: rgba(24, 169, 121, .08);
}

.alert.error {
  border-color: rgba(217, 72, 98, .26);
  background: rgba(217, 72, 98, .08);
}

.login-page {
  background:
    linear-gradient(180deg, #ffffff, #f6f9fc),
    radial-gradient(circle at 20% 0%, rgba(0, 184, 200, .14), transparent 30%);
}

.login-card {
  border-color: rgba(10, 37, 64, .08);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 30px 80px rgba(10, 37, 64, .14);
}

.thumb,
.settings-preview {
  border: 1px solid rgba(10, 37, 64, .08);
  background: #f6f9fc;
}

.code-box {
  border-color: rgba(10, 37, 64, .1);
  background: #0a2540;
  color: #e8fbff;
}

@media (max-width: 900px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    margin: 10px;
  }

  .admin-main,
  html[dir="ltr"] .admin-main {
    padding: 0 10px 22px;
  }

  .admin-topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .admin-sidebar nav {
    grid-template-columns: 1fr;
  }

  .topbar-actions a,
  .actions .btn,
  .actions button {
    width: 100%;
  }
}

/* Premium Arabic reading pass for the CMS. */
html[dir="rtl"] body,
html[dir="rtl"] button,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
  font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}

html[dir="ltr"] body,
html[dir="ltr"] button,
html[dir="ltr"] input,
html[dir="ltr"] select,
html[dir="ltr"] textarea {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[dir="rtl"] body {
  font-weight: 500;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] .admin-brand,
html[dir="rtl"] .admin-sidebar nav a,
html[dir="rtl"] .admin-topbar strong,
html[dir="rtl"] label,
html[dir="rtl"] th,
html[dir="rtl"] .btn,
html[dir="rtl"] button {
  font-weight: 800;
}

html[dir="rtl"] p,
html[dir="rtl"] td,
html[dir="rtl"] .muted,
html[dir="rtl"] .notice-list li {
  line-height: 1.85;
}

html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
  line-height: 1.7;
}
