/* مركز الأتمتة والجدولة — Phase 6C.
   لا Layout جديد ولا ألوان خارج متغيّرات التصميم: يعيد استعمال مكوّنات ig-*
   القائمة (البطاقات والأزرار والنوافذ والتوستات) ويضيف فقط شبكة الحالة
   وبطاقة المهمة وجدول سجل التشغيل. */

/* ── لافتة مفتاح الخادم ── */
.igx-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  border-inline-start: 4px solid #d97706;
  background: #fff6e5;
  color: #8a5a00;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 14px;
}

/* ── شبكة حالة الجدولة ── */
.igx-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.igx-stat {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-md, 10px);
  background: var(--surface, #fff);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.igx-stat-label { font-size: 12px; color: var(--text-secondary, #6b7280); }
.igx-stat-value { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.igx-stat-time .igx-stat-value,
.igx-stat-time { font-size: 13px; font-weight: 600; }
.igx-stat-main { border-color: #c7d2fe; }
.igx-stat-warn { border-color: #f0dcb0; }
.igx-on  { color: #15803d; }
.igx-off { color: #9b1c1c; }

.igx-warnings-card { border-inline-start: 4px solid #d97706; }
.igx-warnings { margin-bottom: 14px; }
.igx-warnings h4 { margin: 0 0 6px; font-size: 14px; }
.igx-warnings ul { margin: 0; padding-inline-start: 18px; font-size: 13px; line-height: 1.8; }

/* ── شريط الأدوات ── */
.igx-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.igx-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 auto; min-width: 0; }
.igx-filters .ig-input { min-width: 0; flex: 0 1 auto; }
.igx-filters #igx-search { flex: 1 1 180px; }
.igx-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.igx-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary, #6b7280); white-space: nowrap;
}
.igx-hint { font-size: 12px; color: var(--text-secondary, #6b7280); margin: 6px 0 0; }

/* ── بطاقات المهام ── */
.igx-list { display: flex; flex-direction: column; gap: 10px; }

.igx-card {
  border: 1px solid var(--border-color, #e5e7eb);
  border-inline-start-width: 4px;
  border-radius: var(--radius-md, 10px);
  background: var(--surface, #fff);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.igx-card-scheduled { border-inline-start-color: #16a34a; }
.igx-card-running   { border-inline-start-color: #2563eb; }
.igx-card-paused    { border-inline-start-color: #d97706; }
.igx-card-degraded  { border-inline-start-color: #d97706; }
.igx-card-error     { border-inline-start-color: #dc2626; }
.igx-card-disabled  { border-inline-start-color: #9ca3af; background: var(--surface-alt, #f9fafb); }

.igx-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.igx-card-title { font-size: 14px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.igx-card-desc { font-size: 13px; line-height: 1.7; color: var(--text-secondary, #4b5563); margin: 0; overflow-wrap: anywhere; }

.igx-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.igx-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; border: 1px solid var(--border-color, #e5e7eb);
  background: var(--surface-alt, #f3f4f6); color: #4b5563;
}
.igx-badge-on       { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.igx-badge-off      { background: var(--surface-alt, #f3f4f6); color: #4b5563; }
.igx-badge-running  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.igx-badge-warn     { background: #fff6e5; color: #8a5a00; border-color: #f0dcb0; }
.igx-badge-error    { background: #fdecec; color: #9b1c1c; border-color: #f5c6c6; }
.igx-badge-ai       { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }

.igx-meta {
  font-size: 12px; color: var(--text-secondary, #6b7280);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px;
}
.igx-meta span { overflow-wrap: anywhere; }
.igx-err {
  font-size: 12px; background: #fdecec; border: 1px solid #f5c6c6;
  color: #9b1c1c; border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere;
}
.igx-deps { font-size: 12px; color: var(--text-secondary, #6b7280); }
.igx-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

.igx-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 16px; font-size: 13px;
}

/* ── سجل التشغيل ── */
.igx-runs-card { margin-top: 18px; }
.igx-runs-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.igx-runs-head h4 { margin: 0; font-size: 14px; }

/* الجدول عريض عمداً — يمرّر أفقياً داخل حاويته وحدها، والصفحة لا تمرّر */
.igx-runs-scroll { overflow-x: auto; }
.igx-runs { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 900px; }
.igx-runs th, .igx-runs td {
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  padding: 7px 8px; text-align: start; white-space: nowrap;
}
.igx-runs th { font-weight: 600; color: var(--text-secondary, #6b7280); }
.igx-runs td.igx-wrap { white-space: normal; max-width: 260px; overflow-wrap: anywhere; }
.igx-runs tbody tr:hover { background: var(--surface-alt, #f9fafb); }

.igx-rs { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.igx-rs-succeeded { background: #dcfce7; color: #14532d; }
.igx-rs-partial   { background: #fff6e5; color: #8a5a00; }
.igx-rs-failed    { background: #fdecec; color: #9b1c1c; }
.igx-rs-timed_out { background: #fdecec; color: #9b1c1c; }
.igx-rs-skipped   { background: var(--surface-alt, #f3f4f6); color: #4b5563; }
.igx-rs-duplicate_prevented { background: var(--surface-alt, #f3f4f6); color: #4b5563; }
.igx-rs-running   { background: #eff6ff; color: #1d4ed8; }
.igx-rs-pending   { background: var(--surface-alt, #f3f4f6); color: #4b5563; }
.igx-rs-cancelled { background: var(--surface-alt, #f3f4f6); color: #4b5563; }

/* ── نافذة تعديل الجدول ── */
.igx-sched-box { max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; }
.igx-sched-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.igx-sched-head h3 { margin: 0; font-size: 16px; }
.igx-sched-body { margin: 12px 0; }
.igx-sched-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.igx-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.igx-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; font-size: 13px; }
.igx-field > span { color: var(--text-secondary, #6b7280); font-size: 12px; }
.igx-preview {
  margin-top: 10px; font-size: 13px; line-height: 1.8;
  border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px;
  padding: 8px 10px; background: var(--surface-alt, #f9fafb);
  overflow-wrap: anywhere;
}
.igx-preview-ok  { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.igx-preview-bad { border-color: #f5c6c6; background: #fdecec; color: #9b1c1c; }

@media (max-width: 640px) {
  .igx-toolbar { flex-direction: column; align-items: stretch; }
  .igx-filters .ig-input { flex: 1 1 100%; }
  .igx-actions .ig-btn { flex: 1 1 auto; }
  .igx-status { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
  .igx-stat-value { font-size: 16px; }
  .igx-card-head { flex-direction: column; }
  .igx-meta { grid-template-columns: 1fr; }
  .igx-runs-head { flex-direction: column; align-items: stretch; }
}
