/* ═══════════════════════════════════════════════════════════
   لوحة التحكم — نفس هوية التطبيق
   ═══════════════════════════════════════════════════════════ */

:root {
  --ink:        #300C16;
  --ink-soft:   #5A2131;
  --gold:       #A8875B;
  --gold-soft:  #D9C6A6;
  --bg:         #FAF6F1;
  --bg-deep:    #F1E9E0;
  --surface:    #FFFFFF;
  --muted:      #8B7A75;
  --line:       rgba(48, 12, 22, .10);
  --ok:         #2E7D5B;
  --danger:     #A33A3A;
  --shadow:     0 1px 2px rgba(48,12,22,.05), 0 8px 24px -14px rgba(48,12,22,.20);

  --font-display: "Noto Naskh Arabic", "Amiri", "Times New Roman", serif;
  --font-ui:      "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-latin:   "Noto Serif", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, #FFFDFB 0%, var(--bg) 45%, var(--bg-deep) 100%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.en {
  font-family: var(--font-latin);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ═══════════ الشريط العلوي ═══════════ */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 28px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-logo { height: 40px; width: auto; }

.topbar-title h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.topbar-title .en { font-size: 9.5px; margin-top: 1px; }

.status {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(139,122,117,.16);
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}

.dot[data-on]  { background: var(--ok);     box-shadow: 0 0 0 3px rgba(46,125,91,.18); }
.dot[data-off] { background: var(--danger); box-shadow: 0 0 0 3px rgba(163,58,58,.18); }

/* ═══════════ التخطيط ═══════════ */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.panel-head .en { font-size: 9px; margin-top: 2px; }

/* ═══════════ المعروض الآن ═══════════ */
.now { border-color: var(--gold-soft); }

.now-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
}

.now-badge {
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: #FDF8F3;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  padding-top: 2px;
}

.now-badge[data-idle] {
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 18px;
}

.now-text { min-width: 0; flex: 1; }

.now-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
}

.now-name-en {
  font-family: var(--font-latin);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ═══════════ نموذج الإضافة ═══════════ */
.add-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 18px 22px 20px;
}

@media (max-width: 640px) {
  .add-form { grid-template-columns: 1fr; }
}

.add-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

input[type="text"] {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FDFBF9;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(168,135,91,.16);
}

input[dir="ltr"] { font-family: var(--font-latin); }

/* ═══════════ صفوف الأسماء ═══════════ */
.rows { display: flex; flex-direction: column; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  transition: background .2s var(--ease);
}

.row:last-child { border-bottom: none; }
.row[data-live] { background: linear-gradient(90deg, rgba(168,135,91,.10), transparent); }
.row[data-hidden] .row-names { opacity: .45; }

.row-initial {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: #FDF8F3;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  padding-top: 2px;
}

.row-names { flex: 1; min-width: 0; }

.row-ar {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.row-en {
  font-family: var(--font-latin);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.row-edit {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.row-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.live-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--gold);
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* ═══════════ مفتاح الإظهار ═══════════ */
.toggle { display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-track {
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: #DED3C9;
  position: relative;
  transition: background .25s var(--ease);
}

.toggle-track::after {
  content: "";
  position: absolute;
  inset-inline-start: 3px;
  top: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .25s var(--ease);
}

.toggle input:checked + .toggle-track { background: var(--ok); }
.toggle input:checked + .toggle-track::after { transform: translateX(-17px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgba(168,135,91,.3); }

/* ═══════════ الأزرار ═══════════ */
.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s var(--ease), background .2s var(--ease), border-color .2s var(--ease), opacity .2s;
}

.btn .en { font-size: 8.5px; }
.btn:hover:not(:disabled) { border-color: var(--gold-soft); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #FDF8F3;
  padding: 11px 22px;
}

.btn-show {
  background: linear-gradient(150deg, var(--gold) 0%, #8F7047 100%);
  border-color: transparent;
  color: #FFFDF9;
}

.btn-danger { color: var(--danger); }
.btn-icon { padding: 8px 13px; font-size: 12.5px; }

/* ═══════════ متفرقات ═══════════ */
.empty {
  padding: 26px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 26px;
  margin-inline: auto;
  width: fit-content;
  max-width: 90vw;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #FDF8F3;
  font-size: 13.5px;
  box-shadow: 0 12px 30px -12px rgba(48,12,22,.6);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.toast[data-show] { opacity: 1; transform: none; }
.toast[data-error] { background: var(--danger); }
