/* ============================================================================+
   BASIC STYLES
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.style-selector,
button,
body {
    font-family: Arial, sans-serif;
}

#map {
    width: 100%;
    height: 100vh;
}

/* Fix for Chrome cursor display after reload */
#map canvas {
    cursor: grab !important;
}

#map canvas:active {
    cursor: grabbing !important;
}

.maplibregl-ctrl-top-right {
  right: auto;
  left: 10px;   /* Abstand von links */
}


/* ============================================================================
   POPUP STYLES
   ============================================================================ */
.maplibregl-popup-content {
    font-size: 14px;
    padding: 12px;
    min-width: 250px;
	z-index: 9999 !important;
}

.maplibregl-popup-close-button {
    display: none;
}

.popup-content h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 20px;
}

.popup-content p {
    margin: 6px 0;
    color: #555;
    line-height: 1.2em;
}

.popup-content strong {
    color: #2c3e50;
}

.gw-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}

.gw-item {
    background: #f8f9fa;
    padding: 8px;
    margin: 6px 0;
    border-radius: 4px;
}

/* ============================================================================
   STYLE SELECTOR & BUTTONS
   ============================================================================ */
   
   
.style-selector,
button{
	font-size: 13px;
	font-weight: 500;
	vertical-align:center;
}
.style-selector {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.tracker-selector-container {
    position: relative;
}

.tracker-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid gray;
    border-radius: 4px;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
    min-width: 100%;
    margin-top: 2px;
    z-index: 1001;
}

.tracker-dropdown.show {
    display: block;
}

.tracker-option {
    padding: 8px 12px;
    cursor: pointer;
    /* font-size: 12px; */
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.tracker-option:last-child {
    border-bottom: none;
}

.tracker-option:hover {
    background: #f0f0f0;
}

.tracker-option.selected {
    background: steelblue;
    color: white;
    font-weight: 500;
}

#tracker-label {
/* 
    font-size: 12px; 
*/
	font-weight: 400;
	color:#000;
	top:0px;
}

.style-timer{
	background: #fff;
/* 
	font-size: 17px; 
*/
	cursor: default;
	user-select: none;
	text-align: center;
    box-shadow: none;
}

/* buttons */

.mapctrl-btn{
    display: block;
    width: 100%;
    padding: 4px 9px 4px 6px;
    margin: 0 0 5px 0;
    border: 1px solid gray;
    cursor: pointer;
    border-radius: 4px;
    /* font-size: 12px; */
    transition: all 0.2s;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
	color:#000;
    background-color: white;
	background-size: 16px;
	background-repeat: no-repeat;
	background-position: center center;
}

.mapctrl-btn span{
  display: inline-flex;     /* oder inline-block mit line-height = height */
  align-items: left;      /* Vertikal zentrieren (bei flex) */
  justify-content: center;  /* Horizontal zentrieren (bei flex) */ 
  position:relative;
}

.mapctrl-btn.info-icon {
	background-image: url("./assets/info02.png");
	background-size: 14px;
}
.mapctrl-btn.measure-icon {
	background-image: url("./assets/rulerBlack.png");
}
.mapctrl-btn.measure-icon.active {
	background-image: url("./assets/rulerWhite.png");
}
.mapctrl-btn.refresh-icon{
	background-image: url("./assets/refresh.png");
}

.mapctrl-btn:hover {
    background-color: #ececec;
    box-shadow: none;
}
.mapctrl-btn.style-timer:hover {
	background: #fff;
}
.mapctrl-btn.active {
    background-color: steelblue;
    color: white;
    border: 1px solid lightgray;
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
}

/* ============================================================================
   TOGGLE BUTTONS (GtW, GPS, TDoA)
   ============================================================================ */
.toggle-row {
    display: flex;
    flex-direction: row;
    gap: 3px;
    margin-bottom: 5px;
}

.toggle-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid gray;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    color: #000;
    text-align: center;
}

.toggle-btn:hover:not(.active) {
    background: #ececec;
    box-shadow: none;
}

.toggle-btn.active {
    background: steelblue;
    color: white;
    border: 1px solid lightgray;
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
}

/* Date Navigation Container */
.date-nav-container {
    display: flex;
    flex-direction: row;
    gap: 3px;
}

button#date-next-btn{
	color:white;
}

.date-nav-btn {
/* 
    height: 30px; 
*/
    padding: 4px 8px;
    border: 1px solid gray;
    background: white;
    cursor: pointer;
    border-radius: 4px;
	margin-bottom: 5px;
/* 
    font-size: 12px; 
*/
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    color: #000;
}

