/* Add Font Awesome for icons */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css');

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    height: 100vh;
    font-family: sans-serif; /* Default font for better readability */
    overflow: hidden;
}

/* Version Navigation */
.version-control {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 500px;
    min-height: 4em;
    justify-content: space-between;
    box-sizing: border-box;
    gap: 8px;
}

.version-buttons {
    display: flex;
    gap: 4px;
}

.version-display-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    max-width: 300px;
    margin: 0 10px;
}

.version-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.version-display:hover {
    background: #f0f0f0;
}

.version-display i {
    margin-left: 8px;
    font-size: 0.8em;
    color: #666;
}

.version-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    max-height: 400px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 8px;
    min-width: 350px;
    width: 100%;
}

.version-dropdown-header {
    padding: 8px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.version-search {
    width: calc(100% - 18px);
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
}

.version-list {
    overflow-y: auto;
    max-height: 400px;
}

.version-item {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.version-info {
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    width: 100%;
    align-items: center;
}

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

.version-item:hover {
    background: #f5f5f5;
}

.version-item.active {
    background: #e6f2ff;
    font-weight: bold;
}

.version-item .version-number {
    font-weight: bold;
    font-size: 0.9em;
    text-align: left;
}

.version-item .version-date {
    color: #666;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    padding: 0 8px;
}

.version-item .version-day {
    color: #888;
    font-size: 0.8em;
    white-space: nowrap;
    text-align: right;
}

.version-item.loading {
    color: #666;
    font-style: italic;
    justify-content: center;
    padding: 16px;
}

/* Show dropdown when active */
.version-display-container.show-dropdown .version-dropdown {
    display: flex;
}

.version-button {
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 0.9em;
    color: black;
}

.version-button:hover {
    background: #aaa;
    color: black;
}

.version-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: transparent;
}

.version-display {
    font-size: 0.9em;
    color: black;
    padding: 0 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    font-weight: 500;
}

.map-container {
    flex: 1;
    position: relative;
    height: 100%;
    border-right: 1px solid #000;
    padding-bottom: 20px; /* Add padding to prevent overlap with version control */
}
.map-container.hidden {
    flex: 0 !important;
    width: 0 !important;
    height: 100%;
    border-right: none !important;
    display: none;
}
.map-container:last-child {
    border-right: none;
}
#map1, #map2, #map3 {
    height: 100%;
    width: 100%;
}
.controls {
    position: absolute;
    top: 62px;
    left: 10px;
    z-index: 10;
    background: #fff;
    padding: 10px;
    margin: 0;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-family: sans-serif;
    font-size: 0.9em;
    transition: max-height 0.3s ease, max-width 0.3s ease;
    overflow: hidden;
    max-height: 1000px; /* Adjust based on your content */
    max-width: 300px; /* Adjust based on your content */
}
.controls.collapsed {
    max-height: 20px;
    max-width: 120px;
}
.controls > *:not(h3) {
    opacity: 1;
    transition: all 0.3s ease;
}
.controls.collapsed > *:not(h3) {
    opacity: 0;
    pointer-events: none;
}
.controls h2 {
    margin-top: 0;
    margin-bottom: 1px;
    font-size: 1.4em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.controls h3 {
    margin-top: 0;
    font-size: 1.2em;
    margin-bottom: 1px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.controls h3:after {
    content: '▲';
    font-size: 0.8em;
    transition: transform 0.3s ease;
    margin-left: 10px;
}
.controls.collapsed h3:after {
    transform: rotate(180deg);
}
.controls b {
    font-weight: bold;
    display: block;
    margin-bottom: 2px;
}
.controls label {
    display: flex;
    align-items: center;
    margin-bottom: 1px;
    font-size: 0.9em;
}
.controls label input[type="checkbox"] {
    margin-left: 0px;
    margin-right: 8px;
}
.controls label span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
    margin-top: -1px;
}
.controls button {
    margin-top: 4px;
    padding: 6px 10px;
    font-family: sans-serif;
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.controls button.hide-all-state {
    background-color: rgb(0, 0, 165);
    color: white;
}
.controls button.hide-all-state:hover {
    background-color: rgb(0, 0, 62);
    color: white;
}
.controls button:hover {
    background-color: #aaa;
    color: black;
}
.tooltip {
    position: absolute;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    min-width: 120px;
    display: none;
}
button {
    /* Inherit styles from .controls button now */
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
}
button.active {
    background-color: #ccc;
}
.map-toggle-buttons button {
    margin: 5px 0;
    padding: 8px 15px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    color: #000;
    font-size: 0.9em;
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: sans-serif;
}
.map-toggle-buttons button:hover {
    background-color: #aaa;
    color: black;
}
.map-toggle-buttons button.hidden-state {
    background-color: rgb(0, 0, 165);
    color: white;
}
.map-toggle-buttons button.hidden-state:hover {
    background-color: rgb(0, 0, 62);
    color: white;
}
.map-toggle-buttons {
    position: fixed;
    bottom: 30px;
    left: 10px;
    z-index: 20;
    background: #fff;
    padding: 10px;
    border-radius: 2px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    width: auto;
}
.crosshair {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 9;
}
.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background-color: #000;
    width: 2px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.7;
}
.crosshair::after {
    transform: translate(-50%, -50%) rotate(90deg);
}
.cursor-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: rgba(200, 255, 0, 0.7);
    border: 1px solid black;
    border-radius: 50%;
    pointer-events: none;
    z-index: 7;
    transform: translate(-50%, -50%);
    display: none;
}
.market-selector-container {
    position: fixed;
    bottom: 194px;
    left: 10px;
    z-index: 1000;
    background: #fff;
    padding: 10px;
    border-radius: 2px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    width: auto;
}

.market-button {
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 15px;
    margin: 0;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: sans-serif;
    width: 100%;
    text-align: left;
}

.market-button:hover {
    background-color: #e0e0e0;
}

.market-menu {
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    background: white;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    padding: 5px 0;
    margin-bottom: 10px;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
}

.market-menu.visible {
    display: block;
}

.market-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
}

.market-item:hover {
    background-color: #f5f5f5;
}

.market-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.market-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9em;
    border-radius: 3px;
}

.market-item:hover {
    background-color: #f0f0f0;
}
.market-item:last-child {
    border-bottom: none;
}
