.top-panel {
    width: 100%;
    padding: 1.2em 1.5em;
    background: #f5faff;
    border-radius: 12px;
    margin-bottom: 1.5em;
    box-shadow: 0 2px 8px rgba(30, 40, 70, 0.08);
    color: #1a2233;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.top-panel h3 {
    margin-bottom: 0.4em;
    font-size: 1.3em;
    color: #1766A3;
}

.filters {
    margin-bottom: 0; 
}

.filters button {
    background-color: #007AFF;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    margin: 0 3px;
    transition: background-color 0.2s ease;
}

.filters button:hover {
    background-color: #005BB5;
}

.filters .clear-filters {
    background-color: #6c757d;
}

.filters .clear-filters:hover {
    background-color: #5a6268;
}

.filter-row {
    display: flex;
    align-items: center;
    margin-bottom: 0; 
}

.filters input,
.filters select {
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #c5d6ea;
    margin: 0 3px;
}

.filters input[disabled], .filters select[disabled].static-operator {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    cursor: default;
}

.filters select[disabled].static-operator {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-left: 10px;
    padding-right: 10px;
    text-align: center;
}

.filter-info-icon {
    position: relative;
    display: inline-block;
    cursor: pointer;
    vertical-align: middle;
}

.info-icon-img {
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.2em;
    display: inline-block;
}

.filter-info-bubble {
    display: none;
    position: absolute;
    left: 50%;
    top: 140%;
    transform: translateX(-50%);
    background: #ffffff;
    color: #333;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    min-width: 280px;
    padding: 18px 16px 16px 16px;
    z-index: 9999;
    font-size: 0.95em;
    text-align: left;
    line-height: 1.6;
}

.filter-info-icon.open .filter-info-bubble {
    display: block;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.close-info {
    position: absolute;
    right: 8px;
    top: 5px;
    border: none;
    background: none;
    font-size: 1.5em;
    color: #888;
    cursor: pointer;
}

.filter-info-bubble ul {
    margin-top: 0.5em;
    padding-left: 1.2em;
}
#info-section {
  text-align: center;
  margin: 20px 0;
}

#info-message {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  padding: 1.5rem; 
  margin: 2rem auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  max-width: 450px;
  text-align: center;
}

#info-message .info-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: #0078d7;
}

#info-message .info-text {
  font-size: 1.2rem;
  color: #333;
  margin-top: 0.5rem;
}


.info-box {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background: rgba(240, 248, 255, 0.3); 
  border-radius: 2rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 1.05rem;
  color: #222;
  line-height: 1.7;
  text-align: center;
}


#timeline-controls {
  margin: 20px;
  text-align: center;
}

.timeline-container {
  display: flex;
  overflow-x: auto;
  padding: 60px 20px;
  position: relative;
  background: linear-gradient(to bottom, #f0f4f8, #ffffff);
  scroll-behavior: smooth;
}

.timeline-container::-webkit-scrollbar {
  height: 8px;
}
.timeline-container::-webkit-scrollbar-thumb {
  background: rgba(0, 120, 215, 0.4);
  border-radius: 4px;
}
.timeline-container::-webkit-scrollbar-track {
  background: transparent;
}

.timeline-event {
  position: relative;
  flex: 0 0 auto;
  width: 220px;
  margin: 0 40px;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  padding: 20px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  transform: translateY(30px);
}

.timeline-event.visible {
  opacity: 1;
  transform: translateY(0px);
}

.timeline-event.top {
  align-self: flex-start;
}

.timeline-event.bottom {
  align-self: flex-end;
}

.circle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0078d7, #00c6ff);
  border-radius: 50%;
  color: white;
  font-size: 18px;
  font-weight: bold;
  line-height: 60px;
  margin: 0 auto 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.event-content {
  margin-top: 10px;
  font-family: 'Helvetica Neue', sans-serif;
}

.event-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 5px 0;
  color: #333;
}

.event-content p {
  font-size: 14px;
  color: #666;
}

.timeline-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, #0078d7, #00c6ff);
  z-index: -1;
}