.date-nav-btn:hover:not(:disabled) {
    /* 
	background: #ececec;
    box-shadow: none;
	color: black;
	*/
}

.date-nav-btn:disabled {
    cursor: not-allowed;
}

.date-nav-btn.active {
    background: steelblue;
    color: white;
    border: 1px solid lightgray;
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
}

.date-display-label {
    display: none;
    padding: 4px 8px;
/* 
    font-size: 12px; 
*/
    font-weight: 500;
    color: #333;
    background: #f0f0f0;
    border-radius: 4px;
    align-self: center;
    margin-left: 5px;
}
#current-date-display.mapctrl-btn{
	text-align: center;
	padding: 5px;
	padding-bottom: 2px;
	border-bottom: 4px solid steelblue;
/* 
	height: auto; 
*/
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
	pointer-events: none;
}




/* ============================================================================
   MODAL STYLES
   ============================================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close-btn {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

span.koeff{
	display:inline-block;
	min-width: 3em;
}

.close-btn:hover {
    color: #000;
}


.stats-table,
.distance-table,
.comparison-table,
.gateway-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stats-table th,
.stats-table td,
.distance-table th,
.distance-table td,
.comparison-table th,
.comparison-table td,
.gateway-table th,
.gateway-table td {
    padding: 6px 9px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.stats-table th,
.distance-table th,
.comparison-table th,
.gateway-table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: bold;
    top: 0;
}

.stats-table tr:hover,
.distance-table tr:hover,
.comparison-table tr:hover,
.gateway-table tr:hover {
    background-color: #f8f9fa;
}

.stats-table td,
.distance-table td,
.comparison-table td,
.gateway-table td {
    color: #555;
}

/* Gateway Table Status Styles */

.gateway-table th,
.gateway-table td {
    text-align: center;
}
.gateway-table th:first-child,
.gateway-table td:first-child {
    text-align: left;
}

.gateway-table .status-ok {
    color: green;
    font-weight: bold;
	font-size: 1.2em;
	line-height: 1em;
}

.gateway-table .status-error {
    color: red;
    font-weight: bold;
	font-size: 1.2em;
	line-height: 1em;
}
.modal-header .tdoa-logo{
	background-image: url("./assets/logo-tdoa-s.png");
	background-size: contain;
	background-repeat: no-repeat;
	padding-left: 35px;
}

/* Tracker Status Table Specific Styles */

.stats-table th {
    text-align: right;
}
.stats-table td {
    text-align: right;
}
.stats-table th:first-child,
.stats-table td:first-child {
    text-align: left;
}

/* Distance Table Specific Styles */

.distance-table th,
.distance-table td {
    text-align: left;
}

.distance-table th.timediff,
.distance-table td.timediff {
    text-align: right;
}

.distance-table th.distancediff,
.distance-table td.distancediff {
    text-align: right;
}

/* Comparison Table Specific Styles */
.comparison-table th:first-child,
.comparison-table td:first-child {
    text-align: left;
}

.comparison-table th:nth-child(2),
.comparison-table td:nth-child(2),
.comparison-table th:nth-child(3),
.comparison-table td:nth-child(3),
.comparison-table th:nth-child(4),
.comparison-table td:nth-child(4),
.comparison-table th:nth-child(5),
.comparison-table td:nth-child(5) {
    text-align: center;
}

#distanceCalculations,
#tdoaComparison {
    margin-top: 10px;
}

.distance-table tr.group-separator td {
    border-top: 3px double #666;
}

/* ============================================================================
   STATUS BAR & LEGEND
   ============================================================================ */
.status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    padding: 0px 12px;
    border-radius: 5px;
    border: 1px solid gray;
    font-size: 12px;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
	display:flex;
	align-items: center;
}

.legend-icon {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    top: 1px;
}

.legend {
	position:relative;
    width: auto;
    display: inline-block;
	padding: 2px 5px 2px 30px;
	background-image: url("./assets/logo-tdoa-s.png");
	background-size: 30px;
	background-repeat: no-repeat;
	background-position: 0px 1px;
	height: 30px;
	display:flex;
	flex-wrap: wrap; 
	align-items: center;
	margin: 4px 5px 4px 0;
}

