body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#canvas {
    display: block;
    cursor: grab;
    background-color: #000000;
}

#canvas:active {
    cursor: grabbing;
}

/* Main UI box container style */

.uibox {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #333;    
}

/* Control Panel Styles */

#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    max-width: 300px;
    max-height: 80vh;
    overflow-y: auto;
}

#controls h2 {
    margin-top: 0;
    color: #4a9eff;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
}

.control-group input[type="range"] {
    width: 100%;
}

.control-group input[type="checkbox"] {
    margin-right: 5px;
}

.control-group select {
    width: 100%;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 5px;
    border-radius: 3px;
}

.author-info {
    margin-top: 30px;
    color: #888;
    font-size: 12px;
}

.author-info a {
    color: #4a9eff;
    text-decoration: none;
}

/* UI Button Style */

button {
    background-color: #4a9eff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 10px;
}

button:hover {
    background-color: #3a8eef;
}

/* Search box and autocomplete */
.search-container {
    position: relative;
}

#search-box {
    position: absolute;
    top: 20px;
    right: 290px;
    width: 250px;
    display: flex;
    gap: 10px;
    align-items: center;
}

#search-box #searchSystem {
    flex: 1;
}

#search-box button {
    margin: 0;
    white-space: nowrap;
}

#searchSystem {
    width: 100%;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 8px;
    border-radius: 3px;
    box-sizing: border-box;
}

#searchSystem:focus {
    border-color: #4a9eff;
    outline: none;
}

#autocompleteDropdown {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #555;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    min-width: 200px;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    color: #ccc;
    font-size: 14px;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #4a9eff;
    color: white;
}

.autocomplete-region {
    font-size: 12px;
    color: #888;
    margin-left: 10px;
}

.autocomplete-no-results {
    padding: 8px 12px;
    color: #888;
    font-style: italic;
    text-align: center;
}

/* System Tooltip */

#tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #4a9eff;
    display: none;
    pointer-events: none;
    max-width: 300px;
}

#tooltip h3 {
    margin: 0 0 5px 0;
    color: #4a9eff;
}

#tooltip p {
    margin: 2px 0;
    font-size: 14px;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

/* Main Loading Spinner */

.spinner {
    border: 4px solid #333;
    border-top: 4px solid #4a9eff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Legend */

#legend {
    position: absolute;
    top: 20px;
    right: 20px;
    max-width: 250px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

#legend h3 {
    margin-top: 0;
    color: #4a9eff;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 10px;
    border: 1px solid #444;
}

.legend-text {
    font-size: 12px;
    color: #ccc;
}

/* Stats */

#stats {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 14px;
}

.stat-item {
    margin-bottom: 5px;
    color: #aaa;
}

.stat-value {
    color: #4a9eff;
    font-weight: bold;
}

/* Performance */

#performance {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 12px;
    color: #888;
}

/* Modal Styles */

.modal {
    display: none;
    position: absolute;
    z-index: 1000;
    padding: 0px !important;
    transform: none;
}

.modal-header {
    background: rgba(100, 100, 100, 0);
    padding: 5px 5px 5px 20px;
    border-bottom: 1px solid #4a9eff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.modal-header h2 {
    padding: 0;
    margin: 0;
    font-size: 14px;
    color: #4a9eff;
}

.modal-header .close-button {
    padding: 2px 6px;
    font-size: 24px;
    background-color: transparent;
    color: #666;
    border: none;
    cursor: pointer;
    margin: 0;
}

.modal-header .close-button:hover {
    color: #4a9eff;
}

.modal-content {
    padding: 20px;
}

.modal table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.modal table th {
    font-weight: bold;
    color: #4a9eff;
}

.modal table td {
    padding: 5px 5px;
    text-align: center;
}

#campaignsModal .attacker {
    color: rgb(255, 136, 0);
}

#campaignsModal .defender {
    color: rgb(119, 179, 0);
}

#campaignsModal .neutral {
    color: #ffcc00;
}

.status-button {
    text-decoration: none;
}

.fleet-spinner {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: visible; /* Ensure visibility of spinning icon */
    display: none; /* Start hidden */
}

.orbit {
    position: absolute;
    width: 0;
    height: 0;
    animation: orbit-spin 6s linear infinite;
    transform-origin: 0 0;
}

.orbit-1 {
    animation-delay: 0s;
}

.orbit-2 {
    animation-delay: -2.0s;
}

.orbit-3 {
    animation-delay: -4.0s;
}

.fleet-spinner .icon-container {
    position: absolute;
    left: 2px; /* Orbit radius */
    top: 0;
    width: 12px;
    height: 12px;
    transform: rotate(0deg); /* counter rotation */
    animation: icon-counterspin 6s linear infinite;
}

.orbit-1 > .icon-container {
    animation-delay: 0s;
}

.orbit-2 > .icon-container {
    animation-delay: -2s;
}

.orbit-3 > .icon-container {
    animation-delay: -4s;
}

.fleeticon {
    width: 100%;
    height: 100%;
}

.icon-container .red * {
    stroke: red;
}

.icon-container .green * {
    stroke: lime;
}

.icon-container .blue * {
    stroke: cyan;
}

@keyframes orbit-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes icon-counterspin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

