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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

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

/* ============================================================================
   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 {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

.mapctrl-btn {
    display: block;
	height:30px;
    width: 100%;
    padding: 4px 9px 4px 6px;
    margin: 0 0 5px 0;
    border: 1px solid gray;
    background: white;
    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;
}

.style-timer{
	padding: 2px 2px;
	background: #fff;
	font-size: 17px;
	font-weight: 500;
	cursor: default;
	user-select: none;
	text-align: center;
    box-shadow: none;
}
.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) */
  font-size: 20px; 
  line-height: 14px;
  font-weight: 600;
  position:relative;
  top:1px;
  color: #aaa;
}
.mapctrl-btn .info-icon {
	top: 2px;
	padding-right: 1px;
}
.mapctrl-btn .refresh-icon {
}
.mapctrl-btn .refresh-icon-large{
	font-size: 25px; 
}

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

/* ============================================================================
   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;
}

.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;
}

/* ============================================================================
   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{
    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-s.png");
	background-size: 20px;
	padding: 2px 5px 2px 25px;
	background-position: 0px 3px;
}
@media screen and (max-width: 500px) {
    .legend.now {
        display: none;
    }
}
@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: 13px;
    height: 18px;
    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 */
}

.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: relative;
}

.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;
}* /

/* ============================================================================
   TRACKER PATH MARKERS
   ============================================================================ */

/* Basis-Styling für alle Pfad-Marker */
.tracker-path-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    font-size: 13px;
    border: 1px solid white;
    cursor: pointer;
    /* transition: transform 0.2s; */
    color: transparent;
    background-color: color-mix(in srgb, #666 100%, transparent);
	display:block; /* aktiviert in ./relations/css_relations.css */
}

/* Hover-Effekt für alle Pfad-Marker */
.tracker-path-marker:hover {
    transform: scale(1.3);
}

/* Maplibre Marker Container anpassen */
.maplibregl-marker {
    /* z-index: inherit; */
}

/* Z-Index Hierarchie sicherstellen */

.tracker-path-pos-1{
    border-radius: 5%;
	width: 12px;
	height:12px;
    z-index: 11 !important;
}
.tracker-path-pos-1{
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0);
}
.tracker-path-pos-2{
    z-index: 12 !important;
}
.tracker-path-pos-3{
    z-index: 13 !important;
}
.tracker-path-pos-4{
    z-index: 14 !important;
}
.tracker-path-pos-5,
.tracker-path-newest{
    /* background-color: crimson !important;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
    z-index: 16 !important; */
	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;
}