/* WastHub — Executive dashboard redesign, 2026-09-16 */

html[data-wast-ui="foundation"] {
  --dashboard-navy: #111a30;
  --dashboard-navy-soft: #1e2a49;
  --dashboard-indigo: #4f46e5;
  --dashboard-violet: #6d5dfc;
  --dashboard-teal: #0d9488;
  --dashboard-green: #16a36a;
  --dashboard-amber: #d97706;
  --dashboard-red: #dc4c64;
  --dashboard-line: #e3e9f2;
  --dashboard-muted: #6c7891;
  --dashboard-surface: #ffffff;
  --dashboard-page: #f4f7fb;
  --dashboard-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

html[data-wast-ui="foundation"] body {
  background: var(--dashboard-page);
}

html[data-wast-ui="foundation"] .dashboard-page {
  position: relative;
  width: 100%;
  min-height: 100%;
  padding: 24px clamp(18px, 2.4vw, 36px) 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at 96% 3%, rgba(79, 70, 229, 0.07), transparent 24rem),
    radial-gradient(circle at 5% 26%, rgba(13, 148, 136, 0.05), transparent 22rem),
    var(--dashboard-page);
}

html[data-wast-ui="foundation"] .dashboard-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image: radial-gradient(rgba(100, 116, 139, 0.18) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to bottom, #000, transparent 32rem);
}

html[data-wast-ui="foundation"] .dashboard-page > * {
  position: relative;
  z-index: 1;
  width: min(100%, 1560px);
  margin-inline: auto;
}

/* Hero */
html[data-wast-ui="foundation"] .dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
  min-height: 224px;
  margin-bottom: 20px;
  padding: 30px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 74% 108%, rgba(99, 102, 241, 0.46), transparent 26rem),
    linear-gradient(128deg, #121a2e 0%, #202c50 55%, #3f37a5 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 24px 54px rgba(26, 34, 66, 0.2);
}

html[data-wast-ui="foundation"] .dashboard-hero::before {
  content: "";
  position: absolute;
  inset: -42% auto auto -8%;
  width: 370px;
  height: 370px;
  border: 52px solid rgba(255, 255, 255, 0.035);
  border-radius: 50%;
}

html[data-wast-ui="foundation"] .dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto 38% -150px auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(112, 102, 255, 0.18);
  filter: blur(44px);
}

.dashboard-hero-copy {
  position: relative;
  z-index: 1;
}

.dashboard-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-inline: 4px;
}

.dashboard-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: #c7d2fe;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dashboard-live-dot {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.13), 0 0 16px rgba(52, 211, 153, 0.8);
}

.dashboard-hero h1 {
  margin: 0 0 9px;
  color: #fff;
  font-size: clamp(26px, 2.4vw, 38px);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.dashboard-hero p {
  max-width: 720px;
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.9;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.dashboard-primary-action,
.dashboard-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.dashboard-primary-action {
  color: #fff;
  background: linear-gradient(135deg, #6d5dfc, #5145db);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 22px rgba(43, 37, 164, 0.32);
}

.dashboard-secondary-action {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.17);
}

.dashboard-primary-action:hover,
.dashboard-secondary-action:hover {
  transform: translateY(-2px);
}

.dashboard-secondary-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.dashboard-secondary-action:disabled {
  opacity: 0.68;
  cursor: wait;
}

.dashboard-secondary-action.is-loading svg {
  animation: dashboard-spin 0.8s linear infinite;
}

@keyframes dashboard-spin {
  to { transform: rotate(360deg); }
}

.dashboard-primary-action svg,
.dashboard-secondary-action svg {
  width: 18px;
  height: 18px;
}

.dashboard-hero-summary {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 15px;
  min-height: 128px;
  padding: 22px;
  overflow: hidden;
  background: rgba(8, 15, 32, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 19px;
  backdrop-filter: blur(14px);
}

.hero-brand-mark {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  padding: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(5, 10, 28, 0.24);
}

.hero-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-summary-copy {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.hero-summary-copy > span,
.hero-summary-copy small {
  color: #aeb9d4;
  font-size: 12px;
  font-weight: 600;
}

.hero-summary-copy strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.hero-summary-copy strong i {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.hero-summary-copy small b {
  color: #dce4f5;
  font-weight: 700;
}

.hero-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.hero-orbit-one { width: 128px; height: 128px; inset: -63px -48px auto auto; }
.hero-orbit-two { width: 92px; height: 92px; inset: auto auto -54px -32px; }

/* KPI cards */
html[data-wast-ui="foundation"] .dashboard-top-stats {
  gap: 14px;
  margin-bottom: 20px;
}

html[data-wast-ui="foundation"] .stat-card {
  min-height: 176px;
  padding: 20px;
  isolation: isolate;
  background: var(--dashboard-surface);
  border: 1px solid var(--dashboard-line);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.055);
}

html[data-wast-ui="foundation"] .stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--stat-accent, var(--dashboard-indigo));
}

html[data-wast-ui="foundation"] .stat-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -34px -48px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--stat-accent, var(--dashboard-indigo)) 8%, transparent);
}

