/* Theme overlay on top of Bootstrap 5 RTL - fonts, brand color, elevation, and the few
   components Bootstrap has no equivalent for (connected stage timeline, KPI icon tiles).
   Bootstrap itself supplies the base component mechanics (cards, badges, buttons, forms). */

:root {
  --bs-border-radius: .65rem;
  --bs-border-radius-sm: .5rem;
  --bs-border-radius-lg: .9rem;
  --bs-border-radius-xl: 1.1rem;

  --brand-indigo: #7B2CBF;
  --brand-indigo-deep: #55208A;
  --brand-indigo-subtle: #F1E4FA;
  --brand-rust: #B15A2B;
  --brand-rust-subtle: #F5E5D7;
  --brand-ink: #1E1B33;

  --shadow-sm: 0 1px 2px rgba(30,27,51,.05), 0 1px 1px rgba(30,27,51,.04);
  --shadow-md: 0 10px 26px -6px rgba(30,27,51,.14), 0 2px 8px rgba(30,27,51,.06);
  --shadow-lg: 0 22px 50px -10px rgba(30,27,51,.22);
}

* { scrollbar-width: thin; }

html, body { height: 100%; }

body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  color: var(--brand-ink);
  background:
    radial-gradient(1100px 480px at 92% -8%, rgba(74,58,196,.07), transparent 60%),
    radial-gradient(900px 420px at -6% 12%, rgba(177,90,43,.05), transparent 55%),
    #EFF0EA;
  background-attachment: fixed;
}

h1, h2, h3, h4, .brand-font {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  font-weight: 700;
  text-wrap: balance;
  letter-spacing: -.01em;
}
h1 { font-weight: 800; }

.font-mono { font-family: 'IBM Plex Mono', Consolas, monospace; font-variant-numeric: tabular-nums; }

a { transition: color .15s; }

/* ============ top navbar ============ */

