/* Civilization Systems Model Knowledge Base - Visualizations Styles */

/* Interactive Timeline */
.interactive-timeline {
  position: relative;
  margin: 2rem 0;
  padding: 2rem 0;
}

.timeline-track {
  height: 4px;
  background-color: #ddd;
  position: relative;
  margin: 3rem 0;
}

.timeline-era {
  position: absolute;
  height: 20px;
  top: -8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.timeline-era:hover {
  transform: scaleY(1.5);
}

.timeline-era-biomass {
  background-color: #a5d6a7;
  left: 0%;
  width: 30%;
}

.timeline-era-coal {
  background-color: #616161;
  left: 30%;
  width: 20%;
}

.timeline-era-oil {
  background-color: #9e9e9e;
  left: 50%;
  width: 30%;
}

.timeline-era-nuclear {
  background-color: #64b5f6;
  left: 60%;
  width: 25%;
}

.timeline-era-renewables {
  background-color: #4caf50;
  left: 75%;
  width: 25%;
}

.timeline-marker {
  position: absolute;
  top: -25px;
  transform: translateX(-50%);
  text-align: center;
}

.timeline-marker::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  width: 2px;
  height: 10px;
  background-color: #333;
  transform: translateX(-50%);
}

.timeline-year {
  font-weight: bold;
  font-size: 0.8rem;
}

.timeline-detail {
  position: absolute;
  width: 100%;
  top: 30px;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  height: 0;
  overflow: hidden;
}

.timeline-detail.active {
  opacity: 1;
  height: auto;
}

.timeline-detail-inner {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Concept Mapping Visualization */
.concept-map {
  background-color: #fcfcfc;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  position: relative;
  height: 500px;
  margin: 2rem 0;
}

.concept-node {
  position: absolute;
  background-color: #fff;
  border: 2px solid #333;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.concept-node:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  z-index: 10;
}

.concept-node.transform {
  border-color: var(--color-transform-dark);
  background-color: var(--color-transform-light);
}

.concept-node.properties {
  border-color: var(--color-properties-dark);
  background-color: var(--color-properties-light);
}

.concept-node.applications {
  border-color: var(--color-applications-dark);
  background-color: var(--color-applications-light);
}

.concept-link {
  position: absolute;
  height: 2px;
  background-color: #aaa;
  transform-origin: 0 0;
  z-index: 1;
}

.concept-link.strong {
  height: 3px;
  background-color: #555;
}

.concept-link.transform {
  background-color: var(--color-transform-dark);
}

.concept-link.properties {
  background-color: var(--color-properties-dark);
}

.concept-link.applications {
  background-color: var(--color-applications-dark);
}

/* Interactive Tables */
.interactive-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.interactive-table th {
  cursor: pointer;
  position: relative;
}

.interactive-table th::after {
  content: '↕️';
  position: absolute;
  right: 8px;
  color: #aaa;
  font-size: 0.8rem;
}

.interactive-table th.sort-asc::after {
  content: '↑';
  color: #333;
}

.interactive-table th.sort-desc::after {
  content: '↓';
  color: #333;
}

.interactive-table tbody tr {
  transition: background-color 0.2s ease;
}

.interactive-table tbody tr:hover {
  background-color: rgba(0,0,0,0.05);
}

/* Comparison Matrix */
.comparison-matrix {
  overflow-x: auto;
  margin: 2rem 0;
}

.matrix-table {
  border-collapse: collapse;
  width: 100%;
}

.matrix-table th, 
.matrix-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
}

.matrix-table th {
  background-color: #f5f5f5;
  font-weight: bold;
}

.matrix-table td.high {
  background-color: rgba(76, 175, 80, 0.3);
}

.matrix-table td.medium {
  background-color: rgba(255, 235, 59, 0.3);
}

.matrix-table td.low {
  background-color: rgba(244, 67, 54, 0.3);
}

/* Case Study Modal */
.case-study-link {
  cursor: pointer;
  color: var(--color-link);
  text-decoration: underline;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: #fff;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 8px;
  padding: 2rem;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #777;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #333;
}

/* Detail Toggle Feature */
.detail-toggle {
  display: inline-block;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}

.advanced-detail {
  display: none;
  padding: 1rem;
  margin: 1rem 0;
  border-left: 3px solid #ddd;
  background-color: #fafafa;
}

.show-advanced .advanced-detail {
  display: block;
}

/* Feedback Loops Visualization */
.feedback-loop {
  position: relative;
  margin: 2rem auto;
  width: 80%;
  max-width: 500px;
}

.loop-element {
  position: relative;
  padding: 1rem;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 2rem;
  text-align: center;
}

.loop-arrow {
  position: absolute;
  width: 30px;
  height: 30px;
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
}

.loop-arrow::after {
  content: '↓';
}

.loop-element.reinforcing {
  border-color: #4CAF50;
}

.loop-element.reinforcing .loop-arrow {
  background-color: rgba(76, 175, 80, 0.1);
  border-color: #4CAF50;
}

.loop-element.balancing {
  border-color: #FFC107;
}

.loop-element.balancing .loop-arrow {
  background-color: rgba(255, 193, 7, 0.1);
  border-color: #FFC107;
}

.loop-element:last-child .loop-arrow {
  transform: translateX(-50%) rotate(180deg);
  top: -15px;
  bottom: auto;
}

/* System State Visualization */
.system-states {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 2rem 0;
}

.system-state {
  flex: 1;
  min-width: 200px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  background-color: #fff;
  transition: all 0.3s ease;
}

.system-state:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.state-name {
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.state-properties {
  list-style: none;
  margin: 0;
  padding: 0;
}

.state-properties li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px dashed #eee;
}

.property-name {
  color: #777;
}

/* Media Queries for Visualizations */
@media (max-width: 768px) {
  .concept-map {
    height: 400px;
  }
  
  .concept-node {
    width: 80px;
    height: 80px;
    font-size: 0.7rem;
  }
  
  .system-states {
    flex-direction: column;
  }
}