/* =====================================================
   manager-settings.css — رفد: استيراد البيانات
   ===================================================== */

/* ── Nav button ── */
.ms-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}
.ms-nav-btn:hover { background: rgba(23,169,140,.12); color: #17a98c; }
.ms-nav-btn svg { flex-shrink: 0; }

/* ── Overlay panel ── */
.ms-panel {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: #f4f6fb;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  font-family: 'Tajawal', 'Segoe UI', sans-serif;
  direction: rtl;
}
.ms-panel.ms-visible  { transform: translateX(0); }
.ms-panel.ms-hidden   { transform: translateX(100%); }

/* ── Panel header ── */
.ms-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #071750 0%, #0d2b8e 100%);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(7,23,80,.3);
}
.ms-header-icon {
  width: 38px; height: 38px;
  background: rgba(23,169,140,.22);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ms-header-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.ms-header-sub { font-size: 0.75rem; opacity: .7; }
.ms-close-btn {
  background: rgba(255,255,255,.1);
  border: none; color: #fff;
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s;
  flex-shrink: 0;
}
.ms-close-btn:hover { background: rgba(255,255,255,.2); }

/* ── Sidebar + Content layout ── */
.ms-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.ms-sidebar {
  width: 220px;
  background: #fff;
  border-left: 1px solid #e4e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 16px 0;
  overflow-y: auto;
}
.ms-sidebar-section {
  padding: 6px 16px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ms-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: none;
  text-align: right;
  font: inherit;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.ms-sidebar-btn:hover { background: #f0f4ff; color: #0d2b8e; }
.ms-sidebar-btn.active {
  background: linear-gradient(90deg, #e8eeff 0%, #f0f4ff 100%);
  color: #0d2b8e;
  font-weight: 600;
  border-right: 3px solid #17a98c;
}
.ms-sidebar-btn svg { flex-shrink: 0; opacity: .7; }
.ms-sidebar-btn.active svg { opacity: 1; color: #17a98c; }

/* ── Content area ── */
.ms-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Section heading ── */
.ms-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e4e8f0;
}
.ms-section-heading-icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, #e8f8f4, #d0f0e8);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #17a98c;
}
.ms-section-title { font-size: 1.15rem; font-weight: 700; color: #0d2b8e; margin-bottom: 3px; }
.ms-section-desc { font-size: 0.82rem; color: #6b7280; line-height: 1.5; }

/* ── Cards ── */
.ms-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e4e8f0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(7,23,80,.04);
}
.ms-card-header {
  padding: 14px 18px;
  background: #f8faff;
  border-bottom: 1px solid #e4e8f0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0d2b8e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ms-card-body { padding: 18px; }

/* ── Steps indicator ── */
.ms-steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 18px;
  margin-bottom: 4px;
}
.ms-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.ms-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #e4e8f0;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, color .2s;
}
.ms-step.active .ms-step-num { background: #17a98c; color: #fff; }
.ms-step.done .ms-step-num { background: #0d2b8e; color: #fff; }
.ms-step-label { font-size: 0.8rem; color: #94a3b8; font-weight: 500; }
.ms-step.active .ms-step-label { color: #17a98c; font-weight: 700; }
.ms-step.done .ms-step-label { color: #0d2b8e; }
.ms-step-line {
  flex: 1;
  height: 2px;
  background: #e4e8f0;
  margin: 0 6px;
}
.ms-step.done + .ms-step > .ms-step-line,
.ms-step.done .ms-step-line { background: #17a98c; }

/* ── Template download ── */
.ms-template-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, #f0faf7, #e8f8f4);
  border: 1.5px dashed #17a98c;
  border-radius: 12px;
}
.ms-template-icon {
  width: 44px; height: 44px;
  background: #17a98c;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.ms-template-text { flex: 1; }
.ms-template-title { font-size: 0.9rem; font-weight: 700; color: #0d2b8e; margin-bottom: 2px; }
.ms-template-sub { font-size: 0.78rem; color: #374151; }
.ms-btn-teal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: #17a98c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, transform .12s;
}
.ms-btn-teal:hover { background: #0e8a72; transform: translateY(-1px); }
.ms-btn-teal:active { transform: translateY(0); }
.ms-btn-navy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: #0d2b8e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, transform .12s;
}
.ms-btn-navy:hover { background: #0a2070; transform: translateY(-1px); }
.ms-btn-navy:active { transform: translateY(0); }
.ms-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: transparent;
  color: #374151;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s;
}
.ms-btn-ghost:hover { background: #f3f4f6; border-color: #9ca3af; }
.ms-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s;
}
.ms-btn-danger:hover { background: #b91c1c; }

/* ── Upload zone ── */
.ms-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fafbff;
}
.ms-upload-zone:hover,
.ms-upload-zone.drag-over {
  border-color: #17a98c;
  background: #f0faf7;
}
.ms-upload-zone.drag-over { box-shadow: 0 0 0 4px rgba(23,169,140,.12); }
.ms-upload-icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, #e8eeff, #d0f0e8);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #17a98c;
  transition: transform .2s;
}
.ms-upload-zone:hover .ms-upload-icon { transform: translateY(-3px); }
.ms-upload-primary { font-size: 1rem; font-weight: 700; color: #0d2b8e; margin-bottom: 6px; }
.ms-upload-secondary { font-size: 0.82rem; color: #6b7280; margin-bottom: 16px; }
.ms-upload-formats {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ms-format-badge {
  padding: 3px 10px;
  background: #e8eeff;
  color: #0d2b8e;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
}

/* ── Preview table ── */
.ms-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: #f8faff;
  border-bottom: 1px solid #e4e8f0;
  font-size: 0.82rem;
}
.ms-preview-filename {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #0d2b8e;
}
.ms-preview-counts { display: flex; gap: 10px; flex-wrap: wrap; }
.ms-count-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.ms-count-valid   { background: #d1fae5; color: #065f46; }
.ms-count-invalid { background: #fee2e2; color: #991b1b; }
.ms-count-dup     { background: #fef3c7; color: #92400e; }
.ms-count-total   { background: #e0e7ff; color: #3730a3; }

.ms-table-wrap {
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
}
.ms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 700px;
}
.ms-table th {
  padding: 9px 12px;
  text-align: right;
  background: #f1f5f9;
  color: #374151;
  font-weight: 700;
  border-bottom: 2px solid #e4e8f0;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
.ms-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1f2937;
  vertical-align: middle;
}
.ms-table tr:last-child td { border-bottom: none; }
.ms-table tr.row-invalid td { background: #fff8f8; }
.ms-table tr.row-dup td     { background: #fffbf0; }
.ms-table tr.row-valid td   { background: #fff; }
.ms-table tr:hover td { filter: brightness(.97); }

.ms-row-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.ms-row-status.valid    { background: #d1fae5; color: #065f46; }
.ms-row-status.invalid  { background: #fee2e2; color: #991b1b; }
.ms-row-status.dup-skip { background: #fef3c7; color: #92400e; }
.ms-row-status.dup-upd  { background: #dbeafe; color: #1e40af; }

.ms-dept-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #e8eeff;
  color: #0d2b8e;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.ms-dept-tag.unknown { background: #fee2e2; color: #991b1b; }

/* ── Duplicate mode options ── */
.ms-dup-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ms-dup-option {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 2px solid #e4e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.ms-dup-option:has(input:checked) {
  border-color: #17a98c;
  background: #f0faf7;
}
.ms-dup-option input[type=radio] { margin-top: 2px; accent-color: #17a98c; }
.ms-dup-option-title { font-size: 0.88rem; font-weight: 700; color: #1f2937; margin-bottom: 2px; }
.ms-dup-option-desc { font-size: 0.78rem; color: #6b7280; }

/* ── Import confirm footer ── */
.ms-import-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 18px;
  background: #f8faff;
  border-top: 1px solid #e4e8f0;
  margin-top: auto;
}
.ms-import-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  padding: 8px 12px;
  border-radius: 8px;
}
.ms-import-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Loading spinner ── */
.ms-spinner {
  width: 28px; height: 28px;
  border: 3px solid #e4e8f0;
  border-top-color: #17a98c;
  border-radius: 50%;
  animation: ms-spin .7s linear infinite;
  display: inline-block;
}
@keyframes ms-spin { to { transform: rotate(360deg); } }

.ms-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
  color: #374151;
  font-size: 0.88rem;
}

/* ── Results ── */
.ms-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
}
.ms-result-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e4e8f0;
  padding: 18px;
  text-align: center;
}
.ms-result-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}
.ms-result-label { font-size: 0.8rem; color: #6b7280; font-weight: 600; }
.ms-result-card.created  { border-top: 4px solid #059669; }
.ms-result-card.updated  { border-top: 4px solid #2563eb; }
.ms-result-card.skipped  { border-top: 4px solid #f59e0b; }
.ms-result-card.failed   { border-top: 4px solid #dc2626; }
.ms-result-card.created  .ms-result-value { color: #059669; }
.ms-result-card.updated  .ms-result-value { color: #2563eb; }
.ms-result-card.skipped  .ms-result-value { color: #f59e0b; }
.ms-result-card.failed   .ms-result-value { color: #dc2626; }

.ms-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.ms-result-badge.created { background: #d1fae5; color: #065f46; }
.ms-result-badge.updated { background: #dbeafe; color: #1e40af; }
.ms-result-badge.skipped { background: #fef3c7; color: #92400e; }
.ms-result-badge.failed  { background: #fee2e2; color: #991b1b; }

.ms-success-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border: 1px solid #6ee7b7;
  border-radius: 12px;
}
.ms-success-icon {
  width: 42px; height: 42px;
  background: #059669;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

/* ── Empty state ── */
.ms-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}
.ms-empty svg { opacity: .3; margin-bottom: 12px; }
.ms-empty p { font-size: 0.9rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .ms-sidebar { display: none; }
  .ms-content { padding: 16px; }
  .ms-template-box { flex-direction: column; text-align: center; }
  .ms-dup-options { flex-direction: column; }
  .ms-results-grid { grid-template-columns: repeat(2, 1fr); }
}