.blue-gradient {
  background: linear-gradient(135deg, #0078d7, #00c6ff);
}

.green-gradient {
  background: linear-gradient(135deg, #28a745, #85e085);
}

.purple-gradient {
  background: linear-gradient(135deg, #6f42c1, #d6b3ff);
}

.pink-gradient {
  background: linear-gradient(135deg, #e83e8c, #ffb6c1);
}

.orange-gradient {
  background: linear-gradient(135deg, #fd7e14, #ffd39b);
}

.teal-gradient {
  background: linear-gradient(135deg, #20c997, #96f2d7);
}

.red-gradient {
  background: linear-gradient(135deg, #dc3545, #ff9999);
}

.yellow-gradient {
  background: linear-gradient(135deg, #f6c90e, #ffe57f);
}

.cyan-gradient {
  background: linear-gradient(135deg, #00bcd4, #80deea);
}

.indigo-gradient {
  background: linear-gradient(135deg, #3f51b5, #9fa8da);
}



#word-cloud canvas {
  margin: 20px 0;
  max-width: 100%;
  height: auto;
}

.wordcloud-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 60px auto;
  max-width: 1200px;
  padding: 20px;
}

.wordcloud-textbox {
  flex: 1;
  background: rgba(240, 248, 255, 0.6); 
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
  font-size: 1rem;
  line-height: 1.5;
}

.wordcloud-canvasbox {
  flex: 1;
  background: white;
  border-radius: 20px;
  padding: 20px;
  min-height: 400px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

body {
  background: transparent;
  background-color: #f5f7fa; 
  font-family: 'Helvetica Neue', sans-serif;
  color: #333;
}

#wordcloud-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.7); 
  border-radius: 2rem;
  backdrop-filter: blur(8px); 
  margin-top: 2rem;
}

#wordcloud-textbox {
  flex: 1;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#word-cloud {
  flex: 1;
  text-align: center;
}

canvas {
  width: 100% !important;
  height: auto !important;
  pointer-events: auto; /* allow selecting words */
  background-color: transparent !important;
}

/* Countries list */
#countries-section {
  margin: 2rem auto;
  max-width: 900px;
  text-align: center;
}

.countries-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.country-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.8);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-size: 0.9rem;
}

.countries-carousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 1rem;
  scroll-behavior: smooth;
}

.countries-carousel::-webkit-scrollbar {
  height: 8px;
}
#countries-carousel {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding: 1rem;
  scroll-behavior: smooth;
  align-items: center;
}
#countries-carousel::-webkit-scrollbar {
  display: none; /* hide scrollbar for clean look */
}

.country-card {
  flex: 0 0 auto;
  background: #f0f4f8;
  padding: 20px;
  border-radius: 15px;
  text-align: center;
  min-width: 140px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 1rem;
  font-weight: 600;
}

.country-flag {
  width: 40px;
  height: 30px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}


#metrics-section {
  margin: 4rem auto;
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  max-width: 900px;
}

.metrics-grid {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 2rem;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-number {
  font-size: 3rem;
  font-weight: bold;
  color: #0078d7;
}

.metric-label {
  font-size: 1.1rem;
  margin-top: 0.5rem;
  color: #333;
}

#view-toggle {
  text-align: center;
  margin: 2rem 0;
}

#view-toggle button {
  background: linear-gradient(135deg, #0078d7, #005bb5);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 9999px; /* fully rounded buttons */
  margin: 0 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

#view-toggle button:hover {
  background: linear-gradient(135deg, #005bb5, #003e92);
  transform: translateY(-2px);
}

#view-toggle button:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0,120,215,0.3);
}



#view1-filters {
  position: absolute;
  top: 20px;    
  right: 20px;  
  z-index: 1000;
}


#view1-type-filter, #view1-attachedto-filter {
  background: #fff;
  padding: 4px 8px;
  font-size: 0.87rem;
  border: 1px solid #ccc;
  border-radius: 9999px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  appearance: none;        
  outline: none;
  margin-left: 5px; /* Adds space between the dropdowns */
}

.info-subtext {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #555;
  margin-top: 0.25rem;
  font-style: italic;
}


#type-filter {
  background: white;
  padding: 10px 20px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 9999px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  outline: none;
  appearance: none;
  font-family: 'Helvetica Neue', sans-serif;
  color: #333;
}

#map-container {
  position: relative;
}

.map-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  color: #333;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
}
.map-legend div {
  display: flex;
  align-items: center;
  margin-bottom: 0.3rem;
}
.map-legend div:last-child {
  margin-bottom: 0;
}
.map-legend img {
  margin-right: 0.4rem;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 18px;
    color: #666;
}

.loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.network-legend {
  font-size: 13px;
  margin-top: 0.5em;
  text-align: center;
  color: #333;
}
.network-legend span {
  margin-right: 8px;
}

