/* ===== Admin Shell ===== */
html { font-size: 150%; }
body { overflow: auto; direction: rtl; }
body.ltr { direction: ltr; }

.adm-shell { display: flex; flex-direction: column; min-height: 100vh; background: var(--surf-bg); }

/* ===== Top Navbar ===== */
.adm-nav {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.adm-nav-brand { display: flex; align-items: center; gap: 10px; }
.adm-nav-title { font-size: 15px; font-weight: 700; color: var(--text); }
.adm-nav-sep   { color: var(--border2); font-size: 18px; }
.adm-nav-sub   { font-size: 12px; color: var(--text-m); }
.adm-nav-actions { display: flex; align-items: center; gap: 8px; }
.adm-view-btn {
  background: var(--c1l); color: var(--c1); border-color: var(--c1);
  font-size: 12px; text-decoration: none;
}
.adm-view-btn:hover { background: var(--c1); color: #fff; }

/* ===== Layout ===== */
.adm-layout { display: flex; flex: 1; }

/* ===== Admin Sidebar ===== */
.adm-sidebar {
  width: 180px;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  flex-shrink: 0;
  padding: 12px 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}
.adm-menu { display: flex; flex-direction: column; gap: 2px; padding: 0 6px; }
.adm-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  font-size: 12px; font-weight: 500; color: var(--text-s);
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius); text-align: start;
  font-family: inherit;
}
.adm-menu-item i { font-size: 16px; flex-shrink: 0; }
.adm-menu-item:hover { background: var(--surf-alt); color: var(--text); }
.adm-menu-item.active { background: var(--c1l); color: var(--c1); }

/* ===== Admin Main ===== */
.adm-main { flex: 1; padding: 22px 26px; max-width: 960px; }

/* ===== Section Header ===== */
.adm-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.adm-section-title { font-size: 20px; font-weight: 700; color: var(--text); }
.adm-section-sub   { font-size: 13px; color: var(--text-m); margin-top: 2px; }

