/* ==========================================================================
   CONSTELLATION NETWORK STYLING - 19 NODES INTERACTIVE CENTERPIECE
   ========================================================================== */

.constellation-wrapper {
  position: relative;
  width: 100%;
  max-width: 1300px;
  min-height: 800px;
  margin: 1rem auto 3rem;
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

/* Background Animated Canvas for Star Dust & Light Rays */
#particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* SVG Connection Lines Overlay */
.network-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.network-svg-layer line {
  stroke: rgba(212, 175, 55, 0.22);
  stroke-width: 1.2;
  stroke-dasharray: 4 6;
  animation: strokeDash 25s linear infinite;
  transition: all 0.4s ease;
}

.network-svg-layer line.highlighted {
  stroke: #FFDF73;
  stroke-width: 2.2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 8px rgba(255, 223, 115, 0.9));
}

@keyframes strokeDash {
  to { stroke-dashoffset: -100; }
}

/* Center Emblem Node (Đại hội VII) */
.center-congress-node {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #D4AF37 0%, #997A15 50%, #47080D 100%);
  border: 3px solid #FFF1B8;
  box-shadow: 
    0 0 35px rgba(212, 175, 55, 0.6),
    0 0 80px rgba(181, 18, 27, 0.4),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 15px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.center-congress-node::before {
  content: "";
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
  border-radius: 50%;
  border: 1px dashed rgba(212, 175, 55, 0.5);
  animation: rotateCenterRing 40s linear infinite;
}

.center-congress-node::after {
  content: "";
  position: absolute;
  top: -24px;
  left: -24px;
  right: -24px;
  bottom: -24px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.2);
  animation: pulseAura 4s ease-in-out infinite alternate;
}

@keyframes rotateCenterRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseAura {
  0% { transform: scale(0.98); opacity: 0.3; }
  100% { transform: scale(1.05); opacity: 0.8; }
}

.center-node-icon {
  width: 42px;
  height: 42px;
  fill: #FFFFFF;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
  margin-bottom: 6px;
}

.center-node-title {
  font-family: var(--font-decorative);
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.2;
}

.center-node-sub {
  font-family: var(--font-serif-title);
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFF2C6;
  margin-top: 3px;
}

/* 19 Outer Nodes Container */
.network-nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
}

/* Single Interactive Node */
.network-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9B111E 0%, #5E080F 70%, #2A0406 100%);
  border: 2px solid var(--color-gold-champagne);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(212, 175, 55, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  user-select: none;
}

.network-node:hover,
.network-node.highlighted {
  transform: translate(-50%, -50%) scale(1.22);
  border-color: #FFF4C2;
  background: radial-gradient(circle at 35% 30%, #C8102E 0%, #8A0E17 70%, #4E0A0F 100%);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.8), 0 0 15px #C8102E;
  z-index: 1000;
}

.network-node.read {
  border-color: #E5C365;
}

.network-node.read::after {
  content: "✓";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #D4AF37;
  color: #2A0508;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #FFFFFF;
}

.node-num {
  font-family: var(--font-decorative);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--color-gold-light);
  line-height: 1;
}

.node-icon-flag {
  font-size: 1.1rem;
  margin-top: 1px;
  line-height: 1;
}

.node-label-abbr {
  font-size: 0.68rem;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-width: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Hover Preview Card (Tooltip) */
.node-tooltip {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 300px;
  background: rgba(28, 3, 6, 0.98);
  border: 1.5px solid var(--color-gold-champagne);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9), 0 0 25px rgba(212, 175, 55, 0.35);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  text-align: left;
}

.network-node:hover .node-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Smart bottom tooltip for nodes in the upper hemisphere */
.node-tooltip.tooltip-bottom {
  bottom: auto;
  top: 80px;
  transform: translateX(-50%) translateY(-10px);
}

.network-node:hover .node-tooltip.tooltip-bottom {
  transform: translateX(-50%) translateY(0);
}

.tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.tooltip-num {
  font-family: var(--font-decorative);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-gold-champagne);
  letter-spacing: 1px;
}

.tooltip-flag {
  font-size: 1rem;
}

.tooltip-org {
  font-family: var(--font-serif-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.3;
  margin-bottom: 6px;
}

.tooltip-sender {
  font-size: 0.78rem;
  color: var(--color-gold-light);
  font-weight: 600;
  margin-bottom: 4px;
}

.tooltip-quote {
  font-family: var(--font-serif-body);
  font-size: 0.78rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
  margin-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  padding-top: 6px;
}

.tooltip-cta {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-gold-champagne);
  margin-top: 8px;
  letter-spacing: 0.5px;
}

/* Mobile & Tablet Grid Alternative View for easy browsing */
.mobile-network-grid {
  display: none;
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
  position: relative;
  z-index: 10;
}

.mobile-letter-card {
  background: rgba(45, 6, 10, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mobile-letter-card:active {
  transform: scale(0.98);
  background: rgba(75, 10, 15, 0.95);
  border-color: var(--color-gold-champagne);
}

.mobile-card-emblem {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-red-primary);
  border: 1.5px solid var(--color-gold-champagne);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-decorative);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-gold-light);
}

.mobile-card-content {
  flex-grow: 1;
}

.mobile-card-title {
  font-family: var(--font-serif-title);
  font-size: 1rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.3;
  margin-bottom: 4px;
}

.mobile-card-sender {
  font-size: 0.82rem;
  color: var(--color-gold-light);
  margin-bottom: 4px;
}

.mobile-card-quote {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  font-style: italic;
  line-height: 1.4;
}

/* Switch between Constellation and Cards toggle */
.view-switch-ctrl {
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 10;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 4, 7, 0.8);
  border: 1px solid var(--color-gold-champagne);
  color: var(--color-gold-light);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.view-toggle-btn:hover {
  background: var(--color-gold-champagne);
  color: #2A0508;
}

/* Responsive Handling */
@media (max-width: 900px) {
  .constellation-wrapper {
    min-height: 650px;
  }
  .center-congress-node {
    width: 160px;
    height: 160px;
    padding: 10px;
  }
  .network-node {
    width: 58px;
    height: 58px;
  }
  .node-num {
    font-size: 0.85rem;
  }
}

@media (max-width: 640px) {
  .constellation-wrapper {
    display: none;
  }
  .mobile-network-grid {
    display: grid;
  }
  .view-switch-ctrl {
    display: none;
  }
}
