html,
body {
    font-family: sans-serif;
    height: 100%;
    margin: 0;
    padding: 0;
}

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

#activitiesPanel {
    position: absolute;
    top: 55px;
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    /* gap: 60px; */
    left: 10px;
    overflow-y: auto;
    padding: 8px;

    z-index: 1000;
    max-height: 89vh;       /* 🔧 ограничение във височина */
    overflow-y: auto;       /* 🔧 скрол при нужда */

    padding-left: 0;
    padding-right: 0;
    width: calc(200px + 16px); /* добавяме обратно тези 8px от всяка страна */
}

.activitiesItem {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding-left: 6px;
    padding-top: 2px;
    padding-bottom: 2px;
    border-left: 5px solid transparent;
    cursor: pointer;
    margin: 2px 0;
    transition: background 0.2s;
}

.activitiesItem:hover {
    background: #f0f0f0;
}

.activitiesItem.active {
    background: #d0f0ff;
    font-weight: bold;
}

.activitiesItem img {
    display: block; /* 👈 това премахва долния space */
    border-radius: 50%;
    height: 34px;
    margin-right: 2px;
    object-fit: cover;
    width: 32px;
}

.activitiesItem .name {
    font-size: 14px;
}

.avatarWrapper {
    display: inline-block;
    position: relative;
}

.avatarWrapper .removeBtn {
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    color: #333;
    cursor: pointer;
    font-size: 12px;
    padding: 0 4px;
    position: absolute;
    right: -6px;
    top: -6px;
}

.avatarWrapper .removeBtn:hover {
    background: #f00;
    color: white;
}

.avatar {
    border: 2px solid currentColor;
    border-radius: 50%;
    height: 34px;
    object-fit: cover;
    width: 32px;
}

.avatar.ref {
    border-color: black !important;
    border-width: 4px;
}

#chartPanel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    bottom: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    height: 40vh;
    left: 235px;
    max-height: 30vh;
    overflow: hidden;
    padding: 8px;
    position: absolute;
    right: 10px;
    top: auto;
    z-index: 1000;
}

canvas {
    width: 100%;
}

#chartCanvasWrapper {
    flex: 1;
    position: relative;
}

#delayChart {
    flex: 1;
    width: 100%;
}

#currentTimeLabel {
    font-family: monospace;
    min-width: 80px;
    text-align: right;
}

#selectedAvatars {
    display: flex;
    flex: 1;
    flex-direction: column;
    /* gap: 6px; */
    overflow-y: auto;
}

.avatarCard {
    align-items: center;
    background: #f8f8f8;
    border-left: 4px solid transparent;
    border-radius: 4px;
    display: flex;
    gap: 6px;
    justify-content: space-between;
    padding: 6px;
    position: relative;
}

.avatarCard img {
    border: 2px solid currentColor;
    border-radius: 50%;
    height: 32px;
    object-fit: cover;
    width: 32px;
}

.avatarCard .info {
    flex: 1;
}

.avatarCard .info .name {
    font-size: 14px;
}

.name {
    font-size: 14px;
    font-weight: normal;
}

.name.bold {
    font-weight: bold;
}

.avatarCard .info .elapsed {
    color: #666;
    font-size: 13px;
    text-align: right;
}

.fullTime {
    color: #666;
    font-size: 12px;
}

.avatarCard .diff {
    color: #444;
    font-family: monospace;
    font-size: 12px;
    min-width: 60px;
    text-align: right;
}

.close-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    height: 18px;
    padding: 0;
    position: absolute;
    right: 4px;
    text-align: center;
    top: 4px;
    width: 18px;
}

.infoValuesRow {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.toolRow {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.infoValue {
    font-size: 12px;
    text-align: right;
}

#selectedPanel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    gap: 8px;
    left: 235px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
    position: absolute;
    top: 10px;
    width: 200px;
    z-index: 1000;
}

#controlPanel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
}

#playTimeRow {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
}

#speedValue {
    color: #333;
    font-family: monospace;
    font-size: 13px;
    min-width: 40px;
    text-align: right;
}

#mapSliderRow {
    width: 100%;
}

#mapSlider {
    width: 100%;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: #ccc;
    border-radius: 5px;
    height: 6px;
    margin: 4px 0;
    outline: none;
    width: 100%;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #333;
    border-radius: 50%;
    cursor: pointer;
    height: 14px;
    width: 14px;
}

input[type="range"]::-moz-range-thumb {
    background: #333;
    border-radius: 50%;
    cursor: pointer;
    height: 14px;
    width: 14px;
}

#refTimeLabel {
    color: #444;
    font-family: monospace;
    font-size: 13px;
    min-width: 75px;
    text-align: center;
}

#refDateTime {
    color: #555;
    font-family: monospace;
    font-size: 12px;
    margin-top: -4px;
    opacity: 0.85;
    text-align: center;
}

#chartPanel,
#selectedPanel {
    transition: opacity 0.3s ease;
}

#shareControls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

#shareRow {
    align-items: center;
    display: flex;
    gap: 6px;
    width: 100%;
}

#shareRow button {
    flex: 0 0 auto;
}

#shareLink {
    flex: 1;
    min-width: 0;
}

#resizeHandle {
    background: #ccc;
    border-top: 2px solid #aaa;
    cursor: ns-resize;
    height: 4px;
}

.avatar-icon {
    background-position: center;
    background-size: cover;
    border: 2px solid #000;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
    height: 36px;
    width: 36px;
}

#searchContainer input {
    border: none;
    outline: none;
    padding: 8px;
    width: 100%;
    font-size: 14px;
    background: transparent;
    box-sizing: border-box;
    height: 20px;

}

#locationCloudContainer {
    display: flex;
    gap: 8px;
}

.location-tag {
    background: #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    user-select: none;
}

.location-tag:hover {
    background: #bbb;
}

#backButtonContainer {
    margin-top: 6px;
}

#searchResults {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-item {
    cursor: pointer;
    padding: 5px 10px;
}

.search-item:hover {
    background: #eee;
}

.actionRow {
    align-items: center;
    display: flex;
    gap: 6px;
    margin: 4px 0;
}

.map-btn,
.strava-btn {
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    height: 16px;
    justify-content: center;
    opacity: 0.7;
    padding: 0px;
    transition: opacity 0.2s ease;
    width: 16px;
}

.map-btn:hover,
.strava-btn:hover {
    color: coral;
    height: 16px;
    opacity: 1;
    width: 16px;
}

.map-btn img {
    border: none;
    display: block;
    height: 16px;
    width: 16px;
}

.strava-btn img {
    border: none;
    color: coral;
    display: block;
    height: 14px;
    width: 14px;
}

#searchContainer {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    left: 10px;
    padding: 8px;
    position: absolute;
    top: 10px;
    width: 200px;
    z-index: 1000;
}

.leaflet-control-logo {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 8px;
    display: flex;
    flex-direction: column; /* 👈 вертикално подреждане */
    align-items: center;
  }
  
/* бадж */
  .avatar-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #0f0;
    border: 0.2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 1px rgba(0,0,0,0.95);
    animation: pulse 1s infinite;
  }
  
  @keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.95; }
    100% { transform: scale(1); opacity: 1; }
  }
  
  .avatar-wrapper {
    position: relative; /* 🧠 важно за позициониране на баджа */
    display: inline-block;
  }
  