/* ==============================================================
   نمط نادي المطور - Nadi High-Contrast & Cairo Modern Design System
   مفعل اختيارياً عبر html.theme-nadi-active ويمكن التراجع عنه بزر
   ============================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* Toggle button styling in topbar */
.theme-style-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Cairo', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.theme-style-toggle-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}
.theme-nadi-active .theme-style-toggle-btn {
  background: linear-gradient(135deg, rgba(11, 110, 79, 0.12), rgba(11, 110, 79, 0.22));
  border-color: #0b6e4f;
  color: #0b6e4f;
}

/* Scoped Modern Styles under .theme-nadi-active or [data-ui-style="nadi_modern"] */
html.theme-nadi-active,
html[data-ui-style="nadi_modern"] {
  --font-family-cairo: 'Cairo', system-ui, -apple-system, sans-serif;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-card: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #09090b;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03);
  --shadow-card-hover: 0 10px 28px rgba(15, 23, 42, 0.08), 0 3px 6px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 25px 60px rgba(15, 23, 42, 0.22);
  
  font-family: var(--font-family-cairo) !important;
}

html.theme-nadi-active *,
html[data-ui-style="nadi_modern"] * {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif !important;
}

html.theme-nadi-active body,
html[data-ui-style="nadi_modern"] body {
  background-color: var(--bg-page) !important;
  color: var(--text-primary) !important;
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Topbar in Modern Nadi Style */
html.theme-nadi-active .topbar,
html[data-ui-style="nadi_modern"] .topbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03) !important;
  height: 68px;
  padding: 0 20px;
}
html.theme-nadi-active .brand strong,
html[data-ui-style="nadi_modern"] .brand strong {
  font-size: 17px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
}
html.theme-nadi-active .brand small,
html[data-ui-style="nadi_modern"] .brand small {
  font-size: 12px !important;
  color: #64748b !important;
  font-weight: 600;
}
html.theme-nadi-active .brand-mark,
html[data-ui-style="nadi_modern"] .brand-mark {
  border-radius: 14px !important;
  box-shadow: 0 4px 12px rgba(11, 110, 79, 0.25) !important;
}

