/* ==========================================================================
   WCPEC – UICS Styles (Full-width layout + inline details)
   مع تحسينات: responsiveness + readability + accessibility
   ========================================================================== */

.uics-page{
  --uics-bg-page:#f6f8fc;
  --uics-surface:#ffffff;
  --uics-ink:#0f172a;
  --uics-ink-soft:#475569;
  --uics-brand:#1f5e98;
  --uics-brand-2:#164b7a;
  --uics-border:#d8e0ea;
  --uics-muted:#f2f5fa;
  --uics-success-50:#f0fff4;
  --uics-success-600:#14532d;
  --uics-warning-50:#fffbeb;
  --uics-warning-600:#92400e;
  --uics-danger-50:#fff5f5;
  --uics-danger-600:#7f1d1d;
  --uics-radius-sm:8px;
  --uics-radius-md:12px;
  --uics-radius-lg:16px;
  --uics-shadow-sm:0 1px 2px rgba(15,23,42,.04);
  --uics-shadow-md:0 6px 18px rgba(15,23,42,.08);
  --uics-font: Tahoma, "Segoe UI", Arial, sans-serif;
}
.uics-page *{ box-sizing:border-box }

/* الصفحة */
body .uics-page{
  direction:rtl;
  width:100% !important;
  max-width:100% !important;
  margin:24px auto !important;
  padding:16px !important;
  background:var(--uics-bg-page) !important;
  color:var(--uics-ink) !important;
  font-family:var(--uics-font);
  position:static !important;
  inset:auto !important;
  transform:none !important;
  z-index:1 !important;
}
.uics-page > *{
  position:static !important;
  transform:none !important;
  max-width:100% !important;
  width:100% !important;
}

/* Header */
.uics-page__header{
  display:flex;
  align-items:center;
  gap:16px;
  padding:18px 20px;
  background:linear-gradient(180deg,var(--uics-brand) 0%,var(--uics-brand-2) 100%);
  color:#fff;
  border-radius:var(--uics-radius-lg);
  box-shadow:var(--uics-shadow-md);
  margin-bottom:18px;
}
.uics-page__logo{
  width:48px;height:48px;flex:0 0 48px;border-radius:12px;
  background:#fff;display:grid;place-items:center;color:var(--uics-brand-2);font-weight:800
}
.uics-page__title{ margin:0;font-size:20px;font-weight:900 }
.uics-page__subtitle{ margin:2px 0 0;opacity:.95;font-size:13px }

/* الأسطح البيضاء */
.uics-page .uics-card,
.uics-page .uics-card--elevated,
.uics-page .uics-table-wrap,
.uics-page .uics-prose,
.uics-page .uics-stat{
  background:var(--uics-surface) !important;
  color:var(--uics-ink) !important;
}
.uics-card{
  border:1px solid var(--uics-border);
  border-radius:var(--uics-radius-lg);
  padding:16px;
  box-shadow:var(--uics-shadow-sm);
  margin-bottom:16px;
}
.uics-card--elevated{ box-shadow:var(--uics-shadow-md) }

/* Typography / Prose */
.uics-prose{ line-height:1.7 }
.uics-prose h1,.uics-prose h2,.uics-prose h3{ margin:.3em 0 .4em; font-weight:900; color:var(--uics-ink) }
.uics-prose p{ margin:.4em 0 }
.uics-label{ display:block; font-size:13px; color:var(--uics-ink-soft); margin:0 0 6px; font-weight:700 }