.navbar-brand-bar {
  background: linear-gradient(100deg, #3D1361, #7B2CBF 62%, #A855D6);
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 6px 24px rgba(36,26,107,.3);
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.navbar-brand-bar .navbar-brand { color: #fff; font-size: 17px; letter-spacing: -.01em; }
.navbar-brand-bar .nav-link {
  color: rgba(255,255,255,.68) !important;
  font-weight: 500;
  border-radius: var(--bs-border-radius-sm);
  padding: .55rem 1rem;
  transition: background .15s, color .15s;
}
.navbar-brand-bar .nav-link.active { color: #fff !important; background: rgba(255,255,255,.14); font-weight: 600; }
.navbar-brand-bar .nav-link:hover { color: #fff !important; background: rgba(255,255,255,.08); }
.navbar-brand-bar .brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.14);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.navbar-toggler { border-color: rgba(255,255,255,.3); box-shadow: none !important; }
.navbar-toggler-icon { filter: invert(1) grayscale(1) brightness(2); }

/* ============ elevation ============ */

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.card { border-radius: var(--bs-border-radius-lg); }
.card.shadow-sm:hover { box-shadow: var(--shadow-md) !important; }

/* ============ brand color utilities ============ */

.border-start-indigo { border-inline-start: 4px solid var(--brand-indigo) !important; }
.border-start-rust { border-inline-start: 4px solid var(--brand-rust) !important; }
.border-start-success { border-inline-start: 4px solid var(--bs-success) !important; }
.border-end-indigo { border-inline-end: 3px solid var(--brand-indigo) !important; }
.border-end-rust { border-inline-end: 3px solid var(--brand-rust) !important; }
.border-end-success { border-inline-end: 3px solid var(--bs-success) !important; }

.text-indigo { color: var(--brand-indigo) !important; }
.bg-indigo { background-color: var(--brand-indigo) !important; }
.bg-indigo-subtle { background-color: var(--brand-indigo-subtle) !important; }
.text-rust { color: var(--brand-rust) !important; }
.bg-rust-subtle { background-color: var(--brand-rust-subtle) !important; }
.text-bg-indigo { background-color: var(--brand-indigo) !important; color: #fff !important; }

.btn { font-weight: 600; transition: transform .08s, box-shadow .15s, background .15s, border-color .15s; }
.btn:active { transform: translateY(1px); }
.btn-indigo { background: var(--brand-indigo); border-color: var(--brand-indigo); color: #fff; box-shadow: var(--shadow-sm); }
.btn-indigo:hover { background: var(--brand-indigo-deep); border-color: var(--brand-indigo-deep); color: #fff; box-shadow: var(--shadow-md); }
.btn-success { box-shadow: var(--shadow-sm); }
.btn-success:hover { box-shadow: var(--shadow-md); }
.btn-lg { border-radius: var(--bs-border-radius); }

/* ============ dashboard hero stats ============ */

.hero-stat {
  border-radius: var(--bs-border-radius-lg);
  border-inline-start: 5px solid transparent !important;
  background: #fff;
}
.hero-stat .card-body { padding: 1.5rem 1.4rem; }
.hero-stat-indigo { border-inline-start-color: var(--brand-indigo) !important; background: linear-gradient(135deg, #fff 55%, var(--brand-indigo-subtle)); }
.hero-stat-rust { border-inline-start-color: var(--brand-rust) !important; background: linear-gradient(135deg, #fff 55%, var(--brand-rust-subtle)); }
.hero-stat-success { border-inline-start-color: var(--bs-success) !important; background: linear-gradient(135deg, #fff 55%, #DCF1E3); }
.hero-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: rgba(30,27,51,.05); color: var(--brand-ink);
}
.hero-stat-indigo .hero-icon { background: var(--brand-indigo-subtle); color: var(--brand-indigo); }
.hero-stat-rust .hero-icon { background: var(--brand-rust-subtle); color: var(--brand-rust); }
.hero-stat-success .hero-icon { background: #DCF1E3; color: var(--bs-success); }
.hero-label { font-size: 13px; color: #6B6F82; font-weight: 600; margin-bottom: 2px; }
.hero-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; }

.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); margin-inline-end: .35rem; }

/* ============ KPI tiles ============ */

.kpi-card { border-radius: var(--bs-border-radius-lg); }
.kpi-icon {
  width: 42px; height: 42px; border-radius: var(--bs-border-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.kpi-icon.i-indigo { background: var(--brand-indigo-subtle); color: var(--brand-indigo); }
.kpi-icon.i-rust { background: var(--brand-rust-subtle); color: var(--brand-rust); }
.kpi-icon.i-success { background: #DCF1E3; color: var(--bs-success); }
.kpi-icon.i-muted { background: #EFEFEA; color: #8A8FA3; }

/* ============ connected stage timeline (no Bootstrap equivalent) ============ */

.stage-flow { display: flex; align-items: flex-start; overflow-x: auto; padding: 6px 2px 6px; }
.stage-node { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 100px; position: relative; }
.stage-node .dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #F5F5F0; border: 2px solid #DEDCD0;
  color: #9297AC;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600;
  margin-bottom: 9px;
  z-index: 1;
  transition: background .2s, border-color .2s;
}
.stage-node.done .dot { background: var(--bs-success); border-color: var(--bs-success); color: #fff; box-shadow: 0 3px 10px -2px rgba(46,125,82,.5); }
.stage-node.chem .dot { box-shadow: 0 0 0 4px var(--brand-indigo-subtle); }
.stage-node.chem.done .dot { box-shadow: 0 0 0 4px var(--brand-indigo-subtle), 0 3px 10px -2px rgba(46,125,82,.5); }
.stage-node .connector {
  position: absolute; top: 18px; height: 2px; background: #DEDCD0;
  right: 50%; width: 100%; z-index: 0;
}
.stage-node:first-child .connector { display: none; }
.stage-node.done .connector { background: var(--bs-success); }
.stage-node .label { font-size: 12.5px; font-weight: 600; line-height: 1.3; padding: 0 4px; }
.stage-node .chem-tag {
  font-size: 9.5px; color: var(--brand-indigo); font-weight: 700; margin-top: 3px;
  text-transform: uppercase; letter-spacing: .04em;
}

/* ============ order cards ============ */

.order-card-link { transition: transform .12s, box-shadow .15s; }
.order-card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }

/* ============ forms ============ */

.checkbox-grid .form-check {
  border: 1px solid #DEDCD0; border-radius: var(--bs-border-radius-sm); padding: .7rem .95rem .7rem 2.3rem;
  background: #fff; margin: 0; transition: border-color .15s, background .15s;
}
.checkbox-grid .form-check:has(input:checked) { border-color: var(--brand-indigo); background: var(--brand-indigo-subtle); }
.form-control, .form-select {
  border-radius: var(--bs-border-radius-sm);
  border-color: #DDDBD0;
  padding-top: .6rem; padding-bottom: .6rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-indigo);
  box-shadow: 0 0 0 .2rem var(--brand-indigo-subtle);
}
.form-label { font-size: 13.5px; font-weight: 600; color: #4A4E63; }

/* ============ data rows ============ */

.data-row-icon {
  width: 36px; height: 36px; border-radius: var(--bs-border-radius-sm);
  background: #F5F5F0; border: 1px solid #E9E7DB;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 15px;
}
.list-group-item { border-color: #ECEAE0 !important; }

/* ============ alerts ============ */

.alert { border: none; border-radius: var(--bs-border-radius); }
.alert-warning { background: var(--brand-rust-subtle); color: #7A431E; }
.alert-warning strong { color: var(--brand-rust); }
.alert-danger { background: var(--brand-rust-subtle); color: #7A431E; }
.alert-success { background: #DCF1E3; color: #1F5636; }

/* ============ badges ============ */

.badge { font-weight: 600; letter-spacing: .01em; }
.badge.rounded-pill { padding-inline: .8em; }

hr { opacity: .1; }
