#mapscreen {
    display: none; 
    flex-direction: column;
    box-sizing: border-box;
    width: 850px;
    height: 600px;
    background: rgba(18, 22, 28, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(8, 155, 155, 0.3);
    border-radius: 12px;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(8, 155, 155, 0.15);
    overflow: hidden;
    position: absolute;
    z-index: 100;
}

#mapscreen.active,
#mapscreen.show {
    display: flex;
}

#mapscreen.maximized {
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 70px);
    max-height: calc(100vh - 70px);
    border: none;
    border-radius: 0;
    box-shadow: none;
}
#mapscreenheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    user-select: none;
}

#mapscreenheader .window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #089b9b;
    letter-spacing: 0.5px;
}

#mapscreenheader .window-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#maximizemapscreen {
    cursor: pointer;
    color: #888888;
    stroke: #888888;
    margin: 0;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

#maximizemapscreen:hover {
    color: #4dd0e1;
    stroke: #4dd0e1;
}

.mapscreeninput {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

.map-search-input {
    flex: 1;
    background: rgba(10, 14, 20, 0.7);
    color: #ffffff;
    border: 1px solid rgba(8, 155, 155, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.map-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.map-search-input:focus {
    border-color: #089b9b;
    box-shadow: 0 0 10px rgba(8, 155, 155, 0.3);
    background: rgba(10, 14, 20, 0.9);
}

.map-search-button {
    flex-shrink: 0;
    background: #089b9b;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 9px 14px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(8, 155, 155, 0.2);
}

.map-search-button:hover {
    background: #00bcd4;
    box-shadow: 0 0 15px rgba(8, 155, 155, 0.5);
    transform: translateY(-1px);
}

.map-search-button:active {
    transform: translateY(0);
}

#toggle-route-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#toggle-route-btn:hover {
    background: rgba(8, 155, 155, 0.15);
    border-color: rgba(8, 155, 155, 0.4);
    color: #4dd0e1;
}

.mapcontent-container {
    flex: 1;
    width: 100%;
    min-height: 400px;
    position: relative;
    box-sizing: border-box;
}

.mapcontent {
    width: 100%;
    height: 100%;
    background-color: #0c1017;
}

.route-sidebar {
    position: absolute;
    top: 0;
    left: -340px;
    width: 310px;
    height: 100%;
    background: rgba(18, 22, 28, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(8, 155, 155, 0.3);
    box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.route-sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #089b9b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-header .close-btn {
    background: transparent;
    border: none;
    font-size: 14px;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.sidebar-header .close-btn:hover {
    color: #ff5f56;
}

.sidebar-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group label {
    font-size: 11px;
    font-weight: 600;
    color: #089b9b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-content input {
    background: rgba(10, 14, 20, 0.7);
    color: #ffffff;
    border: 1px solid rgba(8, 155, 155, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.sidebar-content input:focus {
    border-color: #089b9b;
    box-shadow: 0 0 10px rgba(8, 155, 155, 0.3);
    background: rgba(10, 14, 20, 0.9);
}

.button-group {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

#calc-route-btn {
    flex: 2;
    background: #089b9b;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 9px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(8, 155, 155, 0.2);
}

#calc-route-btn:hover {
    background: #00bcd4;
    box-shadow: 0 0 15px rgba(8, 155, 155, 0.5);
}

#clear-route-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    color: #b0bec5;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 9px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#clear-route-btn:hover {
    background: rgba(255, 95, 86, 0.15);
    color: #ff6b6b;
    border-color: rgba(255, 95, 86, 0.3);
}

.route-info-box {
    margin-top: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid #089b9b;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: #e0e0e0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item span strong {
    color: #4dd0e1;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(18, 22, 28, 0.95);
    color: #ffffff;
    border: 1px solid rgba(8, 155, 155, 0.4);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    width: fit-content;
}

.map-popup-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
    width: 384px;
    box-sizing: border-box;
}

.map-popup-title {
    font-size: 12px;
    color: #4dd0e1;
    font-weight: 600;
    line-height: 1.3;
}

.map-popup-input-row {
    display: flex;
    gap: 6px;
    width: 100%;
}

.map-popup-select,
.map-popup-input {
    background: rgba(10, 14, 20, 0.8);
    color: #ffffff;
    border: 1px solid rgba(8, 155, 155, 0.3);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    outline: none;
}

.map-popup-select option {
    background: #12161c;
    color: #ffffff;
}

.map-popup-save-btn {
    width: 100%;
    padding: 8px;
    background: #089b9b;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.map-popup-save-btn:hover {
    background: #00bcd4;
    box-shadow: 0 0 10px rgba(8, 155, 155, 0.4);
}

.map-emoji-icon {
    font-size: 25px;
    line-height: 1;
    text-align: center;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
}

.map-pin-popup-container button,
.map-popup-delete-btn {
    background: rgba(220, 53, 69, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    margin-top: 4px;
    align-self: flex-start;
}

.map-pin-popup-container button:hover,
.map-popup-delete-btn:hover {
    background: #dc3545;
    color: #ffffff;
    border-color: #dc3545;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}