/* ============================================================
   admin.css — ממשק ניהול, RTL
   ============================================================ */

:root {
  --ink:        #12263F;
  --ink-soft:   #1B3454;
  --ink-line:   #24405F;
  --surface:    #F4F6F9;
  --card:       #FFFFFF;
  --line:       #E2E7EE;
  --text:       #1D2A3A;
  --text-muted: #6B7C93;
  --accent:     #17796B;
  --accent-dim: #E6F2F0;
  --gold:       #B77B12;
  --gold-dim:   #FBF1DE;
  --danger:     #B3261E;
  --danger-dim: #FBE9E7;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 1px 2px rgba(18, 38, 63, .06), 0 6px 20px rgba(18, 38, 63, .06);
  --sidebar-w:  244px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Assistant", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Heebo", "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
}
.skip-link:focus {
  inset-inline-start: 1rem;
  top: 1rem;
  z-index: 100;
  background: #fff;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
}

/* ---------- שלד ---------- */
.layout { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1400px;
  width: 100%;
}

/* ---------- סרגל צד ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink);
  color: #C8D5E4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.15rem 1.15rem;
  border-bottom: 1px solid var(--ink-line);
}

.sidebar__mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-family: "Heebo", sans-serif;
  font-weight: 800;
}

.sidebar__name {
  font-family: "Heebo", sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav { padding: .75rem .6rem; flex: 1; overflow-y: auto; }

.nav__item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .58rem .7rem;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: #C8D5E4;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--ink-soft); color: #fff; text-decoration: none; }
.nav__item.is-active { background: var(--accent); color: #fff; }
.nav__item--quiet { font-size: .87rem; color: #93A6BC; }

.nav__icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav__count {
  margin-inline-start: auto;
  background: var(--gold);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  padding: .05rem .35rem;
  border-radius: 999px;
}

.sidebar__foot { padding: .6rem; border-top: 1px solid var(--ink-line); }

/* ---------- סרגל עליון ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: .75rem 1.75rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__title { font-size: 1.15rem; }

.topbar__toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .35rem;
  cursor: pointer;
  color: var(--text);
}
.topbar__toggle svg { width: 20px; height: 20px; display: block; }

.topbar__actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.user { display: flex; align-items: center; gap: .55rem; }
.user__avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: grid; place-items: center;
  font-weight: 700;
}
.user__meta { display: flex; flex-direction: column; line-height: 1.2; }
.user__meta small { color: var(--text-muted); font-size: .75rem; }
.user__out { font-size: .85rem; color: var(--text-muted); margin-inline-start: .5rem; }

/* ---------- כרטיסים ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.card__head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.card__head h2 { font-size: 1rem; }
.card__head .card__tools { margin-inline-start: auto; display: flex; gap: .5rem; }
.card__body { padding: 1.15rem; }
.card__body--flush { padding: 0; }

/* ---------- מדדים ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 3px;
  background: var(--accent);
}
.stat--gold::before   { background: var(--gold); }
.stat--danger::before { background: var(--danger); }

.stat__label { color: var(--text-muted); font-size: .85rem; }
.stat__value {
  font-family: "Heebo", sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.25;
  letter-spacing: -.02em;
}
.stat__note { font-size: .8rem; color: var(--text-muted); }

/* ---------- טבלאות ---------- */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
table.data th,
table.data td {
  padding: .7rem .9rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th {
  background: #FAFBFD;
  font-weight: 600;
  color: var(--text-muted);
  font-size: .82rem;
  letter-spacing: .02em;
}
table.data tbody tr:hover { background: #FAFBFD; }
table.data td.wrap { white-space: normal; }
table.data .num { font-variant-numeric: tabular-nums; }

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- תגיות מצב ---------- */
.badge {
  display: inline-block;
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: #EEF1F5;
  color: var(--text-muted);
}
.badge--ok      { background: var(--accent-dim); color: var(--accent); }
.badge--wait    { background: var(--gold-dim);   color: var(--gold); }
.badge--danger  { background: var(--danger-dim); color: var(--danger); }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn--ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: #F7F9FB; filter: none; }
.btn--danger { background: var(--danger); }
.btn--sm { padding: .3rem .65rem; font-size: .85rem; }

/* ---------- טפסים ---------- */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: .3rem;
}
.field .hint { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

.input, .select, .textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .95rem;
  background: #fff;
  color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.textarea { min-height: 110px; resize: vertical; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }

/* ---------- התראות ---------- */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-weight: 500;
}
.alert--success { background: var(--accent-dim); color: var(--accent); border-color: #BFE0DA; }
.alert--error   { background: var(--danger-dim); color: var(--danger); border-color: #F2C4C0; }
.alert--info    { background: #EDF3FA; color: #1B4C7E; border-color: #CADDF0; }

/* ---------- עימוד ---------- */
.pager { display: flex; gap: .3rem; justify-content: center; padding: 1rem; }
.pager a, .pager span {
  min-width: 34px;
  text-align: center;
  padding: .3rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #fff;
}
.pager .is-current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- כותרת תחתונה ---------- */
.footfine {
  display: flex;
  justify-content: space-between;
  padding: .8rem 1.75rem;
  color: var(--text-muted);
  font-size: .82rem;
  border-top: 1px solid var(--line);
  background: var(--card);
}

/* ============================================================
   מסך התחברות
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1100px 520px at 90% -15%, #1B3454 0%, transparent 60%),
    var(--ink);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.login-card__mark {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-family: "Heebo", sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.login-card h1 { font-size: 1.3rem; margin-bottom: .2rem; }
.login-card p.sub { color: var(--text-muted); font-size: .9rem; margin: 0 0 1.5rem; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .35rem; }

/* ============================================================
   רספונסיביות
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    transform: translateX(100%);
    transition: transform .22s ease;
    z-index: 40;
    box-shadow: -8px 0 24px rgba(0, 0, 0, .25);
  }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.is-open { transform: translateX(0); }
  .topbar__toggle { display: block; }
  .content { padding: 1rem; }
  .topbar { padding: .65rem 1rem; }
  .user__meta { display: none; }
  .footfine { padding: .8rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .sidebar, .topbar, .footfine { display: none; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}
