/* Flexible packaging simulation view, isolated from global map node classes. */

.app-shell[data-active-view="simulation"] .flexible-packaging-view,
.app-shell[data-active-view="inbound"] .flexible-packaging-view,
.app-shell[data-active-view="twin"] .flexible-packaging-view,
.app-shell[data-active-view="sorting"] .flexible-packaging-view {
  display: none;
}

.app-shell[data-active-view="packing"] .decision-grid,
.app-shell[data-active-view="packing"] .insight-grid,
.app-shell[data-active-view="packing"] .digital-twin-view,
.app-shell[data-active-view="packing"] .inbound-identity-view,
.app-shell[data-active-view="packing"] .visual-sorting-view {
  display: none;
}

.flexible-packaging-view {
  margin-top: 16px;
}

.pack-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 252, 247, 0.94)),
    #ffffff;
  box-shadow: 0 14px 36px rgba(9, 24, 44, 0.1);
}

.pack-hero h2 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: clamp(1.5rem, 2vw, 2rem);
  letter-spacing: 0;
}

.pack-hero p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.pack-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid rgba(14, 165, 132, 0.32);
  border-radius: var(--radius);
  background: #ecfdf5;
  color: #047857;
  font-weight: 950;
  white-space: nowrap;
}

.pack-status-pill span {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.13);
}

.pack-status-pill.is-blocked {
  border-color: rgba(225, 75, 75, 0.28);
  background: #fff1f0;
  color: #a62626;
}

.pack-status-pill.is-blocked span {
  background: var(--alert);
  box-shadow: 0 0 0 6px rgba(225, 75, 75, 0.12);
}

.pack-layout {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 370px;
  gap: 16px;
  align-items: start;
}

.pack-stage-card,
.pack-console .panel {
  border: 1px solid rgba(9, 24, 44, 0.1);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pack-stage-card {
  min-width: 0;
  padding: 16px;
}

.pack-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.pack-stage-head h2,
.pack-console h2 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.pack-score {
  display: grid;
  min-width: 136px;
  padding: 10px 12px;
  border: 1px solid rgba(14, 165, 132, 0.25);
  border-radius: var(--radius);
  background: #f2fffb;
}

.pack-score span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.pack-score strong {
  color: #047857;
  font-size: 1.8rem;
  line-height: 1;
}

.pack-scene {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: var(--radius);
  background: #e7f4f6;
}

.pack-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(6, 31, 57, 0.07), rgba(6, 31, 57, 0) 46%, rgba(255, 255, 255, 0.12)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(5, 46, 54, 0.1));
  pointer-events: none;
}

.pack-scene-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.pack-camera-tag,
.pack-result-card,
.pack-material-card,
.pack-measure-box,
.pack-material-zone {
  position: absolute;
  z-index: 5;
}

.pack-camera-tag {
  top: 112px;
  left: 12%;
  padding: 8px 11px;
  border: 1px solid rgba(20, 194, 204, 0.3);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: #075985;
  font-size: 0.82rem;
  font-weight: 950;
  box-shadow: 0 12px 26px rgba(9, 24, 44, 0.13);
}

.pack-measure-box,
.pack-material-zone {
  border: 2px solid rgba(20, 194, 204, 0.76);
  border-radius: 8px;
  background: rgba(20, 194, 204, 0.08);
  box-shadow: 0 0 0 6px rgba(20, 194, 204, 0.08), 0 0 24px rgba(20, 194, 204, 0.2);
  opacity: 0;
  transition: opacity 180ms ease, border-color 180ms ease, background 180ms ease;
}

.pack-measure-box span,
.pack-material-zone span {
  position: absolute;
  top: -32px;
  left: 0;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #075985;
  font-size: 0.75rem;
  font-weight: 950;
  white-space: nowrap;
}

.pack-measure-box {
  left: 7%;
  top: 48%;
  width: 32%;
  height: 20%;
}

.pack-material-zone.paper {
  left: 43%;
  top: 16%;
  width: 14%;
  height: 27%;
  border-color: rgba(180, 117, 49, 0.72);
  background: rgba(180, 117, 49, 0.08);
}

.pack-material-zone.air {
  left: 59%;
  top: 15%;
  width: 18%;
  height: 34%;
  border-color: rgba(11, 92, 173, 0.72);
  background: rgba(11, 92, 173, 0.08);
}

.pack-material-zone.seal {
  left: 70%;
  top: 52%;
  width: 24%;
  height: 18%;
  border-color: rgba(16, 185, 129, 0.72);
  background: rgba(16, 185, 129, 0.08);
}

.pack-scene.pack-measure .pack-measure-box,
.pack-scene.pack-fit .pack-measure-box,
.pack-scene.pack-cushion .pack-measure-box,
.pack-scene.pack-seal .pack-measure-box,
.pack-scene.pack-label .pack-measure-box,
.pack-scene.pack-blocked .pack-measure-box,
.pack-scene.pack-cushion.case-compact .pack-material-zone.paper,
.pack-scene.pack-label.case-compact .pack-material-zone.paper,
.pack-scene.pack-cushion.case-fragile .pack-material-zone.air,
.pack-scene.pack-label.case-fragile .pack-material-zone.air,
.pack-scene.pack-cushion.case-cold .pack-material-zone.air,
.pack-scene.pack-label.case-cold .pack-material-zone.air,
.pack-scene.pack-cushion.case-odd .pack-material-zone.paper,
.pack-scene.pack-label.case-odd .pack-material-zone.paper,
.pack-scene.pack-seal .pack-material-zone.seal,
.pack-scene.pack-label .pack-material-zone.seal,
.pack-scene.pack-blocked .pack-material-zone.paper,
.pack-scene.pack-blocked .pack-material-zone.air {
  opacity: 1;
}