/* ===== Program Table ===== */
.adm-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table thead tr { background: var(--surf-alt); border-bottom: 1px solid var(--border); }
.adm-table th { padding: 10px 14px; font-weight: 600; color: var(--text-m); font-size: 11.5px; letter-spacing: .03em; text-align: start; }
.adm-table td { padding: 11px 14px; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td { background: var(--surf-alt); }
.adm-table .row-actions { display: flex; gap: 4px; }

/* ===== Settings Sections (cats, statuses, tabs) ===== */
.adm-settings-grid { display: flex; flex-direction: column; gap: 16px; }
.adm-settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.adm-settings-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  background: var(--surf-alt);
}
.adm-settings-card-header i { font-size: 18px; color: var(--c1); }
.adm-settings-card-title { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.adm-settings-card-body { padding: 16px 18px; }

/* ===== Inline list items (cats/statuses/tabs) ===== */
.adm-item-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.adm-item-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  background: var(--surf-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.adm-item-row.drag-over { border-color: var(--c1) !important; background: var(--c1l) !important; }
.adm-item-row.dragging  { opacity: .4; }
.adm-item-label { flex: 1; font-weight: 500; }
.adm-item-badge { font-size: 11px; color: var(--text-x); background: var(--surf-bg); padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); }
.adm-item-actions { display: flex; gap: 3px; }
.color-swatch { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* ===== Inline Edit (in-page, not modal) ===== */
.adm-inline-edit {
  background: var(--c1l);
  border: 1.5px solid var(--c1);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 5px;
  display: flex; flex-direction: column; gap: 10px;
}
.adm-inline-edit label { font-size: 11px; font-weight: 600; color: var(--c1t); display: block; margin-bottom: 4px; }
.adm-inline-edit .f-inp { background: var(--surface); }
.adm-inline-edit-actions { display: flex; gap: 7px; justify-content: flex-end; }

/* ===== Add form row ===== */
.adm-add-form {
  background: var(--surf-alt);
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.adm-add-form-title { font-size: 12px; font-weight: 600; color: var(--text-m); }

/* ===== Section sub-header ===== */
.adm-sub-header {
  font-size: 11px; font-weight: 600; color: var(--text-x);
  letter-spacing: .05em; margin-bottom: 10px;
}

/* ===== Empty state ===== */
.adm-empty { text-align: center; padding: 32px; color: var(--text-x); font-size: 13px; }
.adm-empty i { font-size: 36px; display: block; margin-bottom: 10px; }

/* ===== Sections sub-panel ===== */
.adm-sections-panel {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surf-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .adm-sidebar { display: none; }
  .adm-main    { padding: 16px; }
}

/* ===== Loading ===== */
#loadingBar     { display: none; position: fixed; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #1a56db, #60a5fa, #1a56db); background-size: 200%; animation: loadAnim 1.2s linear infinite; z-index: 9999; }
#loadingOverlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.8); z-index: 998; align-items: center; justify-content: center; flex-direction: column; gap: 10px; font-size: 13px; color: #6b7280; }
#loadingBar.show     { display: block; }
#loadingOverlay.show { display: flex; }
@keyframes loadAnim { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
.spin { animation: spin 1s linear infinite; }

/* ===== Tab Block (tab row + sections panel) ===== */
.tab-block {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tab-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab-block-title { font-size: 13px; font-weight: 600; color: var(--text); }

/* ===== Sections panel ===== */
.sec-panel {
  background: var(--surf-alt);
  padding: 12px 14px;
}

.sec-panel-note {
  font-size: 11.5px;
  color: var(--c1t);
  background: var(--c1l);
  border: 1px solid var(--c1);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sec-item-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.sec-item-list.sec-empty {
  font-size: 12px;
  color: var(--text-x);
  padding: 4px 2px;
}

.sec-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 11px;
}
.sec-item-drag { cursor: grab; color: var(--text-x); font-size: 14px; }
.sec-item-info { flex: 1; display: flex; align-items: center; gap: 8px; }
.sec-item-name { font-size: 13px; font-weight: 500; color: var(--text); }
.sec-item-type { font-size: 10px; color: var(--text-x); background: var(--surf-bg); padding: 2px 7px; border-radius: 99px; border: 1px solid var(--border); }

/* inline edit inside sec-item */
.sec-item-edit {
  background: var(--c1l);
  border: 1.5px solid var(--c1);
  border-radius: 6px;
  padding: 11px 13px;
}

/* add section form */
.sec-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 13px;
  margin-bottom: 8px;
}
.sec-add-btn {
  background: none;
  border: 1.5px dashed var(--border2);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--c1);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
  font-family: inherit;
}
.sec-add-btn:hover { background: var(--c1l); border-color: var(--c1); }

.sec-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-m);
  margin-bottom: 4px;
}
.sec-inp { font-size: 12px !important; padding: 6px 9px !important; }

/* ===== General Settings ===== */
.gen-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.gen-setting-info { flex: 1; min-width: 200px; }
.gen-setting-label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.gen-setting-desc  { font-size: 11.5px; color: var(--text-m); line-height: 1.5; }
.gen-setting-control { flex-shrink: 0; }

/* Segmented toggle */
.gen-toggle-group {
  display: flex;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surf-alt);
}
.gen-toggle-btn {
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-m);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.gen-toggle-btn:not(:last-child) { border-inline-end: 1px solid var(--border2); }
.gen-toggle-btn:hover  { background: var(--surf-bg); color: var(--text); }
.gen-toggle-btn.active { background: var(--c1); color: #fff; }

/* ===== Logo Upload ===== */
.logo-preview-wrap {
  width: 64px; height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--c1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 700;
}
.logo-preview-img {
  width: 100%; height: 100%; object-fit: contain;
}
.logo-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; flex-wrap: wrap;
}
