/* Merso Modal Documentation Styles */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-card: #16161f;
  --border-color: #2a2a3a;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #6a6a7a;
  --accent-primary: #008C56;
  --accent-secondary: #00B36B;
  --accent-gradient: linear-gradient(135deg, #006B42 0%, #008C56 50%, #00B36B 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --font-main: 'Poppins', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* Animated background */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-text {
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-section {
  padding: 0.5rem 1.5rem;
  margin-top: 1rem;
}

.nav-section:first-child {
  margin-top: 0;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  margin: 0.15rem 0;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  font-weight: 500;
}

.nav-link-icon {
  font-size: 1rem;
  opacity: 0.8;
}

.nav-link.sub-link {
  padding-left: 2rem;
  font-size: 0.85rem;
}

.nav-link.sub-link .nav-link-icon {
  font-size: 0.9rem;
}

/* Main content */
.main {
  flex: 1;
  margin-left: 280px;
  min-height: 100vh;
}

.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 4rem;
}

/* Page Header */
.page-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-primary);
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-title-icon {
  font-size: 2rem;
}

.page-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

/* Hero section */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border-color);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

.hero-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
}

/* Section styles */
.section {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title-icon {
  font-size: 1.5rem;
}

.section-intro {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

/* Step headers */
.step-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.step-header .section-title {
  margin-bottom: 0;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Step cards */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.step-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.step-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.step-card-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
}

.step-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.step-card-content {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  padding-left: 3rem;
}

/* Feature list */
.feature-list {
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.feature-list li:last-child {
  border-bottom: none;
}

.feature-list .check {
  color: var(--success);
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.feature-list .feature-content {
  flex: 1;
}

.feature-list .feature-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.feature-list .feature-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Flow diagram */
.flow-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  min-width: 120px;
}

.flow-step-number {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.flow-step-title {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.flow-step-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 1.5rem;
}

/* Table styles */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

th:first-child {
  border-radius: 12px 0 0 0;
}

th:last-child {
  border-radius: 0 12px 0 0;
}

td {
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-card);
}

.badge {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-required {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.badge-optional {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

/* Code blocks */
code {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: #00D67E;
}

pre {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  margin: 1rem 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.code-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.code-block pre {
  border-radius: 0;
  margin: 0;
}

/* Callout */
.callout {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.callout-warning {
  border-left-color: var(--warning);
}

.callout-error {
  border-left-color: var(--error);
}

.callout-success {
  border-left-color: var(--success);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.callout-content {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.footer-nav-link {
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  min-width: 200px;
}

.footer-nav-link:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.footer-nav-link.prev {
  text-align: left;
}

.footer-nav-link.next {
  text-align: right;
}

.footer-nav-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.footer-nav-title {
  font-weight: 500;
  font-size: 0.95rem;
}

.footer-copyright {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-copyright a {
  color: var(--accent-primary);
  text-decoration: none;
}

.footer-copyright a:hover {
  text-decoration: underline;
}

/* Parameter list */
.param-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.param-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
}

.param-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.param-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: #00D67E;
}

.param-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.param-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.param-example {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.param-example code {
  color: var(--success);
}

/* Message type cards */
.message-type {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.message-type-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.message-type-icon {
  font-size: 1.25rem;
}

.message-type-name {
  font-family: var(--font-mono);
  font-weight: 500;
  color: #00D67E;
}

.message-type-direction {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.message-type-body {
  padding: 1.25rem;
}

.message-type-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Troubleshooting */
.trouble-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.trouble-header {
  padding: 1.25rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.trouble-title {
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.trouble-body {
  padding: 1.25rem;
}

.trouble-cause {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.trouble-solution {
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  padding: 1rem;
}

.trouble-solution-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--success);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 2rem;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .page-title {
    font-size: 2rem;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 1.5rem;
  }

  .hero {
    padding: 2rem 0;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .flow-steps {
    flex-direction: column;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .page-title {
    font-size: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .footer-nav {
    flex-direction: column;
  }

  .footer-nav-link {
    min-width: 100%;
  }
}

/* Subsection titles */
.subsection-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

/* Option titles (larger variant for A/B options) */
.option-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(99, 102, 241, 0.3);
}

/* ASCII Diagram Styles */
.ascii-diagram {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 0.75rem;
  overflow: hidden;
  margin: 1.5rem 0;
}

.ascii-diagram-title {
  background: rgba(99, 102, 241, 0.15);
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.75rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-primary);
  text-align: center;
  letter-spacing: 0.05em;
}

.ascii-diagram-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-secondary);
  padding: 1.5rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

.ascii-diagram-content::selection {
  background: rgba(99, 102, 241, 0.3);
}

/* Expandable nav links */
.nav-link-expandable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.nav-link-expandable .nav-link {
  flex: 1;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: transform 0.2s ease, color 0.2s ease;
  padding: 0;
  margin-right: 0.5rem;
}

.nav-toggle:hover {
  color: var(--accent-primary);
}

.nav-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.nav-toggle.expanded svg {
  transform: rotate(90deg);
}

.nav-subpages {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.nav-subpages.expanded {
  max-height: 500px;
}

/* ===== ARCHITECTURE DIAGRAMS ===== */
.architecture-diagram {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
  overflow-x: auto;
}

.diagram-layer {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
}

.diagram-layer:last-child {
  margin-bottom: 0;
}

.diagram-layer-title {
  position: absolute;
  top: -0.75rem;
  left: 1.5rem;
  background: var(--bg-primary);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  border-radius: 4px;
  border: 1px solid var(--border-primary);
}

.diagram-boxes {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.diagram-box {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 140px;
  transition: all 0.3s ease;
  position: relative;
}

.diagram-box:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
}

.diagram-box-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.diagram-box-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.diagram-box-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.diagram-box.highlight {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.diagram-box.highlight .diagram-box-title {
  color: var(--accent-primary);
}

/* Connector arrows */
.diagram-connector {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
  position: relative;
}

.diagram-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent-primary);
}

.diagram-arrow-line {
  width: 2px;
  height: 20px;
  background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
}

.diagram-arrow-head {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--accent-secondary);
}

/* Horizontal connections */
.diagram-box-connected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.diagram-connection-line {
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  position: relative;
}

.diagram-connection-line::before,
.diagram-connection-line::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
}

.diagram-connection-line::before {
  left: -3px;
}

.diagram-connection-line::after {
  right: -3px;
  background: var(--accent-secondary);
}

/* Box with bidirectional arrows */
.diagram-box-bidirectional {
  position: relative;
}

.diagram-box-bidirectional::after {
  content: '↔';
  position: absolute;
  right: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-primary);
  font-size: 1.2rem;
  font-weight: bold;
}

.diagram-box-bidirectional:last-child::after {
  display: none;
}

/* Layer colors */
.diagram-layer.layer-companies {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-secondary) 100%);
}

.diagram-layer.layer-companies .diagram-layer-title {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.diagram-layer.layer-protocol {
  border-color: rgba(139, 92, 246, 0.3);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, var(--bg-secondary) 100%);
}

.diagram-layer.layer-protocol .diagram-layer-title {
  color: var(--accent-primary);
  border-color: rgba(139, 92, 246, 0.3);
}

.diagram-layer.layer-blockchain {
  border-color: rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, var(--bg-secondary) 100%);
}

.diagram-layer.layer-blockchain .diagram-layer-title {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
}

.diagram-layer.layer-contracts {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-secondary) 100%);
}

.diagram-layer.layer-contracts .diagram-layer-title {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

/* ===== PAYMENT FLOW DIAGRAMS ===== */
.payment-flow-diagram {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
}

.payment-flow-diagram-title {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.flow-step-item {
  margin-bottom: 1.5rem;
}

.flow-step-item:last-child {
  margin-bottom: 0;
}

.flow-step-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flow-step-badge {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.flow-step-text {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
}

.flow-transfer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.flow-entity {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 140px;
  transition: all 0.3s ease;
}

.flow-entity:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
}

.flow-entity.highlight {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.flow-entity.success {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-secondary) 100%);
}

.flow-entity.warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, var(--bg-secondary) 100%);
}

.flow-entity.danger {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, var(--bg-secondary) 100%);
}

.flow-entity-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.flow-entity-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.flow-entity-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.flow-arrow-horizontal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.flow-arrow-horizontal .arrow-line {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  position: relative;
}

.flow-arrow-horizontal .arrow-line::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid var(--accent-secondary);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.flow-arrow-horizontal .arrow-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-primary);
  white-space: nowrap;
}

.flow-divider {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
}

.flow-divider-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent-primary);
}

.flow-divider-arrow .arrow-line {
  width: 2px;
  height: 20px;
  background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
}

.flow-divider-arrow .arrow-head {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--accent-secondary);
}

/* Final step with two rows */
.flow-transfer-dual {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.flow-transfer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