.stat-card-revenue { --stat-accent: var(--dashboard-green); }
.stat-card-contracts { --stat-accent: var(--dashboard-indigo); }
.stat-card-containers { --stat-accent: #158aa4; }
.stat-card-rate { --stat-accent: var(--dashboard-amber); }

html[data-wast-ui="foundation"] .stat-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--stat-accent, var(--dashboard-indigo)) 28%, var(--dashboard-line));
  box-shadow: var(--dashboard-shadow);
}

html[data-wast-ui="foundation"] .stat-header {
  gap: 8px;
  margin-bottom: 16px;
}

html[data-wast-ui="foundation"] .stat-privacy-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  color: #718096;
  background: #f7f9fc;
  border: 1px solid #e1e7ef;
  border-radius: 9px;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

html[data-wast-ui="foundation"] .stat-privacy-toggle:hover {
  color: #4f46e5;
  background: #eef2ff;
  border-color: #cfd5ff;
  transform: translateY(-1px);
}

html[data-wast-ui="foundation"] .stat-privacy-toggle.is-masked {
  color: #b45309;
  background: #fff7ed;
  border-color: #fed7aa;
}

html[data-wast-ui="foundation"] .stat-privacy-toggle svg {
  width: 17px;
  height: 17px;
}

html[data-wast-ui="foundation"] .stat-card.is-value-masked .stat-value,
html[data-wast-ui="foundation"] .stat-card.is-value-masked .stat-trend {
  font-size: 0 !important;
  color: transparent !important;
  user-select: none;
}

html[data-wast-ui="foundation"] .stat-card.is-value-masked .stat-value::after {
  content: "***";
  color: #172036;
  font-size: clamp(25px, 2vw, 32px);
  font-weight: 800;
  letter-spacing: 0.08em;
}