/* Sidebar & Navigation */
html.theme-nadi-active .app-drawer,
html[data-ui-style="nadi_modern"] .app-drawer {
  background: #ffffff !important;
  border-left: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06) !important;
}
html.theme-nadi-active .sidebar-nav a,
html.theme-nadi-active .sidebar-nav summary,
html[data-ui-style="nadi_modern"] .sidebar-nav a,
html[data-ui-style="nadi_modern"] .sidebar-nav summary {
  font-size: 14px !important;
  font-weight: 750 !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  color: #334155 !important;
  transition: all 0.15s ease;
}
html.theme-nadi-active .sidebar-nav a:hover,
html.theme-nadi-active .sidebar-nav summary:hover,
html.theme-nadi-active .sidebar-nav a.active,
html[data-ui-style="nadi_modern"] .sidebar-nav a:hover,
html[data-ui-style="nadi_modern"] .sidebar-nav summary:hover,
html[data-ui-style="nadi_modern"] .sidebar-nav a.active {
  background: #f1f5f9 !important;
  color: var(--primary, #0b6e4f) !important;
}
html.theme-nadi-active .sidebar-nav a.nav-home.active,
html[data-ui-style="nadi_modern"] .sidebar-nav a.nav-home.active {
  background: linear-gradient(135deg, var(--primary, #0b6e4f), color-mix(in srgb, var(--primary, #0b6e4f) 80%, #000)) !important;
  color: #fff !important;
}

/* Headings & Typography Elevation */
html.theme-nadi-active .page-head h1,
html[data-ui-style="nadi_modern"] .page-head h1 {
  font-size: 24px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  letter-spacing: -0.3px;
}
html.theme-nadi-active .page-head p,
html[data-ui-style="nadi_modern"] .page-head p {
  font-size: 13.5px !important;
  color: #64748b !important;
}
html.theme-nadi-active .eyebrow,
html[data-ui-style="nadi_modern"] .eyebrow {
  font-size: 12px !important;
  font-weight: 850 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cards & Elevated Containers */
html.theme-nadi-active .card,
html.theme-nadi-active .card-soft,
html.theme-nadi-active .stat-card,
html[data-ui-style="nadi_modern"] .card,
html[data-ui-style="nadi_modern"] .card-soft,
html[data-ui-style="nadi_modern"] .stat-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
html.theme-nadi-active .card-soft:hover,
html.theme-nadi-active .stat-card:hover,
html[data-ui-style="nadi_modern"] .card-soft:hover,
html[data-ui-style="nadi_modern"] .stat-card:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

/* Stat Cards in Nadi Style */
html.theme-nadi-active .stat-card,
html[data-ui-style="nadi_modern"] .stat-card {
  padding: 18px 20px !important;
}
html.theme-nadi-active .stat-card span,
html[data-ui-style="nadi_modern"] .stat-card span {
  font-size: 13px !important;
  font-weight: 750 !important;
  color: #64748b !important;
}
html.theme-nadi-active .stat-card strong,
html[data-ui-style="nadi_modern"] .stat-card strong {
  font-size: 26px !important;
  font-weight: 950 !important;
  color: #0f172a !important;
  margin: 6px 0 2px !important;
}
html.theme-nadi-active .stat-card.primary,
html[data-ui-style="nadi_modern"] .stat-card.primary {
  background: linear-gradient(135deg, var(--primary, #0b6e4f), color-mix(in srgb, var(--primary, #0b6e4f) 75%, #000)) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 8px 24px rgba(11, 110, 79, 0.28) !important;
}
html.theme-nadi-active .stat-card.primary span,
html.theme-nadi-active .stat-card.primary strong,
html.theme-nadi-active .stat-card.primary small,
html[data-ui-style="nadi_modern"] .stat-card.primary span,
html[data-ui-style="nadi_modern"] .stat-card.primary strong,
html[data-ui-style="nadi_modern"] .stat-card.primary small {
  color: #ffffff !important;
}

/* Forms & High-Contrast Input Controls */
html.theme-nadi-active .form-label,
html[data-ui-style="nadi_modern"] .form-label {
  font-size: 13.5px !important;
  font-weight: 800 !important;
  color: #1e293b !important;
  margin-bottom: 6px !important;
}
html.theme-nadi-active .form-control,
html.theme-nadi-active .form-select,
html[data-ui-style="nadi_modern"] .form-control,
html[data-ui-style="nadi_modern"] .form-select {
  min-height: 46px !important;
  border-radius: 12px !important;
  border: 1.5px solid #cbd5e1 !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
  padding: 8px 14px !important;
  transition: all 0.15s ease;
}
html.theme-nadi-active .form-control:focus,
html.theme-nadi-active .form-select:focus,
html[data-ui-style="nadi_modern"] .form-control:focus,
html[data-ui-style="nadi_modern"] .form-select:focus {
  border-color: var(--primary, #0b6e4f) !important;
  box-shadow: 0 0 0 3px rgba(11, 110, 79, 0.22) !important;
  outline: 0 !important;
}

/* Buttons in Nadi Style */
html.theme-nadi-active .btn,
html[data-ui-style="nadi_modern"] .btn {
  font-size: 14px !important;
  font-weight: 800 !important;
  border-radius: 12px !important;
  padding: 9px 18px !important;
  transition: all 0.15s ease;
}
html.theme-nadi-active .btn-primary,
html[data-ui-style="nadi_modern"] .btn-primary {
  background: linear-gradient(135deg, var(--primary, #0b6e4f), color-mix(in srgb, var(--primary, #0b6e4f) 82%, #000)) !important;
  border: 0 !important;
  box-shadow: 0 3px 10px rgba(11, 110, 79, 0.25) !important;
}
html.theme-nadi-active .btn-primary:hover,
html[data-ui-style="nadi_modern"] .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(11, 110, 79, 0.32) !important;
}

/* Tables in Nadi Style */
html.theme-nadi-active .table,
html[data-ui-style="nadi_modern"] .table {
  color: #0f172a !important;
  border-collapse: separate;
  border-spacing: 0;
}
html.theme-nadi-active .table thead th,
html[data-ui-style="nadi_modern"] .table thead th {
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 850 !important;
  border-bottom: 2px solid #cbd5e1 !important;
  padding: 12px 14px !important;
  white-space: nowrap;
}
html.theme-nadi-active .table tbody td,
html[data-ui-style="nadi_modern"] .table tbody td {
  padding: 12px 14px !important;
  font-size: 14px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  vertical-align: middle;
}
html.theme-nadi-active .table tbody tr:hover td,
html[data-ui-style="nadi_modern"] .table tbody tr:hover td {
  background-color: #f1f5f9 !important;
}

/* Badges */
html.theme-nadi-active .badge,
html[data-ui-style="nadi_modern"] .badge {
  font-size: 12px !important;
  font-weight: 850 !important;
  padding: 5px 10px !important;
  border-radius: 8px !important;
}

/* Modal Popup in Nadi Style */
.nadi-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}
.nadi-modal-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  border: 1px solid #e2e8f0;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}
.nadi-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nadi-modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
}
.nadi-modal-body {
  padding: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}


/* ==============================================================
   Mobile Safety & Horizontal Overflow Protection
   ============================================================== */
html.theme-nadi-active,
html.theme-nadi-active body,
html[data-ui-style="nadi_modern"],
html[data-ui-style="nadi_modern"] body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
  position: relative;
}

@media (max-width: 1100px) {
  html.theme-nadi-active .app-drawer:not(.is-open),
  html[data-ui-style="nadi_modern"] .app-drawer:not(.is-open) {
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateX(110%) !important;
  }
  html.theme-nadi-active .topbar,
  html[data-ui-style="nadi_modern"] .topbar {
    padding: 0 12px !important;
    height: 60px !important;
  }
  html.theme-nadi-active .top-account-link span,
  html[data-ui-style="nadi_modern"] .top-account-link span {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }
  html.theme-nadi-active .content,
  html[data-ui-style="nadi_modern"] .content {
    padding: 14px 12px 35px !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ==============================================================
   Nadi Standard Modal Overlay & Sheet System
   ============================================================== */
.nadi-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 16px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}
.nadi-modal-overlay.is-open {
  display: flex !important;
  animation: fadeInModal 0.18s ease-out;
}
.nadi-modal-sheet {
  background: #ffffff !important;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex !important;
  flex-direction: column !important; /* Strictly column: Header above Content */
  overflow: hidden;
  animation: slideUpModal 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.nadi-modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #ffffff;
  flex-shrink: 0;
}
.nadi-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nadi-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.nadi-modal-icon.primary {
  background: #ecfdf5;
  color: #0b6e4f;
  border: 1px solid #a7f3d0;
}
.nadi-modal-icon.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.nadi-modal-title {
  font-size: 16px !important;
  font-weight: 900 !important;
  color: #0f172a !important;
  margin: 0 !important;
  line-height: 1.25;
}
.nadi-modal-sub {
  font-size: 11.5px !important;
  color: #64748b !important;
  display: block;
  margin-top: 2px;
}
.nadi-modal-close-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.nadi-modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.nadi-modal-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUpModal {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ==============================================================
   Nadi Modern Entity Cards (Employees)
   ============================================================== */
.nadi-emp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 860px) {
  .nadi-emp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.nadi-emp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.nadi-emp-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}
.nadi-emp-card.is-inactive {
  opacity: 0.65;
}

.nadi-emp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.nadi-emp-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}
.nadi-emp-avatar-text,
.nadi-emp-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
  background: #ecfdf5;
  color: #0b6e4f;
  border: 1.5px solid #a7f3d0;
  object-fit: cover;
}
.nadi-emp-identity {
  min-width: 0;
  flex: 1;
}
.nadi-emp-name {
  font-size: 15.5px !important;
  font-weight: 850 !important;
  color: #0f172a !important;
  margin: 0 0 2px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nadi-emp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #64748b;
  flex-wrap: wrap;
}
.nadi-emp-phone {
  color: #0b6e4f !important;
  text-decoration: none;
  font-weight: 700;
}
.nadi-emp-phone:hover {
  text-decoration: underline;
}

.nadi-emp-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.nadi-emp-status.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.nadi-emp-status.inactive {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}
.nadi-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.nadi-emp-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.nadi-emp-tile {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 7px 10px;
  min-width: 0;
}
.nadi-emp-tile .tile-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 2px;
}
.nadi-emp-tile .tile-val {
  display: block;
  font-size: 13.5px;
  font-weight: 850;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nadi-emp-tile .role-badge {
  color: #0b6e4f;
  font-size: 12px;
  font-weight: 800;
}

.nadi-emp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
  flex-wrap: wrap;
}
.btn-emp-action {
  font-family: 'Cairo', system-ui, sans-serif;
  border-radius: 9px;
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-emp-action.primary {
  background: #f0fdf4;
  color: #0b6e4f;
  border-color: #bbf7d0;
  padding: 5px 12px;
  flex: 1;
}
.btn-emp-action.primary:hover {
  background: #0b6e4f;
  color: #fff;
  border-color: #0b6e4f;
}
.nadi-emp-actions-sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-emp-action.secondary {
  background: #f8fafc;
  color: #334155;
  border-color: #e2e8f0;
  padding: 5px 9px;
  font-size: 11.5px;
}
.btn-emp-action.secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-emp-action.danger {
  background: #fff1f2;
  color: #e11d48;
  border-color: #fecdd3;
  width: 33px;
  height: 33px;
  padding: 0;
}
.btn-emp-action.danger:hover {
  background: #e11d48;
  color: #fff;
  border-color: #e11d48;
}
