/**
 * Event Horizon Telescope - UI Enhancements (Phase 2)
 *
 * Styles for collapsible sections, tooltips, and interactive elements
 */

/* ============================================================================
   Collapsible Section Headers
   ============================================================================ */

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 0;
  background: none;
  border: none;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
  transition: color 0.2s ease;
  user-select: none;
}

.collapsible-header:hover {
  color: #a9c5ff;
}

.collapsible-header:focus {
  outline: 2px solid rgba(52, 152, 219, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Expand/collapse arrow indicator */
.collapsible-header::after {
  content: '▼';
  display: inline-block;
  margin-left: 0.5rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.75rem;
  color: rgba(158, 188, 255, 0.6);
}

.collapsible-header.expanded::after {
  transform: rotate(180deg);
}

/* Content animation support */
[data-collapsible-content] {
  max-height: 100%;
  overflow: hidden;
  opacity: 1;
}

/* ============================================================================
   Tooltip Styling
   ============================================================================ */

.eht-tooltip {
  position: fixed;
  z-index: 1000;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 25, 50, 0.95);
  border: 1px solid rgba(158, 188, 255, 0.3);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #a9c5ff;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-8px);
}

/* Arrow indicator (pointer) */
.eht-tooltip::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid rgba(15, 25, 50, 0.95);
}

/* ============================================================================
   Baseline Highlighting
   ============================================================================ */

[data-baseline] {
  transition: stroke 0.3s ease;
}

[data-baseline].highlighted {
  stroke: #3498db;
  stroke-width: 2;
  filter: drop-shadow(0 0 4px rgba(52, 152, 219, 0.6));
}

/* ============================================================================
   Station Selection Feedback
   ============================================================================ */

[data-station] {
  transition: filter 0.2s ease;
  cursor: pointer;
}

[data-station].selected {
  filter: drop-shadow(0 0 8px rgba(52, 152, 219, 0.6));
}

/* ============================================================================
   Interactive Element Enhancements
   ============================================================================ */

.eht-station-button {
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eht-station-button:not(.is-active) {
  opacity: 0.6;
}

.eht-station-button:hover:not(.is-active) {
  opacity: 0.8;
  transform: translateX(2px);
}

.eht-station-button.is-active {
  background: rgba(100, 130, 255, 0.18);
  border-color: rgba(158, 188, 255, 0.4);
}

.eht-station-button.is-active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: #3498db;
  border-radius: 2px;
}

/* ============================================================================
   Panel Enhancements
   ============================================================================ */

.eht-info-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.eht-info-card:hover {
  border-color: rgba(158, 188, 255, 0.35);
  box-shadow: 0 22px 50px rgba(52, 152, 219, 0.1);
}

/* ============================================================================
   Resolution Display
   ============================================================================ */

.eht-resolution-display {
  transition: all 0.3s ease;
}

.resolution-value {
  font-family: 'Monaco', 'Courier New', monospace;
  font-weight: 700;
  color: #2ecc71;
  transition: color 0.3s ease;
}

/* ============================================================================
   Loading & Feedback States
   ============================================================================ */

.eht-loading {
  position: relative;
}

.eht-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0.5rem;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(158, 188, 255, 0.2);
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (max-width: 768px) {
  .collapsible-header {
    padding: 0.6rem 0;
  }

  .eht-tooltip {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  .eht-station-button {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* ============================================================================
   Accessibility Improvements
   ============================================================================ */

/* High contrast mode support */
@media (prefers-contrast: more) {
  .collapsible-header {
    font-weight: 600;
  }

  .eht-tooltip {
    border-width: 2px;
  }

  [data-baseline].highlighted {
    stroke-width: 3;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .collapsible-header,
  .collapsible-header::after,
  .eht-info-card,
  [data-station],
  .eht-station-button {
    transition: none;
  }

  .eht-loading::after {
    animation: none;
    border-top-color: #3498db;
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  .eht-tooltip {
    background: rgba(10, 15, 35, 0.97);
    border-color: rgba(52, 152, 219, 0.4);
  }

  .collapsible-header {
    color: #c5d9ff;
  }

  .collapsible-header:hover {
    color: #e8f0ff;
  }
}
