/* E-Commerce middleware — bidirectional ART Admin flow (370px) */

.ecom-mw {
  --ink: #0f172a;
  --mute: #64748b;
  --out: #0000ff;
  --in: #16a34a;
  width: calc(100% + 1.5rem);
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  font-family: Poppins, sans-serif;
  color: var(--ink);
  overflow: hidden;
}

@media (min-width: 640px) {
  .ecom-mw {
    width: calc(100% + 2.5rem);
    margin-left: -1.25rem;
    margin-right: -1.25rem;
  }
}

.ecom-mw__kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  align-self: center;
  font-size: 8px;
  font-weight: 700;
  color: #0000ff;
}

.ecom-mw__pulse {
  width: 5.5px;
  height: 5.5px;
  border-radius: 999px;
  background: #0000ff;
  animation: ecom-mw-pulse 1.8s ease-out infinite;
}

.ecom-mw__legend {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.ecom-mw__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 6px;
  font-weight: 700;
  color: #475569;
}

.ecom-mw__legend-item i {
  width: 14px;
  height: 2px;
  border-radius: 2px;
}

.ecom-mw__legend-item--out i {
  background: var(--out);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.ecom-mw__legend-item--in i {
  background: var(--in);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.15);
}

.ecom-mw__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.28rem;
  padding: 0.05rem 0.1rem;
}

.ecom-mw__wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.ecom-mw__row {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
}

.ecom-mw__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06rem;
  padding: 0.26rem 0.24rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 0.55rem;
  box-shadow: 0 8px 14px -14px rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(3px);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.ecom-mw__node--market {
  border-radius: 0.75rem;
}

.ecom-mw__node.is-on {
  border-color: color-mix(in srgb, var(--node-color) 48%, #e2e8f0);
  box-shadow: 0 10px 16px -12px color-mix(in srgb, var(--node-color) 40%, transparent);
  transform: translateY(-1px);
}

.ecom-mw__proto {
  font-size: 5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--node-color);
  background: var(--node-bg);
  border-radius: 999px;
  padding: 0.06rem 0.3rem;
}

.ecom-mw__node strong {
  font-size: 7px;
  font-weight: 800;
  line-height: 1.1;
}

.ecom-mw__node small {
  font-size: 5px;
  font-weight: 500;
  color: var(--mute);
  line-height: 1.15;
}

.ecom-mw__flow-tags {
  display: flex;
  gap: 0.18rem;
  margin-top: 0.08rem;
}

.ecom-mw__tag {
  font-size: 5px;
  font-weight: 800;
  line-height: 1.2;
  padding: 0.06rem 0.26rem;
  border-radius: 999px;
}

.ecom-mw__tag--out {
  color: #0000ff;
  background: #dbeafe;
}

.ecom-mw__tag--in {
  color: #15803d;
  background: #dcfce7;
}

.ecom-mw__mid {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
}

.ecom-mw__hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.04rem;
  min-width: 150px;
  padding: 0.34rem 0.65rem;
  border-radius: 0.6rem;
  color: #fff;
  background: linear-gradient(145deg, #4d4dff 0%, #0000ff 48%, #0000cc 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 0 3px rgba(0, 0, 255, 0.1),
    0 10px 18px -12px rgba(0, 0, 255, 0.45);
  text-align: center;
}

.ecom-mw__hub-label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
}

.ecom-mw__hub-sub {
  font-size: 5.4px;
  font-weight: 600;
  opacity: 0.92;
}

.ecom-mw__caps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.22rem;
  width: 100%;
}

.ecom-mw__cap {
  display: flex;
  align-items: center;
  gap: 0.24rem;
  padding: 0.22rem 0.26rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 0.45rem;
  min-width: 0;
  backdrop-filter: blur(3px);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.ecom-mw__cap.is-on {
  border-color: color-mix(in srgb, var(--cap-color) 45%, #e2e8f0);
  box-shadow: 0 8px 14px -12px color-mix(in srgb, var(--cap-color) 40%, transparent);
  transform: translateY(-1px);
}

.ecom-mw__cap-ico {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0.3rem;
  display: grid;
  place-items: center;
  color: var(--cap-color);
  background: var(--cap-bg);
}

.ecom-mw__cap-ico svg {
  width: 0.65rem;
  height: 0.65rem;
}

.ecom-mw__cap-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
}

.ecom-mw__cap-text strong {
  font-size: 6px;
  font-weight: 800;
  line-height: 1.1;
}

.ecom-mw__cap-text small {
  font-size: 4.8px;
  font-weight: 500;
  color: var(--mute);
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ecom-mw__wire-label {
  font-size: 5.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ecom-mw__dash-out {
  animation: ecom-mw-dash 4.2s linear infinite;
}

.ecom-mw__dash-in {
  animation: ecom-mw-dash-rev 4.2s linear infinite;
}

@keyframes ecom-mw-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 0, 255, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(0, 0, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 255, 0); }
}

@keyframes ecom-mw-dash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -100; }
}

@keyframes ecom-mw-dash-rev {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 100; }
}

@media (max-width: 420px) {
  .ecom-mw__caps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ecom-mw__node small,
  .ecom-mw__flow-tags { display: none; }
  .ecom-mw__hub { min-width: 120px; }
}
