/* General Body and Container Styles */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: #000;
    color: #fff;
    width: 100vw;
    height: 100vh;
}

.hidden {
    display: none !important;
}

#scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Top Navigation Bar */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    box-sizing: border-box;
    z-index: 50;
}

#region-header {
    color: #fff;
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px #00ffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    flex-grow: 1;
    margin: 0 16px;
}

.bar-btn {
    background: transparent;
    border: none;
    color: #4fc3f7;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.bar-btn:hover {
    background: rgba(79, 195, 247, 0.1);
    color: #fff;
}

.bar-btn:active {
    transform: scale(0.95);
}

/* Loading Screen Styles */
.loading-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(79, 195, 247, 0.3);
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loading-message {
    font-size: 1.2em;
    margin-bottom: 10px;
}

#loading-progress {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
}

/* Search Panel Styles */
.search-panel {
    position: fixed;
    top: 65px; /* Below top bar */
    right: 16px;
    width: 300px;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    z-index: 49;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Mobile adjustments for Search Panel */
@media (max-width: 480px) {
    .search-panel {
        right: 0;
        left: 0;
        width: auto;
        margin: 0 16px;
        top: 70px;
    }
}

.search-panel h3 {
    margin: 0;
    font-size: 1.2em;
    color: #4fc3f7;
}

.space-type-selection {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 5px;
}

.space-type-option {
    flex: 1;
    position: relative;
}

.space-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.space-type-option label {
    display: block;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.space-type-option input[type="radio"]:checked + label {
    background-color: #4fc3f7;
    color: #000;
    font-weight: bold;
}

#search-input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1em;
    box-sizing: border-box;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.primary-btn {
    padding: 12px;
    background: #4fc3f7;
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.primary-btn:hover {
    background: #64d3ff;
}

/* Star Information Panel Styles */
.star-info-panel {
    position: fixed;
    top: 70px; /* Below top bar */
    left: 20px;
    width: 280px;
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 60;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-size: 14px;
}

@media (max-width: 480px) {
    .star-info-panel {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
        margin: 0;
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: #4fc3f7;
}

#close-panel-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 5px;
}

.panel-content {
    padding: 15px;
}

.panel-content p {
    margin: 0 0 10px;
}

.panel-content p:last-child {
    margin-bottom: 0;
}

.panel-footer {
    padding: 10px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
}

#clear-highlight-btn {
    padding: 8px 12px;
    background: #ff9800;
    border: none;
    border-radius: 6px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
}

.gate-label {
    position: absolute;
    background: rgba(50, 0, 0, 0.8);
    border: 1px solid #ff0000;
    color: #ffcccc;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    white-space: nowrap;
    text-shadow: 0 0 2px black;
    transition: transform 0.2s, z-index 0.2s;
}

.gate-label:hover {
    background: rgba(100, 0, 0, 1);
    box-shadow: 0 0 10px #ff0000;
    transform: scale(1.2);
    z-index: 1000;
}

/* Top regions footer */
#top-regions-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 8px 12px;
  z-index: 1000;
  display: flex;
  justify-content: center;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

/* Container for the region items */
#top-regions-list {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 0;
}

/* Small label at start */
.top-region-label {
  opacity: 0.85;
  margin-right: 8px;
  white-space: nowrap;
  font-size: 13px;
}

/* Loading indicator style */
#top-regions-loading {
  opacity: 0.8;
  white-space: nowrap;
}

/* Buttons for each region (panel.js creates .top-region-btn) */
.top-region-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 120ms ease, transform 120ms ease, border-color 120ms ease;
}

/* Hover / focus states */
.top-region-btn:hover,
.top-region-btn:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  outline: none;
}

/* Thin horizontal scrollbar for overflow */
#top-regions-list::-webkit-scrollbar {
  height: 6px;
}

#top-regions-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
}

/* Responsiveness */
@media (max-width: 600px) {
  #top-regions-footer { padding: 6px 8px; }
  .top-region-label { font-size: 12px; }
  .top-region-btn { font-size: 12px; padding: 3px 6px; }
}
/* Region heatmap panel — fills area between navbar and footer (top/bottom are set dynamically) */
.region-heatmap-panel {
  left: 0;
  right: 0;
  background: rgba(3, 6, 10, 0.98);
  color: #fff;
  /* panel z-index kept below footer which uses 1000 so footer remains visible */
  z-index: 100;
  overflow: auto;
  padding: 28px;
  box-sizing: border-box;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* (existing table styles remain the same) */
.region-heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.region-heatmap-title {
  margin: 0;
  color: #4fc3f7;
  font-size: 20px;
}

.region-heatmap-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.region-heatmap-close {
  background: #fff;
  color: #000;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.region-heatmap-sub {
  opacity: 0.85;
  margin-bottom: 16px;
}

/* table */
.region-heatmap-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.region-heatmap-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

/*.region-heatmap-th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #cfeefc;
  font-weight: 600;
  background: rgba(255,255,255,0.02);
.region-heatmap-th.region-heatmap-th--numeric,
.region-heatmap-table td.region-heatmap-kills,
.region-heatmap-th:last-child {
  text-align: right;
	}
}*/
/* Ensure table headers default to left, then force the Kills column (3rd col) to the right */
.region-heatmap-table thead th {
  text-align: left;
}

/* If the Kills TH has the numeric class, right-align it */
.region-heatmap-table thead th.region-heatmap-th--numeric {
  text-align: right !important;
}

/* Fallback: target the 3rd column explicitly (header and body cells) */
.region-heatmap-table thead th:nth-child(3),
.region-heatmap-table tbody td:nth-child(3),
.region-heatmap-table td.region-heatmap-kills {
  text-align: right !important;
}

/* Give the numeric column a fixed-ish width so it hugs the right side */
.region-heatmap-table tbody td:nth-child(3),
.region-heatmap-table thead th:nth-child(3) {
  width: 120px;
  white-space: nowrap;
}

.region-heatmap-td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: #e6f9ff;
}

.region-heatmap-kills {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Responsive tweaks */
@media (max-width: 720px) {
  .region-heatmap-panel { padding: 16px; }
  .region-heatmap-title { font-size: 18px; }
  .region-heatmap-table { min-width: 520px; }
}