.pack-scan-grid {
  position: absolute;
  z-index: 4;
  left: 6%;
  top: 12%;
  width: 34%;
  height: 45%;
  opacity: 0;
  background:
    linear-gradient(rgba(20, 194, 204, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 194, 204, 0.3) 1px, transparent 1px),
    linear-gradient(120deg, rgba(20, 194, 204, 0.24), rgba(20, 194, 204, 0));
  background-size: 24px 24px, 24px 24px, 100% 100%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  pointer-events: none;
}

.pack-scene.pack-measure .pack-scan-grid,
.pack-scene.pack-fit .pack-scan-grid,
.pack-scene.pack-blocked .pack-scan-grid {
  opacity: 1;
  animation: packScanPulse 1.35s ease-in-out infinite;
}

.pack-result-card,
.pack-material-card {
  width: 220px;
  padding: 12px;
  border: 1px solid rgba(14, 116, 144, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(9, 24, 44, 0.12);
}

.pack-result-card {
  left: 28px;
  bottom: 30px;
}

.pack-material-card {
  right: 30px;
  top: 30px;
  border-color: rgba(16, 185, 129, 0.34);
  background: rgba(236, 253, 245, 0.88);
}

.pack-result-card p,
.pack-material-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pack-result-card strong,
.pack-material-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.pack-scene.pack-blocked .pack-result-card {
  border-color: rgba(225, 75, 75, 0.35);
  background: #fff5f3;
}

.pack-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.pack-flow li {
  min-height: 74px;
  padding: 10px;
  border: 1px solid rgba(9, 24, 44, 0.09);
  border-radius: var(--radius);
  background: #f7fbff;
  color: #31516b;
}

.pack-flow li.is-active {
  border-color: rgba(14, 116, 144, 0.36);
  background: #ecfeff;
  box-shadow: inset 0 0 0 2px rgba(14, 116, 144, 0.08);
}

.pack-flow li.is-done {
  border-color: rgba(39, 189, 117, 0.28);
  background: #f0fbf5;
}

.pack-flow li.is-error {
  border-color: rgba(225, 75, 75, 0.32);
  background: #fff5f3;
}

.pack-flow span {
  display: block;
  margin-bottom: 6px;
  color: #047857;
  font-size: 0.74rem;
  font-weight: 950;
}

.pack-flow strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.35;
}

.pack-lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.pack-lesson-grid article {
  min-height: 104px;
  padding: 12px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #fbfdff;
}

.pack-lesson-grid span {
  display: block;
  margin-bottom: 6px;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 950;
}

.pack-lesson-grid p {
  margin: 0;
  color: var(--dock-slate);
  font-size: 0.9rem;
  line-height: 1.5;
}

.pack-console {
  display: grid;
  gap: 12px;
}

.pack-console .panel {
  padding: 14px;
}

.pack-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pack-data-grid article {
  display: grid;
  min-height: 82px;
  align-content: center;
  padding: 10px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #f7fbff;
}

.pack-data-grid span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.pack-data-grid strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.05rem;
}

.pack-reason-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

#packingModeBadge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.74rem;
  font-weight: 950;
  white-space: nowrap;
}

.pack-reason-panel.is-risk #packingModeBadge {
  background: #fff4e5;
  color: #9a5400;
}

.pack-reason-panel.is-blocked #packingModeBadge {
  background: #fff1f0;
  color: #a62626;
}

.pack-check-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.pack-check-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(9, 24, 44, 0.08);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--dock-slate);
  font-size: 0.88rem;
  font-weight: 800;
}

.pack-check-list span {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #b8c5d2;
}

.pack-check-list li.is-pass span {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(39, 189, 117, 0.1);
}

.pack-check-list li.is-fail span {
  background: var(--alert);
  box-shadow: 0 0 0 5px rgba(225, 75, 75, 0.1);
}

#packingReasonText {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  background: #fff9eb;
  color: #684608;
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.45;
}

@keyframes packScanPulse {
  0%,
  100% {
    filter: saturate(1);
    transform: scale(0.98);
  }
  50% {
    filter: saturate(1.2);
    transform: scale(1.02);
  }
}

@media (max-width: 1180px) {
  .pack-layout {
    grid-template-columns: 1fr;
  }

  .pack-console {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pack-reason-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .pack-hero,
  .pack-stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .pack-scene {
    min-height: 620px;
  }

  .pack-flow,
  .pack-lesson-grid,
  .pack-console {
    grid-template-columns: 1fr;
  }

  .pack-camera-tag {
    left: 14%;
    top: 94px;
  }

  .pack-result-card,
  .pack-material-card {
    width: 190px;
  }
}

@media (max-width: 520px) {
  .pack-data-grid {
    grid-template-columns: 1fr;
  }
}
