/* ------------------------------------------- */
/* Globe Page Specific Styles */
/* ------------------------------------------- */

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

/* Globe Container */
#globe-section .row {
  display: flex;
  align-items: stretch;
}

#globe-section .globe-wrapper {
  width: 100%;
  height: 600px;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

#globe-section #globeViz {
  width: 100%;
  height: 100%;
}

/* Details Panel */
.details-panel {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 1.5rem;
  height: 600px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

#intervention-details {
  flex: 1;
  overflow-y: auto;
}

.details-panel h3 {
  color: var(--flag-red);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

#intervention-details {
  font-size: 0.95rem;
}

.detail-item {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--text-soft);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.detail-value {
  color: var(--text-main);
}

/* Legend Items */
.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.legend-item {
  padding: 0.25rem 0;
}

.legend-color {
  flex-shrink: 0;
}

/* Timeline Section - Gantt Chart */
#timeline-section {
  background: var(--bg-elevated);
}

#timeline-container {
  position: relative;
  overflow: visible;
  width: 100%;
}

/* Gantt Chart Container */
.gantt-chart {
  display: flex;
  position: relative;
  width: 100%;
}

/* Labels Column */
.gantt-labels {
  position: sticky;
  left: 0;
  width: 200px;
  min-width: 200px;
  background: var(--bg-elevated);
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.gantt-label {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gantt-label:hover {
  background: rgba(255, 255, 255, 0.05);
}

.gantt-label.selected {
  background: rgba(255, 255, 255, 0.1);
}

.gantt-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}

.gantt-label-text {
  font-size: 0.8rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chart Area */
.gantt-chart-area {
  flex: 1;
  position: relative;
  width: 100%;
  padding: 0 20px;
  overflow: visible;
}

.gantt-svg {
  display: block;
  overflow: visible; /* Allow year labels to extend slightly */
}

/* Grid Lines */
.gantt-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

/* Year Axis */
.gantt-year-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.gantt-year-text {
  fill: var(--text-soft);
  font-size: 11px;
  text-anchor: middle;
  font-weight: 500;
}

/* Gantt Bars */
.gantt-bar {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.gantt-bar:hover {
  opacity: 1 !important;
  filter: brightness(1.15) url(#gantt-shadow);
}

.gantt-bar.selected {
  stroke: #fff;
  stroke-width: 2;
  opacity: 1 !important;
}

/* Tooltips */
.gantt-tooltips {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  pointer-events: none;
  overflow: visible;
}

.gantt-tooltip {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
}

/* Default: show below the bar */
.gantt-tooltip {
  transform: translateX(-10px);
  margin-top: 8px;
}

/* When near top: show below */
.gantt-tooltip.position-below {
  transform: translateX(-10px);
  margin-top: 8px;
}

/* When there's space: show above */
.gantt-tooltip.position-above {
  transform: translateY(-100%) translateX(-10px);
  margin-top: -8px;
}

.gantt-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.gantt-tooltip-content {
  background: var(--bg-main);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.gantt-tooltip-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gantt-tooltip-row {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 4px;
  line-height: 1.4;
}

.gantt-tooltip-row strong {
  color: var(--text-main);
}

.gantt-tooltip-desc {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-style: italic;
}

/* Legend */
.gantt-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
}

.gantt-legend-title {
  font-size: 0.8rem;
  color: var(--text-soft);
  font-weight: 500;
}

.gantt-legend-gradient {
  width: 120px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, 
    rgb(0, 104, 55) 0%,
    rgb(102, 189, 99) 25%,
    rgb(255, 255, 191) 50%,
    rgb(253, 174, 97) 75%,
    rgb(215, 48, 39) 100%
  );
}

.gantt-legend-label {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.gantt-legend-label:first-of-type {
  margin-left: -4px;
}

.gantt-legend-label:last-of-type {
  margin-right: -4px;
}

/* Filter Section */
#filter-section {
  background: var(--bg-main);
}

#filter-section .form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#filter-section .form-label span {
  color: var(--text-main);
  font-weight: 400;
  text-transform: none;
}

#filter-section .form-select {
  background-color: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

#filter-section .form-select:focus {
  border-color: var(--flag-red);
  box-shadow: 0 0 0 0.25rem rgba(194, 51, 51, 0.25);
}

/* Dual Range Slider */
.dual-range-container {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
}

.dual-range {
  position: absolute;
  width: 100%;
  height: 6px;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
}

.dual-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--flag-red);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  margin-top: -6px;
  border: 2px solid var(--bg-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.dual-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.dual-range::-moz-range-track {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
}

.dual-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--flag-red);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid var(--bg-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dual-range-min::-webkit-slider-runnable-track {
  background: transparent;
}

.dual-range-max::-webkit-slider-runnable-track {
  background: linear-gradient(to right, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0.2) 50%, 
    rgba(255, 255, 255, 0.1) 100%);
}

#filter-count {
  font-size: 0.9rem;
}

/* Globe Tooltip (custom) */
.globe-tooltip {
  font-family: inherit;
}

/* Loading State */
.globe-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-soft);
}

.globe-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--flag-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 991.98px) {
  #globe-section .row {
    flex-direction: column;
  }
  
  #globe-section .globe-wrapper {
    height: 400px;
    margin-bottom: 1.5rem;
  }
  
  .details-panel {
    height: auto;
    min-height: 300px;
  }

  .gantt-labels {
    width: 160px;
    min-width: 160px;
  }

  .gantt-label-text {
    font-size: 0.75rem;
  }

  .gantt-tooltip-content {
    min-width: 200px;
    max-width: 260px;
  }
}

@media (max-width: 575.98px) {
  #globe-section .globe-wrapper {
    height: 300px;
  }

  .gantt-labels {
    width: 120px;
    min-width: 120px;
  }

  .gantt-label {
    padding: 0 8px;
  }

  .gantt-label-text {
    font-size: 0.7rem;
  }

  .gantt-legend {
    flex-wrap: wrap;
    gap: 8px;
  }

  .gantt-legend-gradient {
    width: 100px;
  }
}
