/* ------------------------------------------- */
/* Research Question Pages Shared Styles */
/* ------------------------------------------- */

/* Page Header */
.page-header {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-main) 100%);
}

.page-header .badge {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Chart Containers */
.chart-container {
  background: var(--bg-elevated);
  border-radius: 12px;
  min-height: 400px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.chart-container.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form Controls */
.form-select,
.form-control {
  background-color: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.form-select:focus,
.form-control:focus {
  background-color: var(--bg-elevated);
  border-color: var(--flag-red);
  box-shadow: 0 0 0 0.25rem rgba(194, 51, 51, 0.25);
  color: var(--text-main);
}

.form-label {
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.9rem;
}

/* Comparison Slider */
.comparison-slider-container {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

#before-after-slider {
  position: relative;
  min-height: 400px;
  background: var(--bg-elevated);
}

.comparison-label {
  position: absolute;
  top: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 10;
}

.comparison-label.before {
  left: 1rem;
  color: var(--bear-red);
}

.comparison-label.after {
  right: 1rem;
  color: var(--bull-green);
}

/* Modal Styles */
.modal-content.bg-dark {
  background-color: var(--bg-main) !important;
}

.modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 1.5rem;
}

.breadcrumb-item a {
  color: var(--flag-red);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--text-soft);
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--text-soft);
}

/* Sankey Diagram */
#sankey-diagram {
  min-height: 500px;
}

#sankey-diagram svg {
  width: 100%;
  height: 100%;
}

.sankey-node rect {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.sankey-node:hover rect {
  opacity: 0.8;
}

.sankey-link {
  fill: none;
  stroke-opacity: 0.4;
  transition: stroke-opacity 0.2s ease;
}

.sankey-link:hover {
  stroke-opacity: 0.7;
}

.sankey-link.highlighted {
  stroke-opacity: 0.8;
}

/* Intensity Scatter */
#intensity-scatter {
  min-height: 500px;
}

/* PCA Components */
#pca-components .component-item {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-main);
  border-radius: 8px;
}

.component-name {
  flex: 1;
  font-weight: 500;
}

.component-bar {
  flex: 2;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 1rem;
}

.component-bar-fill {
  height: 100%;
  background: var(--flag-red);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.component-value {
  font-weight: 600;
  color: var(--text-soft);
  min-width: 50px;
  text-align: right;
}

/* Comparison Tool */
#comparison-charts {
  min-height: 400px;
}

#swap-interventions {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-difference {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-main);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 10;
}

.comparison-difference.positive {
  color: var(--bull-green);
  border: 1px solid var(--bull-green);
}

.comparison-difference.negative {
  color: var(--bear-red);
  border: 1px solid var(--bear-red);
}

/* Responsive */
@media (max-width: 991.98px) {
  .chart-container {
    min-height: 300px;
    margin-bottom: 1.5rem;
  }
  
  #sankey-diagram,
  #intensity-scatter {
    min-height: 350px;
  }
}


/* ------------------------------------------- */
/* RQ2: Objective Stats Grid */
/* ------------------------------------------- */

.objective-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.objective-stat-card {
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.objective-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.objective-stat-card .stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.objective-stat-card .stat-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.objective-stat-card .stat-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-soft);
}

.objective-stat-card .stat-impact {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.objective-stat-card .stat-impact .label {
  margin-right: 0.5rem;
}

/* Sankey Tooltip */
.sankey-tooltip {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Country Section */
#country-section .chart-container {
  min-height: 420px;
}

/* Objective Section */
#objective-section .chart-container {
  min-height: 420px;
}

@media (max-width: 767.98px) {
  .objective-stats-grid {
    grid-template-columns: 1fr;
  }
  
  #country-section .chart-container,
  #objective-section .chart-container {
    min-height: 350px;
  }
}


/* ------------------------------------------- */
/* RQ1: War × Sector Heatmap */
/* ------------------------------------------- */

#sector-heatmap {
  min-height: 800px;
  overflow-x: auto;
}

#sector-heatmap .js-plotly-plot {
  width: 100%;
}

