/* Research Gap Sky Map */

.skysurvey-main {
  padding: 1rem;
  max-width: 100%;
}

.skysurvey-header {
  text-align: center;
  margin-bottom: 1rem;
}

.skysurvey-header h1 {
  font-size: 1.5rem;
  margin: 0;
  color: #e0e0e0;
}

.skysurvey-subtitle {
  font-size: 0.85rem;
  color: #999;
  max-width: 700px;
  margin: 0.5rem auto 0;
}

/* Layout: sidebar + map */
.skysurvey-layout {
  display: flex;
  gap: 1rem;
  min-height: 600px;
}

/* Controls sidebar */
.skysurvey-controls {
  width: 220px;
  flex-shrink: 0;
  background: rgba(10, 14, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.75rem;
  overflow-y: auto;
  max-height: 700px;
  font-size: 0.8rem;
}

.controls-section {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.controls-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.controls-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aaa;
  margin: 0 0 0.5rem;
}

.controls-section h4 {
  font-size: 0.7rem;
  color: #888;
  margin: 0.5rem 0 0.25rem;
}

.controls-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.controls-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 2px 0;
  color: #ccc;
  font-size: 0.75rem;
}

.controls-checkbox input[type="checkbox"] {
  margin: 0;
  accent-color: #4a9eff;
}

.controls-radio-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.controls-radio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 2px 0;
  color: #ccc;
  font-size: 0.75rem;
}

.controls-radio input[type="radio"] {
  margin: 0;
  accent-color: #4a9eff;
}

.controls-select {
  width: 100%;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #ccc;
  font-size: 0.75rem;
}

/* Legend */
.legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #bbb;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Stats panel */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #bbb;
}

.stat-row .stat-value {
  color: #e0e0e0;
  font-weight: 600;
}

/* Map container */
.skysurvey-map-container {
  flex: 1;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 600px;
}

#aladin-view {
  width: 100%;
  height: 100%;
  min-height: 600px;
}

/* Object popup */
.object-popup {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 300px;
  max-height: 500px;
  overflow-y: auto;
  background: rgba(10, 14, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.75rem;
  z-index: 100;
  font-size: 0.78rem;
  color: #ccc;
}

.object-popup.hidden {
  display: none;
}

.popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.popup-close:hover {
  color: #fff;
}

.popup-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0 0 0.5rem;
  padding-right: 20px;
}

.popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  color: #999;
}

.popup-meta span {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 3px;
}

.popup-gap-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.popup-gap-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.popup-methods {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.5rem;
}

.method-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
}

.method-status {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.method-status.covered { color: #22cc22; }
.method-status.gap { color: #cc2222; }
.method-status.unsuitable { color: #555; }

.method-name {
  flex: 1;
  color: #aaa;
}

.method-count {
  color: #888;
  font-size: 0.65rem;
}

.popup-links {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.popup-links a {
  color: #4a9eff;
  text-decoration: none;
  font-size: 0.72rem;
}

.popup-links a:hover {
  text-decoration: underline;
}

/* Footer */
.skysurvey-footer {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.72rem;
  color: #666;
}

.skysurvey-footer a {
  color: #4a9eff;
  text-decoration: none;
}

/* Theory Gap Matrix */
.theory-gap-section {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(10, 14, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.theory-gap-title {
  font-size: 1.2rem;
  color: #e0e0e0;
  margin: 0 0 0.3rem;
}

.theory-gap-subtitle {
  font-size: 0.78rem;
  color: #999;
  margin: 0 0 0.75rem;
  max-width: 700px;
}

.theory-gap-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.theory-gap-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.theory-gap-table {
  border-collapse: collapse;
  font-size: 0.7rem;
  min-width: 900px;
}

.theory-gap-table th,
.theory-gap-table td {
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  white-space: nowrap;
}

.theory-gap-table th {
  color: #aaa;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}

.theory-gap-table th.method-header {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  height: 90px;
  padding: 6px 2px;
  font-size: 0.65rem;
  vertical-align: bottom;
}

.theory-gap-table td.epoch-label {
  text-align: left;
  color: #ccc;
  font-weight: 600;
  min-width: 150px;
  padding-right: 12px;
}

.theory-gap-table td.epoch-label.no-data {
  color: #666;
  font-style: italic;
}

.theory-gap-table td.tg-cell {
  min-width: 36px;
  position: relative;
  cursor: default;
}

.theory-gap-table td.tg-cell.tg-gap {
  box-shadow: inset 0 0 0 2px #cc2222;
}

.theory-gap-table td.tg-cell.tg-unsuitable {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.03) 3px,
    rgba(255, 255, 255, 0.07) 3px,
    rgba(255, 255, 255, 0.07) 6px
  ) !important;
}

.theory-gap-table td.tg-cell .tg-count {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.7);
}

.theory-gap-table td.tg-cell.tg-unsuitable .tg-count {
  color: #444;
}

.theory-gap-table td.total-col {
  color: #ccc;
  font-weight: 600;
  font-size: 0.65rem;
}

.theory-gap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: #999;
  align-items: center;
}

.theory-gap-legend .tgl-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.theory-gap-legend .tgl-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

.theory-gap-legend .tgl-gap-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px #cc2222;
  background: rgba(10, 14, 26, 0.7);
  flex-shrink: 0;
}

/* Guide link button */
.guide-link-btn {
  display: block;
  width: 100%;
  padding: 0.4rem 0.8rem;
  background: rgba(101, 146, 255, 0.12);
  border: 1px solid #6592ff;
  border-radius: 4px;
  color: #6592ff;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.guide-link-btn:hover {
  background: rgba(101, 146, 255, 0.25);
}

/* Responsive */
@media (max-width: 900px) {
  .skysurvey-layout {
    flex-direction: column;
  }
  .skysurvey-controls {
    width: 100%;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .controls-section {
    flex: 1;
    min-width: 180px;
  }
}