.legend.now,
.legend.date-display{
    border-radius: 5px;
	font-weight: bold;
	padding: 2px 5px;
	height: 90%;
	background:#e6e6e6;
	margin: 0 10px 0 0;
}
.legend.gateway{
	background-image: url("./assets/logo-gateway-active.png");
}
.legend.gateway-request{
	background-image: url("./assets/logo-gateway-not-active.png");
}
.legend.tracker{
	background-image: url("./assets/logo-tracker.png");
	background-size: 20px;
	padding: 2px 5px 2px 22px;
	background-position: 0px 5px;
}
.legend.tdoa{
	background-image: url("./assets/logo-tdoa-dot-shadow.png");
	background-size: 20px;
	padding: 2px 5px 2px 25px;
	background-position: 0px 6px;
}
@media screen and (max-width: 450px) {
    .legend.gateway-request {
        display: none;
    }
}
@media screen and (max-width: 340px) {
    .legend.tdoa{
        display: none;
    }
}

.gateway-bg {
    background-color: rgba(0, 0, 126, 0);
    border: 3px dotted crimson;
    width: 16px;
    height: 16px;
    top: 3px;
}

.gateway-request-bg {
    background-color: rgba(0, 0, 126, 0);
    border: 3px dotted gray;
    width: 16px;
    height: 16px;
    top: 3px;
}

.tracker-bg {
    background-color: crimson;
    width: 8px;
    border-radius: 5%;
}

.tdoa-bg {
    border: 5px solid steelblue;
    width: 13px;
	height: 13px;
	background: white;
    border-radius: 50%;
}

h3 .tracker-bg {
    position: relative;
    width: 10px;
    height: 14px;
    top: -1px;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid white;
}

h3 .tdoa-bg {
    position: relative;
    width: 16px;
    height: 16px;
    top: -2px;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.3);
    border: 6px solid steelblue;
}

h3 .gateway-bg {
    width: 24px;
    height: 24px;
    top: 2px;
    border: 4px dotted crimson;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    margin-right: 6px;
}

/* ============================================================================
   MAP MARKERS
   ============================================================================ */
.tracker-marker {
    width: 14px;
    height: 20px;
    border-radius: 5%;
    background: crimson;
    border: 1px solid white;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
	z-index: 20;
	display:block; /* aktiviert in ./relations/css_relations.css */
}

/* Path markers for tracker routes */
.path-marker-first {
    width: 14px;
    height: 14px;
    background-color: gray;
    border: 1px solid white;
    border-radius: 50%;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: block;
    z-index: 10;
}

.path-marker-intermediate {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: block;
    z-index: 5;
}

.tdoa-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: steelblue;
    border: 2px solid white;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    position: absolute;
}

.tdoa-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
}

.gateway-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(256, 256, 256, 0.5);
    border: 4px dotted crimson;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
	display:block; /* aktiviert in ./relations/css_relations.css */	
}

.gateway-request-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(256, 256, 256, 0.5);
    border: 4px dotted gray;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

/* ============================================================================
   MAP CONTROLS
   ============================================================================ */
.maplibregl-ctrl.maplibregl-ctrl-group {
    border-width: 0;
    box-shadow: 0 0 0 0;
    background: transparent;
}

.maplibregl-ctrl.maplibregl-ctrl-group button {
    border-radius: 5px !important;
    border: 1px solid lightgray;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
    background: white;
}

.maplibregl-ctrl.maplibregl-ctrl-group button:hover {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    background: white;
}

/* .maplibregl-ctrl.maplibregl-ctrl-group button.maplibregl-ctrl-compass {
    display: none;
} */


.maplibregl-popup {
    z-index: 110 !important;
}

.maplibregl-popup-content {
    z-index: 111 !important;
	border-radius: 10px;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.3);
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{
	border-top-color: crimson;
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip{
	border-bottom-color: crimson;
}
.maplibregl-popup-anchor-right .maplibregl-popup-tip{
	border-left-color: crimson;
}
.maplibregl-popup-anchor-left .maplibregl-popup-tip{
	border-right-color: crimson;
}



/* Measurement Tool Styles */
/* Measure Marker */
.measure-marker {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid white;
	box-shadow: 0 2px 4px rgba(0,0,0,0.3);
	cursor: crosshair;
}

/* Measure Button Active State */
#toggle-measure-btn.active {
	color: white;
}

/* Measure Popup */
.measure-popup h3 {
	margin: 0 0 8px 0;
}

.measure-popup .measure-coords {
	font-size: 11px;
	color: #666;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid #eee;
}