/* Heatmap info text */
.heatmap-info {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 1rem;
}

.heatmap-info i {
  color: var(--flag-red);
}

/* Scrollable heatmap container */
.heatmap-scroll-container {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

/* Responsive adjustments for heatmap */
@media (max-width: 991.98px) {
  #sector-heatmap {
    min-height: 600px;
  }
}

@media (max-width: 767.98px) {
  #sector-heatmap {
    min-height: 500px;
  }
}


/* ------------------------------------------- */
/* RQ2: Sector × Objective Heatmap */
/* ------------------------------------------- */

#sector-objective-heatmap {
  min-height: 620px;
  overflow-x: auto;
}

#sector-objective-heatmap .js-plotly-plot {
  width: 100%;
}

/* Heatmap Toggle Controls */
.heatmap-controls {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.heatmap-controls .control-group {
  display: flex;
  flex-direction: column;
}

.heatmap-controls .control-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.heatmap-controls .btn-group {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.heatmap-controls .btn-outline-primary {
  --bs-btn-color: #3498DB;
  --bs-btn-border-color: rgba(52, 152, 219, 0.5);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #3498DB;
  --bs-btn-hover-border-color: #3498DB;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #2980B9;
  --bs-btn-active-border-color: #2980B9;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.heatmap-controls .btn-outline-secondary {
  --bs-btn-color: #9B59B6;
  --bs-btn-border-color: rgba(155, 89, 182, 0.5);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #9B59B6;
  --bs-btn-hover-border-color: #9B59B6;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #8E44AD;
  --bs-btn-active-border-color: #8E44AD;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.heatmap-controls .btn-check:checked + .btn-outline-primary,
.heatmap-controls .btn-check:checked + .btn-outline-secondary {
  box-shadow: 0 0 12px rgba(52, 152, 219, 0.4);
}

.heatmap-controls .btn-check:checked + .btn-outline-secondary {
  box-shadow: 0 0 12px rgba(155, 89, 182, 0.4);
}

/* Window selector dropdown */
.heatmap-controls .window-select {
  background-color: var(--bg-main);
  border: 1px solid rgba(243, 156, 18, 0.5);
  color: #F39C12;
  font-size: 0.85rem;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  border-radius: 0.375rem;
  min-width: 160px;
  height: 38px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.heatmap-controls .window-select:hover {
  border-color: #F39C12;
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

.heatmap-controls .window-select:focus {
  border-color: #F39C12;
  box-shadow: 0 0 0 0.25rem rgba(243, 156, 18, 0.25);
  outline: none;
}

.heatmap-controls .window-select option {
  background-color: var(--bg-elevated);
  color: var(--text-main);
}

@media (max-width: 991.98px) {
  .heatmap-controls .d-flex.gap-4 {
    gap: 1.5rem !important;
  }
}

@media (max-width: 767.98px) {
  .heatmap-controls {
    padding: 1rem;
  }
  
  .heatmap-controls .d-flex.gap-4 {
    flex-direction: column;
    gap: 1rem !important;
  }
  
  .heatmap-controls .btn-group {
    width: 100%;
  }
  
  .heatmap-controls .btn-group .btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.5rem 0.5rem;
  }
  
  .heatmap-controls .window-select {
    width: 100%;
  }
}

/* Share section header */
.share-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.share-section-header > div:first-child {
  flex: 1;
  min-width: 250px;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
  #sector-objective-heatmap {
    min-height: 500px;
  }
  
  .share-section-header {
    flex-direction: column;
  }
}


/* ------------------------------------------- */
/* Analysis Cards */
/* ------------------------------------------- */

.analysis-card {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.analysis-card h4 {
  color: var(--text-main);
  margin-bottom: 1rem;
}

.analysis-card h6 {
  margin-bottom: 0.5rem;
}

.analysis-card p {
  line-height: 1.6;
}

.analysis-card .text-soft {
  color: var(--text-soft);
}

/* Responsive */
@media (max-width: 767.98px) {
  .analysis-card {
    padding: 1rem;
  }
  
  .analysis-card .row > div {
    margin-bottom: 0.75rem;
  }
}
