/* Light and dark colours come from these variables. No external fonts, no animations
   on the list: the page stays light while it scrolls and filters. */
:root {
  --bg: #fafafa;
  --fg: #18181b;
  --muted: #52525b;
  --line: #e4e4e7;
  --card: #ffffff;
  --chip: #f4f4f5;
  --accent: #2563eb;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b;
    --fg: #fafafa;
    --muted: #a1a1aa;
    --line: #27272a;
    --card: #18181b;
    --chip: #27272a;
    --accent: #60a5fa;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
  }
}
:root[data-theme="dark"] {
  --bg: #09090b;
  --fg: #fafafa;
  --muted: #a1a1aa;
  --line: #27272a;
  --card: #18181b;
  --chip: #27272a;
  --accent: #60a5fa;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 var(--font);
  -webkit-text-size-adjust: 100%;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

.top {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end;
  padding: 24px 16px 12px; max-width: 1200px; margin: 0 auto;
}
.brand h1 { margin: 0; font-size: 26px; }
.brand .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.stats div {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; min-width: 88px;
}
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 0; font-weight: 700; font-size: 18px; }

.controls {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: 12px 16px; max-width: 1200px; margin: 0 auto;
}
.search input {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 10px;
}
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.filters label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--fg); }
.filters select {
  font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); min-width: 130px;
}
button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 7px 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
button.ghost:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.count { max-width: 1200px; margin: 12px auto 4px; padding: 0 16px; color: var(--muted); font-size: 14px; }
main { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 6px; min-height: 150px;
}
.card .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card h2 { margin: 0; font-size: 15px; word-break: break-word; }
.card h2 button {
  all: unset; cursor: pointer; direction: ltr; text-align: left; font-weight: 700; font-size: 15px;
}
.card h2 button:hover { color: var(--accent); text-decoration: underline; }
.card .id { color: var(--muted); font-size: 12px; direction: ltr; white-space: nowrap; }
.card .ar { margin: 0; font-size: 14px; }
.card .en { margin: 0; font-size: 13px; color: var(--muted); direction: ltr; text-align: left;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.badge.pass, .badge.copy-allowed { color: var(--ok); }
.badge.warn, .badge.restricted, .badge.study-and-rebuild { color: var(--warn); }
.badge.broken, .badge.not-found, .badge.http-other { color: var(--bad); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.tags button { font-size: 11px; padding: 1px 6px; border-radius: 6px; direction: ltr; }
.card .src { font-size: 12px; direction: ltr; text-align: left; overflow-wrap: anywhere; }
.card .src a { color: var(--accent); }

.pager {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center;
  padding: 20px 16px 8px; max-width: 1200px; margin: 0 auto;
}
.pager button[aria-current="page"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager button:disabled { opacity: 0.4; cursor: default; }

dialog {
  width: min(680px, 94vw); border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--fg); padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.dialog-body h3 { margin: 0; font-size: 18px; direction: ltr; text-align: left; }
.dialog-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.dialog-body dt { color: var(--muted); font-size: 13px; }
.dialog-body dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.dialog-body .ltr { direction: ltr; text-align: left; }
.dialog-body .actions { display: flex; flex-wrap: wrap; gap: 8px; }
dialog form { padding: 0 18px 18px; display: flex; justify-content: flex-start; }

.foot { max-width: 1200px; margin: 24px auto; padding: 0 16px 24px; color: var(--muted); font-size: 13px; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
}

/* On a phone the filter panel would cover most of the screen if it stuck to the top. */
@media (max-width: 560px) {
  .controls { position: static; }
}

.loading { max-width: 1200px; margin: 6px auto 0; padding: 0 16px; color: var(--muted); font-size: 13px; }
.card .code { font-size: 12px; direction: ltr; text-align: left; color: var(--muted); overflow-wrap: anywhere; }
.dialog-body .path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* عرض الحركات والمواقع */
[hidden] { display: none !important; }
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem 16px 0; }
.tab {
  font: inherit; color: var(--fg); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: .45rem .95rem; cursor: pointer;
}
.tab[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; }
.sites { list-style: none; margin: 0 auto; padding: 0 16px; max-width: 960px; display: grid; gap: .75rem; }
.site { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.site .head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.site .name { color: var(--fg); font-weight: 600; text-decoration: none; }
.site .name:hover { color: var(--accent); text-decoration: underline; }
.site .ar { margin: .4rem 0 .25rem; color: var(--muted); }
.site .src { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