#insights {
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.insights-title {
  text-align: center;
  font-size: 2.5rem;
  color: #2c3e50; 
  margin-bottom: 2rem;
}

.viz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.viz-card:has(#network-diagram) {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


.viz-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}



.viz-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.1);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 0; 
    position: relative;
}

.network-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.network-zoom-controls button {
    width: 30px;
    height: 30px;
    font-size: 22px;
    font-weight: bold;
    color: #34495e;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.network-zoom-controls button:hover {
    background-color: #ffffff;
    border-color: #3498db;
    color: #3498db;
    transform: scale(1.1);
}

.viz-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(44, 62, 80, 0.12);
}

#network-diagram {
    height: 450px; 
    width: 100%;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background-color: #f8f9fa;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .network-container {
        height: 350px;
    }
    
    #network-diagram {
        min-height: 350px;
    }
}

.viz-card h3 {
  font-size: 1.4rem;
  color: #2c3e50; 
  margin-top: 0;
  margin-bottom: 0;
}

.viz-card .viz-description {
  color: #576c7f;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 0;
}

#insights > .viz-grid,
#insights > .viz-card {
  margin-bottom: 2rem;
}

.chart-container, .wordcloud-container {
  position: relative;
  height: 350px;
  width: 100%;
  flex-grow: 1;
}

.network-container {
    width: 100%;
    height: 450px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background-color: #f8f9fa;
    position: relative; 
    overflow: hidden;
}

.network-container canvas {
    width: 100% !important;
    height: 100% !important;
}


#infra-focus-controls {
  margin-top: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

#infra-focus-controls input {
  padding: 8px;
  width: 300px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

#infra-focus-controls .infra-buttons button {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: #3498db;
    color: white;
    transition: background-color 0.2s;
    margin: 0 5px;
}

#infra-focus-controls .infra-buttons button:hover {
    background-color: #2980b9;
}

#cy-tooltip {
  display: none;
  position: absolute;
  background-color: #2c3e50; 
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none; 
  z-index: 10000;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%); 
}

/* === Infrastructure Graph Legend === */
.cy-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0.5rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #34495e;
}

.legend-swatch {
    width: 15px;
    height: 15px;
    margin-right: 8px;
    border-radius: 50%; 
}

.legend-swatch.node-blue {
    background-color: #3498db;
}

.legend-swatch.node-grey {
    background-color: #7f8c8d;
}

.legend-swatch.edge-orange {
    height: 3px;
    border-radius: 2px;
    background-color: #f39c12;
}

.legend-swatch.edge-grey {
    height: 3px;
    border-radius: 2px;
    background-color: #95a5a6;
}


.infra-info-panel {
  display: none; 
  position: absolute; 
  width: 300px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(44, 62, 80, 0.15);
  z-index: 1001; 
  padding: 1rem;
  font-size: 14px;
  transform: translate(-50%, -110%); 
  transition: opacity 0.2s ease-in-out;
}

.infra-info-panel h4 {
  margin: 0 0 0.75rem 0;
  color: #2c3e50;
  font-size: 1rem;
}

.infra-info-panel p {
  margin: 0.5rem 0;
  color: #576c7f;
  line-height: 1.5;
}

.infra-info-panel a {
  color: #3498db;
  text-decoration: none;
  font-weight: bold;
}

.infra-info-panel a:hover {
  text-decoration: underline;
}

.infra-info-close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #95a5a6;
  cursor: pointer;
}

.legend-swatch.node-infra {
    background-color: #1abc9c; 
}

.legend-swatch.node-org {
    background-color: #3498db; 
}

.legend-swatch.edge-orange {
    height: 3px;
    border-radius: 2px;
    background-color: #f39c12;
}

.legend-swatch.edge-grey {
    height: 3px;
    border-radius: 2px;
    background-color: #95a5a6;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    margin-top: 0;
    color: #1766A3;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8rem;
    border: none;
    background: none;
    cursor: pointer;
    color: #888;
}

#infrastructure-network-diagram {
    position: relative;
}

.collaboration-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid #ff1493 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.collaboration-tooltip .leaflet-tooltip-content {
    margin: 8px 12px !important;
}

#infrastructure-network-diagram .faded {
    opacity: 0.15;
    transition: opacity 0.2s ease-in-out;
}

#infrastructure-network-diagram .highlighted {
    opacity: 1;
}