html[data-wast-ui="foundation"] .stat-card.is-value-masked .stat-trend::after {
  content: "***";
  display: inline-block;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

html[data-wast-ui="foundation"] .stat-label {
  margin-bottom: 9px;
  color: var(--dashboard-muted);
  font-size: 12px;
  font-weight: 700;
}

html[data-wast-ui="foundation"] .stat-value {
  color: #121a2d;
  font-size: clamp(25px, 2vw, 32px);
  font-weight: 800;
  letter-spacing: -0.025em;
}

html[data-wast-ui="foundation"] .stat-icon {
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  border-radius: 14px;
  font-size: 21px;
}

html[data-wast-ui="foundation"] .stat-footer {
  gap: 7px;
  font-size: 12px;
}

html[data-wast-ui="foundation"] .stat-trend {
  padding: 4px 8px;
  font-size: 12px;
}

html[data-wast-ui="foundation"] .stat-desc {
  color: #7b879e;
}

html[data-wast-ui="foundation"] .stat-sparkline {
  height: 54px;
  opacity: 0.18;
}

html[data-wast-ui="foundation"] .progress-bar-bg {
  height: 7px;
  background: #edf1f7;
}

/* Baladi cards */
.dashboard-baladi-stats {
  position: relative;
  padding-top: 38px;
}

.dashboard-baladi-stats::before {
  content: "طلبات بلدي";
  position: absolute;
  inset: 3px 4px auto auto;
  color: #24304a;
  font-size: 14px;
  font-weight: 800;
}

.dashboard-baladi-stats::after {
  content: "متابعة مسار الطلبات والتحويل";
  position: absolute;
  inset: 5px 92px auto auto;
  color: var(--dashboard-muted);
  font-size: 12px;
  font-weight: 500;
}

.dashboard-baladi-stats .stat-card:nth-child(1) { --stat-accent: var(--dashboard-amber); }
.dashboard-baladi-stats .stat-card:nth-child(2) { --stat-accent: #3b82f6; }
.dashboard-baladi-stats .stat-card:nth-child(3) { --stat-accent: var(--dashboard-green); }
.dashboard-baladi-stats .stat-card:nth-child(4) { --stat-accent: var(--dashboard-red); }

/* Charts and lower surfaces */
html[data-wast-ui="foundation"] .dashboard-main-charts {
  grid-template-columns: minmax(0, 1.75fr) minmax(285px, 0.72fr);
  gap: 16px;
  margin-bottom: 20px;
}

html[data-wast-ui="foundation"] .chart-card,
html[data-wast-ui="foundation"] .dashboard-surface-card {
  background: var(--dashboard-surface);
  border: 1px solid var(--dashboard-line);
  border-radius: 19px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.055);
}

html[data-wast-ui="foundation"] .chart-card {
  padding: 22px;
}

html[data-wast-ui="foundation"] .chart-header {
  align-items: center;
  margin-bottom: 17px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1f6;
}

html[data-wast-ui="foundation"] .chart-title {
  color: #172036;
  font-size: 15px;
  font-weight: 800;
}

html[data-wast-ui="foundation"] .chart-subtitle,
html[data-wast-ui="foundation"] .activity-card-subtitle {
  color: var(--dashboard-muted);
  font-size: 12px;
  line-height: 1.7;
}

html[data-wast-ui="foundation"] .chart-filter {
  min-height: 38px;
  padding: 7px 12px;
  color: #33415c;
  background: #f8fafc;
  border: 1px solid #dfe6ef;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.operations-chart-card {
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(120deg, rgba(79, 70, 229, 0.35), rgba(13, 148, 136, 0.16)) border-box !important;
  border-color: transparent !important;
}

.performance-chart-card {
  position: relative;
  overflow: hidden;
}

.performance-chart-card::after {
  content: "";
  position: absolute;
  inset: auto -70px -90px auto;
  width: 190px;
  height: 190px;
  pointer-events: none;
  background: rgba(79, 70, 229, 0.055);
  border-radius: 50%;
}

html[data-wast-ui="foundation"] .doughnut-center-text .val {
  color: #172036;
  font-size: 24px;
}

html[data-wast-ui="foundation"] .doughnut-center-text .lbl,
html[data-wast-ui="foundation"] .legend-item {
  color: var(--dashboard-muted);
}

html[data-wast-ui="foundation"] .dashboard-lower-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.82fr);
  gap: 16px;
  margin-bottom: 20px;
}

html[data-wast-ui="foundation"] .activity-card,
html[data-wast-ui="foundation"] .quick-actions-card {
  padding: 22px;
}

html[data-wast-ui="foundation"] .activity-list.modern-list {
  gap: 9px;
}

html[data-wast-ui="foundation"] .activity-item {
  gap: 12px;
  padding: 12px 13px;
  background: #fbfcfe;
  border: 1px solid #e7edf4;
  border-radius: 12px;
}

html[data-wast-ui="foundation"] .activity-item:hover {
  background: #fff;
  border-color: #cfd9e6;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.055);
}

html[data-wast-ui="foundation"] .activity-title {
  color: #1d2942;
  font-size: 12px;
}

html[data-wast-ui="foundation"] .view-all-link {
  padding: 7px 10px;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #dfe3ff;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
}

html[data-wast-ui="foundation"] .quick-actions-grid {
  gap: 10px;
}

html[data-wast-ui="foundation"] .qa-item {
  min-height: 116px;
  padding: 16px 10px;
  background: #f8fafc;
  border: 1px solid #e3e9f1;
  border-radius: 14px;
}

html[data-wast-ui="foundation"] .qa-item:hover {
  background: #fff;
  border-color: #c8d2e1;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.075);
}

html[data-wast-ui="foundation"] .qa-item span {
  color: #26324c;
  font-size: 12px;
  font-weight: 800;
}

html[data-wast-ui="foundation"] .qa-icon {
  width: 45px;
  height: 45px;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 13px;
  font-size: 19px;
}