/* Form Controls */
.uics-control{
  display:inline-flex; align-items:center; width:100%;
  min-height:38px; padding:8px 10px; border-radius:10px;
  border:1px solid var(--uics-border); background:#fff; color:var(--uics-ink);
  outline:none; box-shadow:var(--uics-shadow-sm);
}
.uics-control:focus{ border-color:#9ec2e6; box-shadow:0 0 0 3px rgba(31,94,152,.15) }
.uics-control[disabled]{ background:#f3f6fb; color:#97a6b6; cursor:not-allowed }
.uics-control::placeholder{ color:#9aa9ba }
.uics-control[type="number"]{ max-width:160px }
select.uics-control{ padding-inline:10px }

/* Grid helpers */
.uics-grid{ display:grid; gap:10px }
.uics-grid.cols-2{ grid-template-columns:repeat(2,1fr) }
.uics-grid.cols-3{ grid-template-columns:repeat(3,1fr) }
.uics-grid.cols-4{ grid-template-columns:repeat(4,1fr) }
@media (max-width:900px){ .uics-grid.cols-4{ grid-template-columns:repeat(2,1fr) } }
@media (max-width:720px){
  .uics-grid.cols-2,.uics-grid.cols-3,.uics-grid.cols-4{ grid-template-columns:1fr }
}

/* Badges & Buttons */
.uics-badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:4px 10px;border-radius:999px;font-size:12px;font-weight:700;
  border:1px solid var(--uics-border);background:var(--uics-muted);color:var(--uics-ink-soft)
}
.uics-badge--success{ background:var(--uics-success-50); color:var(--uics-success-600); border-color:#86efac }
.uics-badge--warning{ background:var(--uics-warning-50); color:var(--uics-warning-600); border-color:#fcd34d }
.uics-badge--danger{  background:var(--uics-danger-50);  color:var(--uics-danger-600);  border-color:#fca5a5 }
.uics-badge--info{    background:#e8f1fb; color:var(--uics-brand-2); border-color:#c7d6ea }

.uics-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:8px 12px;border-radius:12px;border:1px solid var(--uics-border);
  background:#fff;color:var(--uics-brand-2);font-weight:800;text-decoration:none;
  cursor:pointer;transition:.15s box-shadow,.05s transform; box-shadow:var(--uics-shadow-sm)
}
.uics-btn:hover{ transform:translateY(-1px); box-shadow:var(--uics-shadow-md) }
.uics-btn--primary{ background:linear-gradient(180deg,#ffd666,#f4b400); color:#1a1a1a; border-color:#e5b100 }
.uics-btn--danger{ background:var(--uics-danger-50); color:var(--uics-danger-600) }
.uics-actions{ display:flex; gap:8px; align-items:center; flex-wrap:nowrap }
@media (max-width:920px){ .uics-actions{ flex-wrap:wrap } }

/* Stats */
.uics-stats{ display:grid; gap:12px; grid-template-columns:repeat(4,1fr) }
@media (max-width:900px){ .uics-stats{ grid-template-columns:repeat(2,1fr) } }
@media (max-width:540px){ .uics-stats{ grid-template-columns:1fr } }
.uics-stat{ border:1px solid var(--uics-border); border-radius:var(--uics-radius-lg); padding:14px }
.uics-stat__label{ font-size:12px; color:var(--uics-ink-soft); margin:0 0 6px }
.uics-stat__value{ font-size:20px; font-weight:900; color:var(--uics-brand-2) }

/* ===== Table – أبيض بالكامل بدون أي خلفية داكنة ===== */
.uics-table-wrap{
  border:1px solid var(--uics-border);
  border-radius:var(--uics-radius-lg);
  overflow-x:auto; -webkit-overflow-scrolling:touch; /* ← تحسين للجوال */
  box-shadow:var(--uics-shadow-sm);
  width:100%;
  background:var(--uics-surface) !important;
}
.uics-table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
  table-layout:auto;
  min-width:720px; /* ← سحب أفقي عند الحاجة */
  background:var(--uics-surface) !important;
}
.uics-table thead th{
  text-align:start;
  background:#eef3fb !important;
  color:#0f2a47 !important;
  font-weight:900;
  padding:12px;
  border-bottom:1px solid var(--uics-border);
  white-space:nowrap;
}
.uics-table tbody td{
  padding:12px;
  border-bottom:1px solid var(--uics-border);
  vertical-align:middle;
  color:var(--uics-ink) !important;
  background:var(--uics-surface) !important;
  white-space:normal;
}
.uics-table tbody tr:hover{ background:#fafcff !important }
.uics-table .col-actions{ white-space:nowrap }
.uics-account-id{ font-family:ui-monospace,monospace; overflow-wrap:anywhere; word-break:break-word }
/* أزرار WP داخل الجدول */
.uics-table .button{ border-radius:10px; padding:4px 10px; height:auto; line-height:1.6 }
.uics-table .button-small{ padding:2px 8px; font-size:12px }

/* صف التفاصيل */
.uics-details td{
  background:#f9fbff !important;
  padding:16px;
  border-top:1px solid var(--uics-border)
}
.uics-details__grid{ display:grid; gap:10px; grid-template-columns:repeat(2,1fr) }
@media (max-width:720px){ .uics-details__grid{ grid-template-columns:1fr } }
.uics-details__item{ display:flex; align-items:center; gap:8px }
.uics-details__key{ color:var(--uics-ink-soft); font-weight:700; min-width:120px }

/* رسائل الحالة */
.uics-msg{
  margin:10px 0; padding:10px 12px; border-radius:12px;
  border:1px solid var(--uics-border); background:#f8fafc; color:inherit;
}
.uics-msg[data-variant="success"], .uics-msg:not([data-variant]){
  background:var(--uics-success-50); color:var(--uics-success-600); border-color:#86efac;
}
.uics-msg[data-variant="error"]{
  background:var(--uics-danger-50); color:var(--uics-danger-600); border-color:#fca5a5;
}

/* مساعدات صغيرة */
.uics-hidden{ display:none !important; }
.uics-copy{ cursor:pointer; }
.nowrap{ white-space:nowrap }

/* تركيز الوصول */
.uics-btn:focus-visible,
.uics-actions a:focus-visible,
.uics-control:focus-visible,
.uics-table .button:focus-visible{
  outline:3px solid rgba(31,94,152,.35);
  outline-offset:2px
}

/* تقليل الحركة */
@media (prefers-reduced-motion: reduce){
  .uics-btn{ transition:none }
  .uics-btn:hover{ transform:none; box-shadow:var(--uics-shadow-sm) }
  @keyframes uics-spin{ from{transform:none} to{transform:none} }
}

/* قمع أي طبقات/مودالات يحقنها القالب داخل مساحة UICS فقط */
.uics-page [class*="overlay"],
.uics-page [class*="lightbox"],
.uics-page [class*="modal"],
.uics-page [id*="popup"]{
  display:none !important; visibility:hidden !important; pointer-events:none !important;
}

/* تحسينات صغيرة داخل الجداول */
.uics-table .uics-actions{ gap:6px; flex-wrap:wrap }
.uics-table .uics-control{ max-width:100%; width:auto }
.uics-table input.uics-control{ min-width:220px }
.uics-table select.uics-control{ min-width:150px }

/* توافق RTL داخل حقول LTR (مثل الـICN) */
[dir="rtl"] .dir-ltr,
.uics-control[dir="ltr"]{
  direction:ltr; text-align:left;
}

/* =========================
   إضافات خفيفة (تُستخدم في القوالب الجديدة)
   ========================= */

/* ترويسة البطاقة */
.uics-card__header{
  display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px;
}
.uics-card__title{ font-size:18px; font-weight:900; margin:0; color:var(--uics-ink) }

/* فواصل ومسافات */
.uics-space-md{ height:12px; width:100%; display:block }
.uics-divider{ height:1px; background:var(--uics-border); margin:12px 0; border:0 }

/* أنماط أزرار إضافية */
.uics-btn--outline{
  background:transparent; color:var(--uics-brand-2);
  border-color:var(--uics-border);
}
.uics-btn--ghost{
  background:transparent; color:var(--uics-brand-2);
  border-color:transparent;
}
.uics-btn--ghost:hover{ background:#f8fafc }

/* نمط بطاقة نموذج */
.uics-card--form{ /* توريث من .uics-card */ }

/* شارة تفعيل/تعطيل في جدول الموظف متسقة */
.uics-activation-state{ white-space:nowrap }
