/* ── Isolated Diagram Styles ───────────────────────────────────────────── */
:root {
  --primary: #3e4fe0;
  --merchant: #8b5cf6;
  --yuno: #c4b5fd;
  --text: #0a0a0a;
  --slate: #64748b;
  --bg: #f5f5f5;
}

/* Use specific class to prevent global leaks if accidentally loaded */
body.is-diagram {
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
  font-family: 'Geist', sans-serif;
  margin: 0;
  padding: 0;
}

body.is-diagram * {
  box-sizing: border-box;
}

body.is-diagram .viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg);
  cursor: zoom-in;
}

/* Hide expand hint and remove zoom cursor when loaded internally */
body.in-lightbox .viewport {
  cursor: default;
}
body.in-lightbox .expand-hint {
  display: none !important;
}

body.is-diagram .diagram {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  background: var(--bg);
  overflow: hidden;
}

body.is-diagram .expand-hint {
  position: fixed;
  bottom: 12px;
  right: 12px;
  background: rgba(62, 79, 224, 0.85);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  backdrop-filter: blur(6px);
  z-index: 999;
  letter-spacing: 0.01em;
}

body.is-diagram .viewport:hover .expand-hint {
  opacity: 1;
}

/* Isolated SVG rule */
body.is-diagram .diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Shared Component Styles ────────────────────────────────────────── */

body.is-diagram .lane-label-container {
  position: absolute;
  left: 40px;
  width: 141px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

body.is-diagram .diagram .lane-icon,
body.is-diagram .lane-icon {
  width: 22px;
  height: 22px;
  color: var(--slate);
  opacity: 0.8;
}

body.is-diagram .lane-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

body.is-diagram .step,
body.is-diagram .step-content { 
  position: absolute; 
  width: 104px; 
  height: 98px; 
  background: #ffffff; 
  border: 1.5px solid var(--primary); 
  border-radius: 8px; 
  box-shadow: -4px -4px 10px 0 #ffffff, 4px 4px 8px 0 rgba(0,0,0,0.10); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  padding: 10px 8px; 
  font-size: 12px; 
  font-weight: 600; 
  color: var(--text); 
  text-align: center; 
  line-height: 1.25;
  z-index: 2;
}

body.is-diagram .step.merchant-server,
body.is-diagram .merchant-server .step-content { border-color: var(--merchant); } 

body.is-diagram .step.yuno-server,
body.is-diagram .yuno-server .step-content { border-color: var(--yuno); }

body.is-diagram .step.yuno-sdk,
body.is-diagram .yuno-sdk .step-content { border-color: var(--primary); }

body.is-diagram .bubble {
  position: absolute; 
  top: -10px; 
  left: -10px; 
  width: 20px; 
  height: 20px;
  background: var(--primary); 
  color: #fff; 
  border-radius: 999px;
  font-size: 10px; 
  font-weight: 700; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15); 
  z-index: 3;
}

body.is-diagram .bubble-badge {
  width: 20px; 
  height: 20px;
  background: var(--primary); 
  color: #fff; 
  border-radius: 999px;
  font-size: 10px; 
  font-weight: 700; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15); 
}

body.is-diagram .merchant-server .bubble,
body.is-diagram .merchant-server .bubble-badge { background: var(--merchant); }
body.is-diagram .yuno-server .bubble,
body.is-diagram .yuno-server .bubble-badge { background: #9b72cf; opacity: 0.9; }

body.is-diagram .dot { 
  position: absolute; 
  width: 6px; 
  height: 6px; 
  background: var(--primary); 
  border-radius: 99px; 
}
body.is-diagram .dot.top { top: -3px; left: calc(50% - 3px); }
body.is-diagram .dot.bottom { bottom: -3px; left: calc(50% - 3px); }
body.is-diagram .dot.left { left: -3px; top: calc(50% - 3px); }
body.is-diagram .dot.right { right: -3px; top: calc(50% - 3px); }

body.is-diagram .layer-svg { 
  position: absolute; 
  inset: 0; 
  pointer-events: none; 
}

body.is-diagram .continue-block {
  position: absolute; 
  border: 2px dashed var(--slate); 
  border-radius: 12px; 
  opacity: 0.6;
  pointer-events: none; 
  z-index: 1;
}

body.is-diagram .continue-label {
  position: absolute; 
  top: -14px; 
  left: 20px; 
  background: var(--bg); 
  padding: 2px 8px; 
  font-size: 10px; 
  font-weight: 700; 
  color: var(--slate); 
  border: 1px solid var(--slate); 
  border-radius: 4px;
  white-space: nowrap;
}