/* Loading state */
html[data-wast-ui="foundation"] .loading-overlay {
  background: rgba(244, 247, 251, 0.88);
  backdrop-filter: blur(5px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

html[data-wast-ui="foundation"] .loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Dark mode */
html[data-wast-ui="foundation"][data-theme="dark"],
html[data-wast-ui="foundation"] body.dark-mode {
  --dashboard-surface: #111827;
  --dashboard-page: #0b1120;
  --dashboard-line: #263247;
  --dashboard-muted: #94a3b8;
}

html[data-wast-ui="foundation"][data-theme="dark"] .dashboard-page,
html[data-wast-ui="foundation"] body.dark-mode .dashboard-page {
  background:
    radial-gradient(circle at 96% 3%, rgba(99, 102, 241, 0.12), transparent 24rem),
    radial-gradient(circle at 5% 26%, rgba(13, 148, 136, 0.09), transparent 22rem),
    var(--dashboard-page);
}

html[data-wast-ui="foundation"][data-theme="dark"] :is(.stat-value, .chart-title, .activity-title, .qa-item span, .doughnut-center-text .val),
html[data-wast-ui="foundation"] body.dark-mode :is(.stat-value, .chart-title, .activity-title, .qa-item span, .doughnut-center-text .val) {
  color: #f1f5f9;
}

html[data-wast-ui="foundation"][data-theme="dark"] :is(.chart-header, .activity-item, .qa-item),
html[data-wast-ui="foundation"] body.dark-mode :is(.chart-header, .activity-item, .qa-item) {
  border-color: #253147;
}

html[data-wast-ui="foundation"][data-theme="dark"] :is(.activity-item, .qa-item, .chart-filter),
html[data-wast-ui="foundation"] body.dark-mode :is(.activity-item, .qa-item, .chart-filter) {
  color: #dbe4f0;
  background: #172033;
}

html[data-wast-ui="foundation"][data-theme="dark"] .stat-privacy-toggle,
html[data-wast-ui="foundation"] body.dark-mode .stat-privacy-toggle {
  color: #a9b6c9;
  background: #1b263a;
  border-color: #314058;
}

html[data-wast-ui="foundation"][data-theme="dark"] .stat-card.is-value-masked .stat-value::after,
html[data-wast-ui="foundation"] body.dark-mode .stat-card.is-value-masked .stat-value::after {
  color: #f1f5f9;
}

html[data-wast-ui="foundation"][data-theme="dark"] .operations-chart-card,
html[data-wast-ui="foundation"] body.dark-mode .operations-chart-card {
  background:
    linear-gradient(#111827, #111827) padding-box,
    linear-gradient(120deg, rgba(99, 102, 241, 0.5), rgba(13, 148, 136, 0.24)) border-box !important;
}

/* Responsive */
@media (max-width: 1180px) {
  html[data-wast-ui="foundation"] .dashboard-main-charts,
  html[data-wast-ui="foundation"] .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  html[data-wast-ui="foundation"] .dashboard-page {
    padding: 16px 12px 26px;
  }

  html[data-wast-ui="foundation"] .dashboard-hero {
    grid-template-columns: 1fr;
    padding: 24px;
    border-radius: 19px;
  }

  .dashboard-hero-summary {
    align-self: auto;
  }

  html[data-wast-ui="foundation"] .dashboard-top-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  html[data-wast-ui="foundation"] .dashboard-hero {
    padding: 21px 18px;
  }

  .dashboard-hero h1 {
    font-size: 25px;
  }

  .dashboard-hero-actions,
  .dashboard-primary-action,
  .dashboard-secondary-action {
    width: 100%;
  }

  html[data-wast-ui="foundation"] .dashboard-top-stats {
    grid-template-columns: 1fr;
  }

  html[data-wast-ui="foundation"] .stat-card {
    min-height: 152px;
  }

  .dashboard-baladi-stats::after {
    display: none;
  }

  html[data-wast-ui="foundation"] .chart-card,
  html[data-wast-ui="foundation"] .activity-card,
  html[data-wast-ui="foundation"] .quick-actions-card {
    padding: 16px;
    border-radius: 16px;
  }

  html[data-wast-ui="foundation"] .quick-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-page *,
  .dashboard-page *::before,
  .dashboard-page *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
