body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: Titillium Web !important;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Icona bus */
.bus-icon {
    width: 40px;
    height: 40px;
    background: rgb(0, 164, 164);
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    overflow: hidden;
}

.bus-icon-large {
    width: 100px;
    height: 32px;
    background: rgb(0, 164, 164);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    overflow: hidden;
}

.bus-icon-transparent {
    width: 40px;
    height: 40px;
    background: rgb(0, 164, 164);
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    overflow: hidden;
    opacity: 50%;
}

.bus-icon-large-transparent {
    width: 100px;
    height: 32px;
    background: rgb(0, 164, 164);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    overflow: hidden;
    opacity: 50%;
}

.stop-icon {
    width: 22px;
    height: 22px;
    background: rgb(51, 102, 180);
    border: 2px solid #ffffff;
    border-radius: 15%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    will-change: transform;
}

/* Icone inizio/fine shape */
.shape-endpoint-icon {
    width: 36px;
    height: 36px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: bold;
    color: #ffffff;
}

.shape-endpoint-icon.start {
    border-radius: 50%;
}

.shape-endpoint-icon.end {
    border-radius: 4px;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
}

.popup-content {
    font-size: 14px;
    line-height: 1.5;
}

.popup-head h3 {
    margin: 0;
    font-size: 16px;
    color: white;
}

.popup-base h3 {
    margin: 0;
    font-size: 16px;
    color: darkcyan;
}

.popup-content table {
    border-collapse: collapse;
}

.popup-content td {
    padding: 2px 6px 2px 0;
    vertical-align: top;
}

.popup-content td.label {
    color: #666;
    white-space: nowrap;
}

.popup-head {
    background-color: darkcyan;
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    padding: 4px;
}

.dispflex {
    display: flex;
    align-items: center;
}

.line-box {
    padding: 8px;
    background-color: rgb(0, 161, 161);
    width: fit-content;
    margin: 8px !important;
    border-radius: 8px;
    font-weight: bold;
    font-size: 24px;
    height: 40px;
    min-width: 40px;
    text-align: center;
    align-items: center;
    justify-content: center;
    display: flex;
    line-height: 1.1;
    overflow: hidden;
}

.dest-box {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    margin-right: 8px !important;
}

.stop-name-box {
    margin: 8px !important;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    align-items: center;
    justify-content: center;
    display: flex;
    overflow: hidden;
}

.stop-code-box {
    font-weight: normal;
    font-size: 14px;
    text-align: center;
}

.lines-container {
    display: flex;
    flex-wrap: wrap;
    margin-top: 6px;
}

.passing-line-box {
    padding: 8px;
    background-color: rgb(0, 161, 161);
    margin: 2px;
    margin-left: 0;
    margin-right: 4px;
    width: fit-content;
    border-radius: 8px;
    font-weight: bold;
    font-size: 15px;
    height: 20px;
    min-width: 20px;
    text-align: center;
    align-items: center;
    justify-content: center;
    display: flex;
    line-height: 1.1;
    overflow: hidden;
    color: white;
}

.head-desc {
    margin: 8px;
    margin-top: 0;
    color: white !important;
    font-weight: bold;
}

.popup-base {
    padding: 14px;
    padding-top: 6px;
    max-height: 230px;
    overflow-y: scroll;
}

hr.separator {
    margin-top: 6px;
    margin-bottom: 6px;
    color: #d8d8d8;
}

hr.head-separator {
    margin: 8px;
    margin-top: 0;
    border: 1px solid rgb(0, 161, 161);
    border-radius: 5px;
}

.bus-image-container {
    background-color: #e7e7e7;
    border-radius: 10px;
    text-align: center;
    color: #666;
    margin-top: 8px;
}

.bgtransparent {
    background-color: transparent;
    border-radius: 0;
}

.bus-image-container img {
    height: 100%;
    width: 100%;
    border-radius: 10px;
}

.shape-popup-head {
    background-color: #2b9c31;
    padding: 8px
}

.shape-popup-base {
    padding: 8px
}

.leaflet-container {
    font-family: Titillium Web !important;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 301px !important;
    max-width: 401px !important;
}

.leaflet-container a.leaflet-popup-close-button {
    color: white;
}

.leaflet-popup-content-wrapper {
    padding: 0;
}

a.button {
    width: 100%;
    height: 28px;
    text-align: center;
    background-color: rgb(0, 161, 161);
    color: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

#status {
    position: absolute;
    top: 10px;
    left: 50px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    display: none;
    max-width: 70%;
}

#legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    max-height: 26px;
    overflow-y: auto;
    margin-right: 10px;
}

#legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 3px 0;
}

#legend .legend-swatch {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* GPS */

.user-location-marker {
    position: relative;
    width: 20px;
    height: 20px;
}

.user-location-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    background: #1e88e5;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.user-location-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    background: rgba(30, 136, 229, 0.35);
    border-radius: 50%;
    animation: user-location-pulse-anim 2s infinite;
    z-index: 1;
}

@media (max-width: 1200px) {
    #legend {
        bottom: 20px;
    }
}

@keyframes user-location-pulse-anim {
    0% {
        transform: scale(0.6);
        opacity: 0.8;
    }

    70% {
        transform: scale(2.2);
        opacity: 0;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}