:root {
  --brand-primary: #1B2A4A;
  --brand-white: #FFFFFF;
  --brand-light: #F8F9FA;
  --brand-info: #17A2B8;
  --brand-blue: #2F6FED;
  --brand-purple: #7C3AED;
  --brand-gradient: linear-gradient(90deg, var(--brand-blue), var(--brand-purple));
  --brand-muted: #64748B;
  --brand-border: #E7ECF3;
  --radius-lg: 1.25rem;
  --radius-md: 0.9rem;
}

html {
  font-size: 15px;
}

body {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  background: var(--brand-white);
  color: #1f2937;
}

.text-primary-brand { color: var(--brand-primary) !important; }
.text-info-brand { color: var(--brand-info) !important; }
.bg-primary-brand { background-color: var(--brand-primary) !important; }
.bg-light-brand { background-color: var(--brand-light) !important; }

.btn-primary-brand {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.btn-outline-primary-brand {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.btn-info-brand {
  background: var(--brand-info);
  border-color: var(--brand-info);
}

.hero-section {
  background: linear-gradient(145deg, #eef2f7 0%, #ffffff 100%);
}

.glass-card,
.route-card,
.feature-box,
.sector-card,
.step-pill {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  background: #fff;
}

.route-card, .feature-box, .sector-card {
  transition: transform .2s ease, box-shadow .2s ease;
}
.route-card:hover, .feature-box:hover, .sector-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 35px -22px rgba(15, 23, 42, .25);
}

.section-title {
  font-weight: 700;
  color: var(--brand-primary);
}

/* ===================== Modern design system ===================== */

/* Navbar */
.navbar-modern { padding-block: .85rem; }
.navbar-modern .nav-link { color: #334155; font-weight: 500; }
.navbar-modern .nav-link:hover,
.navbar-modern .nav-link.active { color: var(--brand-blue); }

.brand-logo-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Buttons */
.btn-gradient-brand {
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: 0 12px 24px -10px rgba(59, 60, 235, .45);
  font-weight: 600;
}
.btn-gradient-brand:hover { color: #fff; filter: brightness(1.06); }

.btn-outline-soft {
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  color: var(--brand-primary);
  background: #fff;
  font-weight: 600;
}
.btn-outline-soft:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

.social-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--brand-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.social-icon:hover { background: var(--brand-gradient); color: #fff; border-color: transparent; }

.site-theme-banner {
  min-height: 42px;
  padding: .55rem 0;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  text-align: center;
}

.site-theme-banner i {
  font-size: 1rem;
}

/* Text / headings */
.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem 1rem;
  border-radius: 999px;
  background: #F1EEFE;
  color: var(--brand-purple);
  font-weight: 600;
  font-size: .85rem;
}
.section-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-purple); }

.section-heading { font-weight: 800; color: var(--brand-primary); }
.section-subtitle { max-width: 560px; }

/* Cards */
.card-soft {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  background: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card-soft:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 35px -20px rgba(15, 23, 42, .25);
}

/* Icon chips */
.icon-chip {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}
.icon-chip-blue   { background: #E7F0FE; color: #2563EB; }
.icon-chip-purple { background: #F1E9FD; color: #7C3AED; }
.icon-chip-green  { background: #E4F8EC; color: #16A34A; }
.icon-chip-pink   { background: #FCE7F3; color: #DB2777; }
.icon-chip-orange { background: #FDECE0; color: #EA580C; }
.icon-chip-teal   { background: #E0F4F8; color: #0891B2; }

/* Hero device mockup */
.hero-section-v2 {
  background: linear-gradient(160deg, #F5F7FF 0%, #ffffff 55%);
  overflow: hidden;
}

.hero-mockup {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  opacity: .45;
  z-index: 0;
}
.hero-blob-1 { width: 220px; height: 220px; background: var(--brand-blue); top: 5%; inset-inline-start: 8%; }
.hero-blob-2 { width: 190px; height: 190px; background: var(--brand-purple); bottom: 5%; inset-inline-end: 5%; }

.device-stack {
  position: relative;
  width: 280px;
  height: 220px;
  z-index: 1;
}

.mockup-frame {
  position: absolute;
  background: #fff;
  border-radius: 1.1rem;
  border: 1px solid var(--brand-border);
  box-shadow: 0 25px 50px -25px rgba(15, 23, 42, .35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mockup-desktop {
  width: 220px; height: 150px;
  font-size: 2.75rem; color: var(--brand-blue);
  top: 0; inset-inline-start: 30px;
}
.mockup-tablet {
  width: 100px; height: 140px;
  font-size: 1.9rem; color: var(--brand-purple);
  bottom: -20px; inset-inline-start: 0;
}
.mockup-phone {
  width: 64px; height: 118px;
  font-size: 1.4rem; color: #16A34A;
  bottom: -30px; inset-inline-end: 10px;
}

/* Smart entry */
.smart-entry-section {
  background:
    linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.smart-entry-shell {
  display: grid;
  grid-template-columns: minmax(280px, .95fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: stretch;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px -42px rgba(15, 23, 42, .45);
  padding: 1rem;
}

.smart-entry-intro {
  min-height: 100%;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--brand-border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.smart-entry-intro h2 {
  max-width: 520px;
}

.smart-entry-intro p {
  line-height: 1.8;
}

.smart-entry-proof {
  display: grid;
  gap: .55rem;
  margin-top: 1.25rem;
  color: var(--brand-primary);
  font-size: .92rem;
  font-weight: 600;
}

.smart-entry-proof span {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.smart-entry-proof i {
  color: #16a34a;
}

.smart-entry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.smart-entry-action {
  min-height: 132px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-primary);
  text-decoration: none;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  gap: .85rem;
  padding: 1rem;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.smart-entry-action:hover {
  color: var(--brand-primary);
  transform: translateY(-3px);
  border-color: #bfdbfe;
  box-shadow: 0 18px 40px -28px rgba(15, 23, 42, .5);
}

.smart-entry-action-primary {
  background: #f5f8ff;
  border-color: #dbeafe;
}

.smart-entry-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--brand-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.smart-entry-action-primary .smart-entry-icon {
  background: var(--brand-gradient);
}

.smart-entry-action strong,
.smart-entry-action small {
  display: block;
}

.smart-entry-action strong {
  font-size: 1rem;
  margin-bottom: .35rem;
}

.smart-entry-action small {
  color: var(--brand-muted);
  line-height: 1.65;
}

.smart-entry-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Process steps */
.step-pill-v2 {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  background: #fff;
  text-align: center;
}
.step-number {
  width: 40px; height: 40px; margin-inline: auto;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* CTA band */
.cta-band {
  background: var(--brand-gradient);
  border-radius: 1.5rem;
}

/* Footer */
.footer-modern { background: var(--brand-light); border-top: 1px solid var(--brand-border); }
.footer-modern h6 { font-weight: 700; color: var(--brand-primary); margin-bottom: 1rem; }
.footer-modern .footer-link { color: #64748B; text-decoration: none; }
.footer-modern .footer-link:hover { color: var(--brand-blue); }

/* Systems store */
.systems-store-page { background: #f8fafc; }

.systems-store-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.systems-store-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

[dir="rtl"] .systems-store-layout { grid-template-columns: minmax(0, 1fr) 300px; }
[dir="rtl"] .systems-sidebar { grid-column: 2; }
[dir="rtl"] .systems-catalog { grid-column: 1; grid-row: 1; }

.systems-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 110px);
  overflow: hidden;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
}

.systems-sidebar-head {
  height: 52px;
  padding: 0 .9rem;
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  color: var(--brand-primary);
}

.systems-sidebar-list {
  max-height: calc(100vh - 164px);
  overflow-y: auto;
  padding: .45rem;
}

.system-nav-item {
  width: 100%;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .65rem;
  text-align: start;
}

.system-nav-item i {
  color: var(--brand-blue);
  font-size: 1.2rem;
}

.system-nav-item strong,
.system-nav-item small { display: block; }

.system-nav-item small {
  color: var(--brand-muted);
  font-size: .76rem;
  margin-top: .15rem;
}

.system-nav-item:hover,
.system-nav-item.active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.systems-catalog { display: grid; gap: 1rem; }

.erp-vision-panel,
.system-detail-stage {
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.erp-vision-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 1.2rem;
  padding: 1.2rem;
}

.erp-vision-panel h2 {
  color: var(--brand-primary);
  font-weight: 800;
  margin: .65rem 0 .55rem;
}

.erp-vision-panel p {
  color: var(--brand-muted);
  margin: 0;
  line-height: 1.8;
}

.erp-vision-grid { display: grid; gap: .65rem; }

.erp-vision-grid div {
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: .85rem;
  background: #f8fafc;
}

.erp-vision-grid strong,
.erp-vision-grid span { display: block; }

.erp-vision-grid strong { color: var(--brand-primary); margin-bottom: .25rem; }
.erp-vision-grid span { color: var(--brand-muted); font-size: .9rem; }
.system-detail-stage { overflow: hidden; }

.system-catalog-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 34%);
  gap: .85rem;
  overflow-x: auto;
  padding: 1rem;
  scroll-snap-type: x mandatory;
  background: linear-gradient(180deg, #eef6ff, #fff);
}

.catalog-frame {
  scroll-snap-align: start;
  min-height: 250px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.catalog-image-wrap {
  aspect-ratio: 16 / 9;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
}

.catalog-image-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.catalog-frame-missing-image .catalog-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.catalog-frame-missing-image .catalog-image-wrap::after {
  content: "أضف صورة الكتالوج هنا";
  color: var(--brand-muted);
  font-weight: 700;
}

.catalog-frame-missing-image .catalog-image-wrap img {
  display: none;
}

.catalog-frame-body { padding: .85rem; }
.catalog-frame-body strong { color: var(--brand-primary); font-size: 1.05rem; }
.catalog-frame-body p { color: var(--brand-muted); margin: .35rem 0 0; }

.system-detail-content {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(320px, 1.1fr);
  gap: 1rem;
  padding: 1rem;
}

.system-detail-summary {
  border-inline-end: 1px solid var(--brand-border);
  padding-inline-end: 1rem;
}

.system-detail-summary i {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: var(--brand-blue);
  font-size: 1.35rem;
}

.system-detail-summary h2 { color: var(--brand-primary); font-weight: 850; }
.system-detail-summary p { color: var(--brand-muted); line-height: 1.75; }

.system-problem {
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: .75rem;
  background: #f8fafc;
}

.system-info-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}

.system-info-columns section {
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: .95rem;
  background: #fff;
}

.system-info-columns h3 {
  color: var(--brand-primary);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: .65rem;
}

.system-info-columns ul {
  margin: 0;
  padding-inline-start: 1.2rem;
  color: var(--brand-muted);
}

.system-info-columns li + li { margin-top: .4rem; }

@media (max-width: 991.98px) {
  .systems-store-header,
  .systems-store-layout,
  [dir="rtl"] .systems-store-layout,
  .smart-entry-shell,
  .erp-vision-panel,
  .system-detail-content,
  .system-info-columns {
    grid-template-columns: 1fr;
  }

  .smart-entry-actions {
    grid-template-columns: 1fr;
  }

  .systems-store-header { align-items: flex-start; }
  [dir="rtl"] .systems-sidebar,
  [dir="rtl"] .systems-catalog {
    grid-column: auto;
    grid-row: auto;
  }

  .systems-sidebar {
    position: static;
    max-height: none;
  }

  .systems-sidebar-list { max-height: 320px; }

  .system-detail-summary {
    border-inline-end: 0;
    border-bottom: 1px solid var(--brand-border);
    padding-inline-end: 0;
    padding-bottom: 1rem;
  }
}

/* AI chat widget */
.ai-chat-widget {
  position: fixed;
  inset-inline-end: 1rem;
  bottom: 1rem;
  z-index: 1040;
}

.ai-chat-toggle,
.ai-chat-send,
.ai-chat-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
}

.ai-chat-toggle {
  min-width: 148px;
  height: 52px;
  border-radius: 999px;
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 16px 30px -16px rgba(31, 41, 55, .55);
  font-size: .95rem;
  font-weight: 700;
  gap: .45rem;
  padding: 0 1rem;
}

.ai-chat-panel {
  width: min(360px, calc(100vw - 2rem));
  height: min(520px, calc(100vh - 6rem));
  margin-bottom: .75rem;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px -28px rgba(15, 23, 42, .45);
  overflow: hidden;
}

.ai-chat-header {
  min-height: 64px;
  padding: .85rem 1rem;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ai-chat-title { font-weight: 700; }
.ai-chat-status { font-size: .82rem; opacity: .78; }

.ai-chat-icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.ai-chat-messages {
  height: calc(100% - 176px);
  overflow-y: auto;
  padding: 1rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.ai-chat-actions {
  min-height: 48px;
  padding: .5rem .75rem;
  border-top: 1px solid var(--brand-border);
  background: #fff;
}

.ai-chat-handoff {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-weight: 600;
  font-size: .86rem;
}

.ai-chat-handoff:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.ai-chat-message {
  max-width: 86%;
  padding: .65rem .8rem;
  border-radius: 8px;
  line-height: 1.55;
  font-size: .92rem;
  overflow-wrap: anywhere;
}

.ai-chat-message-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--brand-border);
}

.ai-chat-message-support {
  align-self: flex-start;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #064e3b;
}

.ai-chat-message-user {
  align-self: flex-end;
  background: var(--brand-blue);
  color: #fff;
}

.ai-chat-feedback {
  width: 100%;
  padding: .7rem;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: #fff;
}

.ai-chat-feedback-title {
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: .45rem;
}

.ai-chat-feedback-stars {
  display: flex;
  gap: .35rem;
  margin-bottom: .5rem;
}

.ai-chat-feedback-stars button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--brand-border);
  background: #f8fafc;
  color: var(--brand-text);
  font-weight: 700;
}

.ai-chat-feedback-stars button.is-selected {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #92400e;
}

.ai-chat-feedback-comment {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: .5rem;
  font-size: .86rem;
}

.ai-chat-feedback-submit {
  margin-top: .5rem;
  width: 100%;
  height: 34px;
  border-radius: 8px;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
}

.ai-chat-feedback-submit:disabled {
  opacity: .55;
}

.ai-chat-feedback-thanks {
  color: #047857;
  font-weight: 700;
}

.ai-chat-form {
  height: 64px;
  padding: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-top: 1px solid var(--brand-border);
  background: #fff;
}

.ai-chat-input {
  min-width: 0;
  flex: 1;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  padding: 0 .9rem;
}

.ai-chat-input:focus {
  outline: 0;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 .15rem rgba(47, 111, 237, .12);
}

.ai-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: var(--brand-primary);
  flex-shrink: 0;
}

.ai-chat-send:disabled,
.ai-chat-input:disabled {
  opacity: .65;
}

@media (max-width: 575.98px) {
  .ai-chat-widget {
    inset-inline: .75rem;
    bottom: .75rem;
  }

  .ai-chat-panel {
    width: 100%;
    height: min(480px, calc(100vh - 5rem));
  }
}

@media print {
  .ai-chat-widget {
    display: none !important;
  }
}
